hate these ads?, log in or register to hide them
Page 25 of 125 FirstFirst ... 15222324252627283575 ... LastLast
Results 481 to 500 of 2494

Thread: <xml><thread isTerrible="true" isUnderstandable="false" /></xml> - Coding help thread

  1. #481
    Daneel Trevize's Avatar
    Join Date
    April 10, 2011
    Location
    T L A
    Posts
    12,325
    63 is an int that can be a char, specifically ? in ASCII
    Quote Originally Posted by QuackBot View Post
    Idk about that, and i'm fucking stupid.

  2. #482
    Donor halbarad's Avatar
    Join Date
    April 9, 2011
    Posts
    4,924
    Quote Originally Posted by Daneel Trevize View Post
    63 is an int that can be a char, specifically ? in ASCII
    Except that the same thing happened on a different page when they were trying to call a function from a class using $class -> function()

    And the variable was 1 or 2 as it was a id of some sort I think.

  3. #483
    Pacefalm's Avatar
    Join Date
    April 9, 2011
    Posts
    6,359
    lolphp
    Quote Originally Posted by QuackBot View Post
    I'm doing my best. Well. Not really.

  4. #484
    Mrenda's Avatar
    Join Date
    April 9, 2011
    Posts
    3,442
    Where would I go to find out more on Unit Testing and Source Control.

    It seems those are two big things that you need to know, and they're not getting covered on my course (yet anyway.) I'd like to get a head start and begin looking into them to see how they work and what I need to do.

  5. #485
    Donor Rami's Avatar
    Join Date
    April 10, 2011
    Location
    London/Snuffbox
    Posts
    1,350
    Unit Testing: it depends on the language/framework you are working with at the time. Pick the one that you're working with on your course and search in google for unit testing. Any good language/framework has a unit testing framework to add on (or at least a very easy way to write a lot of tests).

    Source Control: Mainly SVN, Team Foundation Server (TFS) and well, Git are the main contenders in this area. Odds are no matter what company you end up working with they will be using one (or hell multiple) of these. SVN and Git are always good to know, SVN is the trickier of the two as it's older and wasn't build for simplicity as Git seems to be. Play with both, any standard linux install you can play around with these on the shell. Have a look at some of the web extensions for SVN and well for Git just look at any project on github ~~~
    TFS is mainly for .NET stuff, but it's quite handy and I don't really have complaints over it. TFS comes with Visual Studio these days so if you have a student license for that shit, grab it and have a play around.

  6. #486
    Daneel Trevize's Avatar
    Join Date
    April 10, 2011
    Location
    T L A
    Posts
    12,325
    SVN aka Subversion is centralised, Git is distributed iirc.
    TortoiseSVN is a Windows shell extension to ease using svn if you want a gui rather than command line.
    Most IDEs come with plugins to interact with either/many.

    As for testing, at uni we practically had test-driven coding for the standard OOP stuff. An automated testing suite was tied to the submission system, so you could see your pass rate increase because they had covarage of all the key features you were meant to achieve in a given exercise. So you'd resubmit & iterate from 0% and know when you'd caused a regression. Simple but effective way to persuade people to get used to using unit tests.
    Last edited by Daneel Trevize; December 2 2013 at 04:40:04 PM.
    Quote Originally Posted by QuackBot View Post
    Idk about that, and i'm fucking stupid.

  7. #487
    dpidcoe's Avatar
    Join Date
    June 29, 2011
    Location
    San diego
    Posts
    4,908
    Quote Originally Posted by Daneel Trevize View Post
    As for testing, at uni we practically had test-driven coding for the standard OOP stuff. An automated testing suite was tied to the submission system, so you could see your pass rate increase because they had covarage of all the key features you were meant to achieve in a given exercise. So you'd resubmit & iterate from 0% and know when you'd caused a regression. Simple but effective way to persuade people to get used to using unit tests.
    My professor for an operating systems class has something like this going for our C assignments. Basically it runs a shell script that attempts to compile your program and then diffs expected output vs actual output for a given input and e-mails the result to your class account.

    Unfortunately this is a 500 level class, and the first I've ever seen and kind of test driven code formally encouraged. I'm amazed at the amount of people in the 1st and 2nd year courses who don't understand about doing that, and literally don't know if the class or interface they were implementing actually works right because they didn't want to spend 5 minutes writing a main to instantiate the thing and call some of the methods to see if they did what they should.
    i heard you're ideas and their definately good

  8. #488
    Mrenda's Avatar
    Join Date
    April 9, 2011
    Posts
    3,442
    Quote Originally Posted by Daneel Trevize View Post
    As for testing, at uni we practically had test-driven coding for the standard OOP stuff. An automated testing suite was tied to the submission system, so you could see your pass rate increase because they had covarage of all the key features you were meant to achieve in a given exercise. So you'd resubmit & iterate from 0% and know when you'd caused a regression. Simple but effective way to persuade people to get used to using unit tests.
    That seems to be what the EdX programming classes were using. I sort of get the idea of unit testing, I just don't know how to go about it or the breadth of its scope.

    And I've been messing around with GitHub and the Eclipse plugin for it.

  9. #489
    Donor Sponk's Avatar
    Join Date
    April 10, 2011
    Location
    AU TZ
    Posts
    11,393
    Quote Originally Posted by Mrenda View Post
    That seems to be what the EdX programming classes were using. I sort of get the idea of unit testing, I just don't know how to go about it or the breadth of its scope.

    And I've been messing around with GitHub and the Eclipse plugin for it.
    The next step after you work out unit testing is to do test-driven development.

    i.e.

    1. work out what you want the code to actually *do*
    2. Write some tests to determine whether it does it
    3. make the code that fills the test
    4. Need extra functionality? Start at step 1 and make tests before you code, don't keep going on step 3 you knob
    Contract stuff to Seraphina Amaranth.

    "You give me the awful impression - I hate to have to say - of someone who hasn't read any of the arguments against your position. Ever."


  10. #490
    Daneel Trevize's Avatar
    Join Date
    April 10, 2011
    Location
    T L A
    Posts
    12,325
    And in my experience it works really well, especially if you're learning a language or library. If you have the time/discipline to do it in the right order. Which is obviously the point where real world managers step in and why we can't always have nice things.
    Quote Originally Posted by QuackBot View Post
    Idk about that, and i'm fucking stupid.

  11. #491
    dpidcoe's Avatar
    Join Date
    June 29, 2011
    Location
    San diego
    Posts
    4,908
    Quote Originally Posted by Daneel Trevize View Post
    And in my experience it works really well, especially if you're learning a language or library. If you have the time/discipline to do it in the right order. Which is obviously the point where real world managers step in and why we can't always have nice things.
    heh, in my experience it all falls down when I try that with a language or library that I don't know very well. Without knowing how the language works, it can be very tricky trying to figure out how your code is going to do what you want it to do (and therefore write tests for it). I end up either sinking way too much time into re-writing tests, or becoming way too hesitant to change the way something works if I see a better way to do it because "I already made a test that tests this less optimal function and it's too much effort to change it".
    i heard you're ideas and their definately good

  12. #492

    Join Date
    April 13, 2011
    Posts
    6,184
    Quote Originally Posted by Daneel Trevize View Post
    Which is obviously the point where real world managers step in and why we can't always have nice things.
    I'm trying to get a proper test-driven, agile methodology in place at A Large Public Sector Body. The signs so far are encouraging. Today's planning meeting lasted only 9 hours and covered only the next 8 months of work!

    It's actually really hard to get right. In my experience people tend towards the attitude of "Well my tests passed so there's no more problems right?", ignoring all other quality issues, particularly performance. Throw in the timeboxed, agile processes you inevitably get in TDD shops and you've got a recipe for half-baked code that's functional but not great. You've really got to press that there's nothing wrong with iterating over something that already works or designing tests that actually test performance.
    Last edited by elmicker; December 2 2013 at 11:53:49 PM.

  13. #493
    balistic void's Avatar
    Join Date
    May 5, 2011
    Location
    Dublin
    Posts
    2,637
    #1 Setup Jenkins - configure it to mail all developers when build or unit tests fail.
    #2 Institute procedure whereby developers that break the build/tests receive crucifixion / other harsh punishment.
    #3 Marvel at how much better everything is!

  14. #494
    Donor Sponk's Avatar
    Join Date
    April 10, 2011
    Location
    AU TZ
    Posts
    11,393
    Quote Originally Posted by elmicker View Post

    I'm trying to get a proper test-driven, agile methodology in place at A Large Public Sector Body. The signs so far are encouraging. Today's planning meeting lasted only 9 hours and covered only the next 8 months of work!

    It's actually really hard to get right. In my experience people tend towards the attitude of "Well my tests passed so there's no more problems right?", ignoring all other quality issues, particularly performance. Throw in the timeboxed, agile processes you inevitably get in TDD shops and you've got a recipe for half-baked code that's functional but not great. You've really got to press that there's nothing wrong with iterating over something that already works or designing tests that actually test performance.
    We did it the other way for our existing systems.

    1. Every defect that crosses our desk needs a unit test to prove its existence (or we write one)
    2. Every fix must have a unit test proving that the problem is fixed.

    This short-circuits the 'oh it costs too much' approach.
    Contract stuff to Seraphina Amaranth.

    "You give me the awful impression - I hate to have to say - of someone who hasn't read any of the arguments against your position. Ever."


  15. #495
    dpidcoe's Avatar
    Join Date
    June 29, 2011
    Location
    San diego
    Posts
    4,908
    So I've been helping various people who are taking the java algorithms class that I took last year. I keep being confronted with things like this and asked why it doesn't work:

    Code:
    Node parent;
    ...
    parent = (Node<K, V>) parent.leftNode.key;
    And these are people who are supposedly in their second to third years of the CS program.

    I normally don't like to mock people for simple mistakes, and I'd pass it off as them just having a brainfart, but it's not just one student or one time that people who should know better have come to me completely stumped over stuff like that
    i heard you're ideas and their definately good

  16. #496
    Donor Sponk's Avatar
    Join Date
    April 10, 2011
    Location
    AU TZ
    Posts
    11,393
    I haven't seen such bad casting since anything with Lindsay Lohan.
    Contract stuff to Seraphina Amaranth.

    "You give me the awful impression - I hate to have to say - of someone who hasn't read any of the arguments against your position. Ever."


  17. #497
    Donor Rami's Avatar
    Join Date
    April 10, 2011
    Location
    London/Snuffbox
    Posts
    1,350
    Quote Originally Posted by Sponk View Post
    I haven't seen such bad casting since anything with Lindsay Lohan.
    I lol'd. You shouldn't need to cast there anyway. Also why do people still insist on declaring variables at the top of functions (this example merely implied he did but I'm ranting anyway)?! The days of C99 are gone by you know. It's best to keep a minimalistic scope (it also helps with RAII).

  18. #498
    smagd's Avatar
    Join Date
    April 12, 2011
    Location
    https://duckduckgo.com
    Posts
    1,323
    I understand the "We found a bug, let's write a unit test to make sure the same bug never happens again" approach.

    If CCP did that you wouldn't see the same old bugs resurfacing time and again.

    But, recently unit tests made me aware that they can make me a better [programmer] [developer] [designer] senior software architect *), too:

    "Wait, how the hell am I going to write a unit test for that? I can't even mock half of the things this does!"

    Translation:

    "My architecture is a mess. I need to separate a few layers out of this so I can mock up and test each individual function."

    *) I hate my boss.
    Quote Originally Posted by dstopia
    WHERE IS CCP AND WHAT HAVE YOU DONE WITH THEM?????

  19. #499
    Super Moderator DonorGlobal Moderator
    Join Date
    April 9, 2011
    Posts
    3,701
    some of our customers have a requirement for 100% test coverage.

    We have tried to explain how utterly retarded it is and how it leads to worse tests and inane tests that actually serves no purpose. I think a lot of people get caught up in the magic test coverage % seeing as they cannot use the lines of code number as a metric anymore.

    My point is that when you are learning how to use TDD and unit tests, don't get caught up in trying to reach 100% coverage (which is more or less impossible), but rather think: Why are you testing, how can I catch unintended changes that will break functionality or worse.

  20. #500
    Donor Rami's Avatar
    Join Date
    April 10, 2011
    Location
    London/Snuffbox
    Posts
    1,350
    Hastipoo is right. We have tons of build tests and a few dozen data sets for regression tests in our search engine and we still get bugs (some silly) in releases. You simply can't catch everything or you'd never be releasing your software. The more flexibility you give to the user, and the more complexity in the product, the harder coverage becomes. Testing a single method that should only take an unsigned integer and return a boolean is trivial and so people who start with unit testing get the illusion that this is foolproof.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •