Slashdot Mirror


Visual Studio Gets Achievements, Badges, Leaderboards

bonch writes "Microsoft has introduced a gamification plugin for Visual Studio that lets users win achievements and badges as they compete on leaderboards by writing code. The full list of achievements includes gems like 'Go To Hell' for using goto, and 'Potty Mouth' for using five different curses in one file. This is another example of Gamification, one of the latest trends to hit social media."

83 of 353 comments (clear)

  1. I miss GOTO...there I said it by elrous0 · · Score: 5, Insightful

    I know that the established programmer hierarchy would have me burned at the stake for even hinting at it, but I miss my old GOTO statement. Call it sloppy if you like, but a simple one line statement beats the shit out of the acrobatics I often have to do in Java to SIMPLY JUMP OUT OF THIS METHOD/LOOP TO A SINGLE SPECIFIC POINT IN THE PROGRAM.

                      break;}
              break;}
          break;}
    return;} //shit, still doesn't go where I need it to

    Now, cue the voices of 1,000 programmers looking for a non-existent "disagree" mod and screaming at the top of their girlie lungs on why GOTO is EVIL, EVIL, EVIL--as they parrot the professors who taught them that.

    --
    SJW: Someone who has run out of real oppression, and has to fake it.
    1. Re:I miss GOTO...there I said it by The+MAZZTer · · Score: 5, Insightful

      I would skip GOTO in favor of putting some of that logic into a function. Then I can simply return; from it instead of using a GOTO to break out of as many levels of logic as I need, back to the calling function.

    2. Re:I miss GOTO...there I said it by Robadob · · Score: 4, Informative

      You can use labels in java to break out of nested loops?

    3. Re:I miss GOTO...there I said it by piripiri · · Score: 5, Insightful

      Maybe you shouldn't nest these control structures like this... Flat programming, rings a bell?

      Oblig. KXCD

    4. Re:I miss GOTO...there I said it by Anonymous Coward · · Score: 2, Informative

      What's your problem? Java supports loop labels.

    5. Re:I miss GOTO...there I said it by gilwooden · · Score: 5, Funny

      You can use labels in java to break out of nested loops!

    6. Re:I miss GOTO...there I said it by Bigfield · · Score: 2

      I agree that goto has it place. Used in a right place it may result in much more readable and maintainable code. But, when used unwisely it will result in spaghetti code. You _can_ write all your code without goto but when your code screams for a goto, use it!

      In you example, however, that deep nesting is just asking for trouble; goto or no goto. ;-)

    7. Re:I miss GOTO...there I said it by Anonymous Coward · · Score: 5, Informative

      Was why GOTO is a bad idea every explained to you?

      The honest fact is that, if you go low level enough, it (equivalent) is the only method of not proceeding to the next instruction, so you'd think that it would make sense to have it in all the higher languages.
      However, the difference there is each label is (generally) only used once, and the state of all registers will be the same before and after. The problem with goto is that it requires the compiler to work out the meaning of all the variables at the point it jumps to, and to deal with loading those all into memory as part of the jump operation. At least with breaking out of a loop, you're going to be in the same scope as leaving it through the loop's condition becoming false. Returning from that context will move up (or, if you view things the other way, down) a scope, which is reasonable to deal with

      GOTOs, on the other hand, used to allow jumps into noticeably different scopes, where variable contexts could lead to information not having the right meaning. And, that's where the raptors break through.

      [citations needed]

    8. Re:I miss GOTO...there I said it by Sponge+Bath · · Score: 5, Funny

      ...when your code screams for a goto, use it!

      When your code anthropomorphizes, hit the delete key.

    9. Re:I miss GOTO...there I said it by jps25 · · Score: 4, Informative

      The Linux kernel uses goto statements. About 95000 times..

    10. Re:I miss GOTO...there I said it by dkf · · Score: 2

      I know that the established programmer hierarchy would have me burned at the stake for even hinting at it, but I miss my old GOTO statement. Call it sloppy if you like, but a simple one line statement beats the shit out of the acrobatics I often have to do in Java to SIMPLY JUMP OUT OF THIS METHOD/LOOP TO A SINGLE SPECIFIC POINT IN THE PROGRAM.

                        break;}

                break;}

            break;}
      return;} //shit, still doesn't go where I need it to

      Now, cue the voices of 1,000 programmers looking for a non-existent "disagree" mod and screaming at the top of their girlie lungs on why GOTO is EVIL, EVIL, EVIL--as they parrot the professors who taught them that.

      While I'm not averse to using goto as necessary where available, I do try to avoid it as it is distinctly easy to make unclear code with it. With Java you do have the ability to label (and break/continue) loops, and of course you have exceptions and finally clauses to make various cleanup patterns simple. You also have private methods that are really cheap. All that sort of horrible mess that would lead to the precise thing that you're complaining about should be refactored so that it conveys its exact intention clearly instead of spreading complexity all round the place. If all those good things I just mentioned are not sufficient to handle your specific case, I want to know what's going on. (Or maybe I don't; it sounds really scary-bad!)

      Of course, if your real problem is that you're working somewhere with a strict "no break in loops, no return from functions except at end" policy, there's no hope for you. You're doomed by someone in charge who hasn't understood a single thing written about how to analyze programs for the past 30 years.

      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    11. Re:I miss GOTO...there I said it by swillden · · Score: 5, Insightful

      The Linux kernel uses goto statements. About 95000 times..

      In the absence of exceptions, goto is a great tool for simplifying and clarifying error handling.

      In a language with exceptions, goto is much less useful. I won't say it's never useful, but if I'm ever tempted to use goto for anything other than jumping to an error handling block, I know I need to take a step back and rethink the structure of the code, because there's almost certainly a better way.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    12. Re:I miss GOTO...there I said it by SuricouRaven · · Score: 2

      I don't know about Java, not being a coder in it myself, but in C you can inline small function calls so they don't pushpop. You don't even need to on the very small ones - any decent optimising compiler will do it for you transparently.

    13. Re:I miss GOTO...there I said it by randomsearch · · Score: 2

      Interesting comment, but I'm with Dijkstra on this one:

      http://www.ifi.uzh.ch/req/courses/kvse/uebungen/Dijkstra_Goto.pdf

      RS

    14. Re:I miss GOTO...there I said it by ifrag · · Score: 2

      The way it's described in the kernel coding style is probably one of the very few "correct" uses of it. In fact, I know we have code here that does exactly that, goto cleanup; then it has a return right after taking care of whatever buffers and such. Initially I was somewhat offended looking at it but after a while I've started to agree with it. In fact, I'd say that use pretty much justifies its continued existence.

      --
      Fear is the mind killer.
    15. Re:I miss GOTO...there I said it by Dhalka226 · · Score: 2

      I'm not a purist. I don't believe there is anything in a programming language that works fine and yet should never, ever be used. If it is appropriate, use it.

      Obviously I only see the fragment of code you put there (and in all probability you made it up on the spot rather than taking it from an existing codebase) but when I see that level of nesting and then you're still not happy with where the code ends up my first instinct isn't "gosh, a goto would work great here." It's "is this program really structured well?" I'm honestly having trouble thinking of why you would need to nest three levels deep and yet do so in a function without a return value. It sounds like a goto here would just be taking the place of a return value and a switch.

      In any event, my main objection is your attitude. You dismiss calls that it may be sloppy and then declare you use a goto because you want to do exactly what goto does (well no shit, why else would you use it?) and then go on some rant about potential moderations and insult people who might disagree with you as girlie parrots incapable of arriving at a conclusion without regurgitating something they were told by a professor and yet don't understand. I wonder if there is any kind of middle ground to be had? Naaaah.

      Gotos usually are sloppy. If there really is no way to refactor something into a way that doesn't need one, or it is really so egregiously difficult to do that it is not worth the time to do so at any point, so be it -- use it. Usually they are a crutch for bad flow. Insulting people for acknowledging that does not change it. If you are one of those magical programmers who use gotos and yet never misuse them, congratulations. Without knowing you or anything about you, though, I am more inclined to think it's a case of illusory superiority.

    16. Re:I miss GOTO...there I said it by MacGyver2210 · · Score: 2

      Is it written entirely in ASM?

      --
      If the only way you can accept an assertion is by faith, then you are conceding that it can't be taken on its own merits
    17. Re:I miss GOTO...there I said it by VGPowerlord · · Score: 4, Informative

      Oddly enough, GOTO does have a legitimate use in C#. Switch statements in C# don't fall through. If you want a switch statement to fall through, you have to use a goto ; to force the fall through.

      Unless it's an empty switch statement. Those are allowed to fall-through.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    18. Re:I miss GOTO...there I said it by Twylite · · Score: 5, Informative

      Judicious use of GOTO can dramatically simplify resource cleanup when exception handling is not supported. A function that must grab N resources in order (and free them in reverse order on success or failure) requires N nested blocks if you don't use GOTO (and no nesting if you do use GOTO). Often the only way to refactor such logic into sub-functions is by using continuation passing style, which is clear as mud.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    19. Re:I miss GOTO...there I said it by gstoddart · · Score: 4, Informative

      Interesting comment, but I'm with Dijkstra on this one:

      One of my profs once laughed at me when I said his code had a goto and we shouldn't do it that way (because that's what we'd been taught in class).

      Then he sat me down and walked through the code, and explained what the code was doing, and the failure modes that made it necessary to use a goto. This was OS-level code, and performing some very fiddly things, and several layers deep in looping structures. You'd have had to put in twice as much code to check the error conditions necessary to peel out of that, and since it was essentially working on bare metal, there was simply no room to add much more overhead.

      He did manage to convince me that a goto isn't something you do because it's convenient, but that in some code, in some languages there simply isn't a better alternative to bail out of some code in the event of a failure.

      I have worked in a couple of languages (one being C, the other proprietary) in which a goto was the cleanest/only way to get out of the code, and get to a place where you could do all of your cleanup and get out cleanly.

      It has its place, but it should definitely be used sparingly. Blindly saying never use a goto doesn't always give you the best solution.

      --
      Lost at C:>. Found at C.
    20. Re:I miss GOTO...there I said it by nahdude812 · · Score: 2

      There are a handful of times where goto is simply the most elegant solution, and a handful of times where performance really matters, so encapsulating logic into a function to avoid a goto will be too costly. I've used it once since my high school BASIC days; interestingly it was only a few months ago.

      We had a costly operation working against arbitrary precision numbers, with some nondeterministic aspects. Part of the data produced is very publicly visible, and because of the nondeterministic aspects of things, we had an incident where some undesirable output was produced (valid by system design, but humans found it offensive). So rather than restart the whole operation to let the nondeterministic side of things produce something more desirable, we want to change just a chunk of the data and jump back into the middle of things to recompute the downstream results.

      I know I'm being vague, I have to be. I wrote the procedural equivalent, and not only did it separate tightly related logic, the performance cost was significant at this scale, even for the non-exception scenarios, and the amount of markup to support it was prohibitive. It also actually upped the CRAP score (which was already unusually high because the focus was on performance optimization). The goto alternative was literally two lines: one label and one goto, and introduced essentially no overhead for the most common use case (the vast majority of the time the produced data contains nothing offensive).

      I'm still embarrassed by it, but even now going back and looking at it, I'm not sure how I would do it in a more readable or performance equivalent manner. I made sure to include a link to this comic in the source next to it, along with a clear description of why that was the path chosen over a more traditional approach.

      I could be that I just fundamentally structured the flow wrong. Maybe there there was a better path through this. My team mates ribbed me for using the goto, but agreed that it was both more readable in the end, and observed the performance cost of the alternate approach; a rare exception was made in code review to allow this.

    21. Re:I miss GOTO...there I said it by ais523 · · Score: 3, Informative

      The purpose of goto is to stand in for whatever control structures your language needs but doesn't have. Goto for error cleanup in C is one of those examples: it's the best way to do it in C, but if the language had better support for doing that, a goto wouldn't be necessary.

      --
      (1)DOCOMEFROM!2~.2'~#1WHILE:1<-"'?.1$.2'~'"':1/.1$.2'~#0"$#65535'"$"'"'&.1$.2'~'#0$#65535'"$#0'~#32767$#1"
    22. Re:I miss GOTO...there I said it by AaronLS · · Score: 4, Insightful

      Sometimes algorithms have complex break conditions. You are arrogant to judge so quickly when all you have is a code snippet. I love these people who glance at some code and then say "you should refactor/redesign that" and offer no more than vague suggestions. In situations where I have the authority, I respond by assigning them the task they themselves suggested. Guess what I do when they fail at the very task they themselves so derogatorily suggested?

    23. Re:I miss GOTO...there I said it by alexo · · Score: 2

      shit, still doesn't go where I need it to

      Allow me to introduce you to the modern wonders of indoor plumbing.

    24. Re:I miss GOTO...there I said it by Karrde712 · · Score: 3, Informative

      GOTO is certainly very useful in some circumstances. For example, a common pattern in the samba and SSSD sources is this (taking advantage of the talloc() hierarchical memory allocator):

      tmp_ctx = talloc_new(parent_ctx).
      *allocate memory on tmp_ctx *
      do stuff or fail and goto done.
      *allocate more memory on tmp_ctx *
      do stuff or fail and goto done.

      done:
                      talloc_free(tmp_ctx);
                      return result;

      It's really handy to be able to just jump directly to the done: tag on any error and know that any memory you allocated is cleaned up appropriately.

      --
      You may treat all information submitted above as wild speculation.
    25. Re:I miss GOTO...there I said it by vgerclover · · Score: 2

      Blindly saying never use a goto doesn't always give you the best solution.

      Blindly saying never do X hardly ever gives you the best solution.

    26. Re:I miss GOTO...there I said it by Twylite · · Score: 5, Informative

      [citations needed]

      Citations won't be found, because the explanation is incorrect. There is no technical issue with compilers implementing 'goto' so long as the destination is in the same lexical scope (C has this limitation). Nor is it worth considering execution context at the level of the CPU, as any high-level loop or branch instruction must be translated into one of a limited number of conditional or non-conditional, relative or absolute jumps. Ultimately whether you use 'goto' or some other control construct you are attempting to express the same programmatic flow, and the compiled instruction stream will be sufficiently similar that it's not worth splitting hairs over.

      The reason 'goto' is "considered harmful" is because structured programming theorizes that any computable function can be expressed by combining simpler programs using sequence, selection and iteration; and this provides the opportunity for a constructive approach to program correctness. Dijkstra argues that we are cognitively limited and can benefit from code that is structured so that we can tell at any point where we are and where we have come from (a gross paraphrasing of what Dijkstra calls "coordinates"). But "[t]he unbridled use of the go to statement has as an immediate consequence that it becomes terribly hard to find a meaningful set of coordinates in which to describe the process progress". In other words careless use of 'goto' makes it hard to reason about your code.

      Knuth contended that one could created structured programs with 'goto' statements, and provided examples of how 'goto' make the program more elegant.

      It is important to realise that the claimed advantages of structured programming are undone by the use of break, continue, or exception handling. There are limited forms of goto, and using them prevents proofs of correctness (under the assumptions of structured programming; other techniques may be available) and reasoning using Dijkstra's "coordinates".

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    27. Re:I miss GOTO...there I said it by DrXym · · Score: 2

      No it doesn't need 7 (assuming N = seven) nested blocks. You could put the variable declaration outside the block assigned to null and then test if the value is null inside the finally, if its not null then do what you have to do to release it. If the values were all the same type it would be trivial to write a loop to do this 7 times. Or write some kind helper method that you call 7 times to do the job. But if you really have 7 resources, then maybe it's time to think about decomposing the code into more manageable chunks.

    28. Re:I miss GOTO...there I said it by Twylite · · Score: 3, Insightful

      Yes. We used to do that in some of our source code bases. I always like how "important programmers" at "big companies" think 'goto' is verboten, but don't notice switch statements with fall-through cases. Because they're sooo much safer ;)

      So I reversed that situation, and our incidence of resource handling errors went down markedly. As did our incidence of logic bugs from failing to break out of a switch.

      In my opinion, obscuring the logic you're trying to express by using a workaround involving an arbitrarily "approved" keyword, obscures the logic.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    29. Re:I miss GOTO...there I said it by Rary · · Score: 5, Insightful

      People misunderstand the point of the whole "goto is evil" thing. It's not that jumping around in code is evil. No program of any real value can run sequentially from start to finish. You have to jump around to do anything useful. Conditional processing, iteration, function calls, and exception handling all involve jumps of one kind or another. Whether the language calls it "goto" or gives it a different name doesn't change the fact that it's a jump.

      However, there are a set of logical, structured jump patterns that have been well defined over the decades which produce readable, understandable, debuggable, extendable, logical code. These patterns include the constructs I described previously. Some languages have specific keywords for these constructs, while others rely on the keyword "goto" for their implementation. There's nothing wrong with using "goto" to implement one of these logical patterns, if that's how the pattern is implemented in that particular language.

      However, it is possible in languages that have a "goto", to execute a jump that is outside of these known patterns. These illogical, seemingly random jumps result in code that is confusingly obfuscated, and consequently more error-prone, as well as harder to extend.

      So, when people say "goto is evil", they're really saying "unstructured jumps are evil". Using such a construct might accomplish what you're trying to accomplish, but it will generally do so at the expense of readability, maintainability, and extendability of the code.

      And yes, any language, whether it has a "goto" or not, can be abused by a properly (un)skilled programmer to create a chaotic mess of spaghetti code.

      --

      "You cannot simultaneously prevent and prepare for war." -- Albert Einstein

    30. Re:I miss GOTO...there I said it by blueg3 · · Score: 3, Interesting

      Parent is actually combining two different "this". Functions that don't need the full calling system can use an alternate fast calling system that's less expensive. Optimizing compilers can do this automatically. Separately, small functions (or functions called once, or non-small functions) can be inlined, usually automatically. It's usually documented in the compiler optimization options, for one.

    31. Re:I miss GOTO...there I said it by TheLink · · Score: 3, Informative

      I would skip GOTO in favor of putting some of that logic into a function. Then I can simply return;

      Sometimes that makes the code harder to read - you have to go look up what each function does, when it's actually a different but simple thing each time.

      Visual Studio does make the looking up quite easy (and you can nav back to the original place from the function), but it still takes longer than just looking at everything in one page and then scrolling a bit to see the rest.

      And lastly, you often have to come up with decent names for those functions ;). Sometimes coming up with good names takes longer than just writing the code...

      --
    32. Re:I miss GOTO...there I said it by johny42 · · Score: 2

      I don't know about Java, not being a coder in it myself, but in C you can inline small function calls so they don't pushpop.

      Whoever reads the code still has to pushpop (mentally) to understand what it does. Many programmers underestimate how much it adds to readability if you're able to just read a chunk of code line by line instead of jumping back and forth (often between multiple files).

    33. Re:I miss GOTO...there I said it by aztracker1 · · Score: 2

      Should probably link to the original source. :)

      --
      Michael J. Ryan - tracker1.info
    34. Re:I miss GOTO...there I said it by Mobius+Evalon · · Score: 2

      The issue with goto is that it is a supremely useful language construct that resides on the far end of Caveat Valley. Egregious use by those who are inexperienced far outnumbers proper use by those who employ it correctly, because it is somehow more attractive than the construct they really need, which is generally break.

      Goto and other program 101 are at such a basic level that those who generally require education on its proper deployment are too inexperienced to comprehend an example that displays its proper use. Instructors just take the fire and brimstone approach and declare goto is a sin just to simplify the process. It's a victim of character assassination.

      --
      Potatoes are friggin' magical. Can you power an alarm clock with a carrot? No, sir!
    35. Re:I miss GOTO...there I said it by shutdown+-p+now · · Score: 2

      With try-blocks in Java 7, you can have a single one:

      try (
        Foo foo = new Foo();
        Bar bar = new Bar();
      ...
      ) {
      ...
      }

    36. Re:I miss GOTO...there I said it by shutdown+-p+now · · Score: 2

      One important correction: it has nothing to do about exceptions, and everything to do about RAII. If C had scope guards, you could ditch goto for resource cleanup while still returning error codes to indicate values.

    37. Re:I miss GOTO...there I said it by Tom · · Score: 2

      Then he sat me down and walked through the code, and explained what the code was doing, and the failure modes that made it necessary to use a goto.

      Exactly. To every rule there is an exception, and if you would not ever want to use a GOTO, don't you think programming languages would have removed it by now?

      For every hallowed "law" of programming, there is always a case where it doesn't hold true. I passed my assembler 101 with a self-modifying program, even though the prof told us pretty much every other lecture that self-modifying programs are a big no-no (and yes, thus the challenge was born in my mind). Because I could explain why in this particular case for this particular purpose, the specific self-modifications I made were the best solution.

      It has its place, but it should definitely be used sparingly. Blindly saying never use a goto doesn't always give you the best solution.

      Amen

      --
      Assorted stuff I do sometimes: Lemuria.org
    38. Re:I miss GOTO...there I said it by Grishnakh · · Score: 3, Informative

      Nowadays, the idea of using goto as a 'jump to function end' is reasonable, and a lot less expensive than throwing an exception to do the same thing... yes, I've seen them used for that.

      It's extremely common in Linux kernel code (particularly device drivers), as it's used for error handling there, so that you can perform resource-freeing operations in reverse order very simply without a lot of indentation and braces.

      ret = do_op1();
      if (!ret)
              goto fail1;
      ret = do_op2();
      if (!ret)
              goto fail2;
      ret = do_op3();
      if (!ret)
              goto fail3;
      ret = do_op4();
      if (!ret)
              goto fail4;
      return 0;

      fail4:
      undo_op4();
      fail3:
      undo_op3();
      fail2:
      undo_op2();
      fail1:
      undo_op1();
      return -1;

      Try rewriting that in C, without goto, in an unconvoluted way. And don't exceed 3 levels of indentation, and don't create any additional functions.

    39. Re:I miss GOTO...there I said it by Xtifr · · Score: 2

      I agree that GOTO has its uses

      Which is why the idea of automatically marking it as bad is stupid.

      I haven't used goto in over 20 years, but, looking back, there's probably a few cases where I should have--cases where it would have made the code not only more efficient, but clearer.

      (Also, in general, I think the RAII pattern is better than try/finally in most--but not all--cases, but that also requires language support.)

    40. Re:I miss GOTO...there I said it by DrXym · · Score: 2

      You have to try / catch in your finally block. It's very clumsy really but that's how to do it pre-Java 7. C# has a more elegant solution with its using keyword where disposable stuff automatically gets closed when it leaves the using block. Java 7 sort of has something analogous now by allowing a try with resources construct.

  2. "Gamification" doesn't make dull things a game... by Anonymous Coward · · Score: 2, Interesting

    It just makes them dull things with out of place social media gimmicks.

    As a gamer, I am not pleased with this trend.

  3. seriously — they're totally missing the poin by mattdm · · Score: 4, Insightful

    The idea of gamification is to give little awards for postitive behavior — or at least active engagement with the site/product/tool/whatever. A few of these fit that (the badge for working on a Saturday or Friday night), but most of them are labels of shame for doing things like writing a single line of code that is several screens too wide.

  4. Re:"Gamification" doesn't make dull things a game. by Anonymous Coward · · Score: 2, Funny

    I know right? It is poor to think that only 5 'curse' words per file gets you Potty Mouth status. They obviously think that is a challenge.

  5. Re:Actually... by Deus.1.01 · · Score: 5, Funny

    *even grammar*

    --
    My -1 Troll is actually a +1 funny. And my -1 flame is actually a +1 insightfull.
  6. Good idea by XrayJunkie · · Score: 3, Interesting

    I find this idea quite nice. Encourage people to have some fun while programming (boring stuff). This wont result in bad code. The gain for MS: create an account to store and publish your achievements.

    1. Re:Good idea by Speare · · Score: 2

      I find this idea quite nice. Encourage people to have some fun while programming (boring stuff).

      If writing code is the boring part of your career, why did you train yourself and get into that line of work? Most people I know who write code, because they want to write code, they feel best when given the opportunity between meetings to write code. The best developers I know tend to go home after their job, and sit down to their hobby projects where they... write code.

      --
      [ .sig file not found ]
  7. Do While by QBasicer · · Score: 3, Funny

    It better have one for do-whiles, I always feel like I've made a great accomplishment when I use one. It makes a day a little less sucky.

    --
    x86, oh yes, I'm pro.
    1. Re:Do While by networkBoy · · Score: 2

      That's funny. The codebase I inherited is *full* of do{}while(0); with a bunch of breaks inside of the do to jump out at any point something goes haywire. Come work for my team, your day will never suck (at least my that metric).
      -nB

      --
      whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
    2. Re:Do While by networkBoy · · Score: 2

      To be fair, the code is reliable, stable, and the Do{}while(0);'s are not so long as to be trouble tracing. This is all C code, not C++, and has to be cross compatible with embedded firmware, Windows, and Linux. Also, since that's close to the largest sin in the codebase, I'll not be leaving anytime soon.

      the general layout is of the general style:

      enum tonsOfStatusCodes{PASS=0,FAIL,CUSTOM,foo, bar,baz};
      tonsOfStatusCodes status = FAIL;
      do{
      status=customMalloc(ptr);
      if(status){break;}
      status=populateData(ptr);
      if(status){break;}
      status=transmogrifyData(ptr); ...
      }while(0);

      so at the end of this you either passed everything or you know where you borked.
      Are there better ways? yes.
      Does this work in a very compatible way? yes.
      Is it broken? no.
      Shall I then fix it? no.

      Every time I see an ask /. about "I hate my job" or "My job is asking foo of me but my job is bar", I count my lucky stars that my job is sane, well defined, challenging, and the worst of it is a couple (hundred) thousand lines of code that contain some dailywtf worthy examples.
      -nB

      --
      whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
  8. Re:This just confirms it by CadentOrange · · Score: 2

    The opposite could be the case, someone might be using goto not knowing it's considered bad and learn that it is from this achievement.

    You'd have to be living under a rock to *not* know that GOTOs are considered bad.

  9. Resume builder? by ashmon · · Score: 5, Funny

    So, is this going to be a good thing to put on your resume?

    * Stay focused and attentive to work.
    * Hard worker
    * Level 32 Visual Studio Achievements
    * Stays on task

    Uhhhh...

  10. Obvious isn't it? by Viol8 · · Score: 5, Funny

    Huge hideous bugs!

  11. Possible badges for good code by tucuxi · · Score: 4, Interesting

    I for one would find these badges nice:

    • compiled without warnings (cumulative for "N times in a row")
    • doxygen-compliant comment coverage (percentage-wise cumulative)
    • safe programming practices (always compares constant == lvalue, initializes all values, ...)

    On the other hand, IDEs like Netbeans and Eclipse are getting better and better at nagging users about such issues (and auto-generating code to fix many of them). Do we really need the badges?

    1. Re:Possible badges for good code by greg1104 · · Score: 3, Funny

      Do we really need the badges?

      We don't need no stinkin' badges!. Or badgers.

    2. Re:Possible badges for good code by anonymov · · Score: 3, Interesting

      if(x = 1) // Valid in many languages and most probably not what you want. Compile warning in some compilers
      if(1 = x) // Doesn't compile

  12. Re:This just confirms it by elsurexiste · · Score: 3, Funny

    The achievement for using goto is "Go To Hell". How is that encouraging, I have no idea :) . In fact, most of those achievements are just a funny take on amateur programmers. Just take a look at the list:

    • Interrupting Cow (Have 10 breakpoints in a file.Where's that bug? Could here, could be there, could be anywhere! - 5 points)
    • Stubby (Generate method stubs 9 times. You're a TDD bad ass! - 5 points)
    • Save A Tree (Print source code. My boss told me to. I swear! - 5 points)
    --
    I rarely respond to comments. Also, don't ask for clarifications: a brain and Google are faster, believe me!
  13. FUN! With programming and Achievements!?!? by Etrahkad · · Score: 3, Interesting

    WTF is my first reaction. Second reaction is that that would have been awesome to work on the team that built that in because it shows that they have a bit more freedom with what goes in a program like Visual Studio. This sounds like a progressive step forward in the engineering team @ Microsoft. I can't give them kudos for this _exact_ application of listening to programmers but the idea that people are allowing for ownership and creativity is gratifying to see in a development firm. Its something different than the boring troll of debugging the application, fixing build errors, and building more.

  14. Gotta get 'em all by Lunaritian · · Score: 4, Insightful

    There are many players who simply have to collect every single achievement. Considering what these achievements are like (use 20 single-letter variables, write a 300-character line etc.) I hope their behavior won't carry over to programming...

  15. Only 5 curses in one file? by Coisiche · · Score: 4, Funny

    Clearly my code commenting technique is slightly different from the norm.

    1. Re:Only 5 curses in one file? by Coisiche · · Score: 2

      I live in Scotland.

      No further qualification necessary.

  16. Re:"Gamification" doesn't make dull things a game. by X0563511 · · Score: 2, Insightful

    "achievements" ruin everything - games included.

    --
    For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  17. Re:seriously — they're totally missing the p by virgnarus · · Score: 5, Insightful

    There are plenty of individuals out there - including myself - that would go in a frenzy and would attempt to earn all the achievements, regardless if they're bad or not.

  18. man, not vendor by mapkinase · · Score: 4, Insightful

    Achievements should be defined by management, not the software vendor.

    --
    I do not believe in karma. "Funny"=-6. Do good and forbid evil. Yours, Oft-Offtopic Flamebaiting Troll.
  19. Next on the list: by ledow · · Score: 2

    Taking inspiration from Dungeons of Dredmor (with NH homage, I believe):

    Suddenly the Dungeon Collapses

    Achieved when you manage to crash the program.

  20. WTF? by gstoddart · · Score: 5, Insightful

    Why would I want my dev environment to have leaderboards and be "gamified"?

    I'm glad it's only a plugin, but to me this is part of the annoying trend that everything we do needs to be tied into social media ... I mean, "they can also brag about their achievements on Facebook and Twitter". Why on earth does everything we do nowadays need to be tied into Facebook and Twitter?

    I'm waiting for the first wave of toilets with integration to those sites ... then we will truly widespread "Twitter Shitters" and other bits of stupidity.

    Then again, maybe I'm just old and uncool, and all of the cool kids are doing this ... but to me this just sounds like something which is utterly pointless.

    --
    Lost at C:>. Found at C.
  21. I've been trying to recover from decades of hating by Nelson · · Score: 4, Insightful

    Seriously, I have been trying to get over the MS hate that I've had since Windows 3. They're just another big company, trying to do what they can and at least they try to compete in new markets even though they routinely get shelled by the competition when they stray off the desktop.

    But WTF?!?. Badges in Visual Studio? For real? They have no idea what they are doing. Are they chasing 15 year old developers to be? This is a company with 10s of billions in cash that can subsidize products like Xbox for years and years. This is fucking Bob in the IDE.

  22. Maybe the real reason.... by Dcnjoe60 · · Score: 4, Funny

    Maybe the real reason for the badges and leaderboards is so inept managers who know more about marketing than programming have some way to evaluate what the programmers are doing.

  23. Re:I've been trying to recover from decades of hat by Olix · · Score: 3, Interesting

    I'm 22 and I think this sounds pretty cool. I'm already addicted to achievements in videogames, why not be addicted to achievements in programming, too?

    It's like the drug dealers who gave out free samples of crack with the heroin they sold.

  24. Good by geekoid · · Score: 2

    I can't wait for achievement to be everywhere. I think they me the best way to get a populous to achieve an over all, non critical goal.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  25. How about the other way around? by alexo · · Score: 2

    When will Visual Studio achieve the "supports the C++11 standard" badge?

  26. Gamification instead of taxes by MobyDisk · · Score: 2

    What if we had government gamification instead of taxes? Instead of taxing cigarettes, let's have an achievement for not smoking. Or achievements for eating healthy foods. Achievements would earn you points toward social security. Companies could offer achievements toward pensions and retirement. Maybe instead of a military, we could have achievements for killing enemy soldiers. Oooh, I see the makings of a dystopian novel coming on!

    1. Re:Gamification instead of taxes by sandytaru · · Score: 2

      Weight Watchers actually has that, sort of. Every five pounds you lose gives you another star. After you reach your ten percent goal, they give you a keychain to hold charms, which include achievements such as "Ran a 5K" and little weights that represent the pounds you've shed. The most coveted one, of course, is the Lifetime Member, which means you've lost enough weight to reach your goal and you don't have to pay them money to play the game any more.

      --
      Occasionally living proof of the Ballmer peak.
  27. Re:What real men use.. by geekoid · · Score: 3, Insightful

    Smart men use the tool that makes the job the easiest.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  28. Re:I've been trying to recover from decades of hat by geekoid · · Score: 4, Interesting

    I'm many decades past 15 and this looks awesome.

    If you stopped and looked around for moment instead of assume you know what's going on you would realize how powerful achievements are. There are many, many good outcomes to this. The biggest will be more knowledgeable and experience developers.

    You can't have been around that long if you think this is MS Bob.
    That said, MSBob had a great start, but someone future wife was put in charge and basically managed it to shit.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  29. Re:War Games: "The only way to win...." by geekoid · · Score: 2

    Achiements will be in every job in a decade.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  30. Re:"Gamification" doesn't make dull things a game. by Lumpy · · Score: 2

    Load up the linux kernel source code. you will get the "riddled with filth" achievement.

    --
    Do not look at laser with remaining good eye.
  31. good only for learing/discovering IDE features by PJ6 · · Score: 2

    Meaningful coding achievements need to be task-oriented.

    But this is a good idea for making sure you're familiar with all the features the IDE offers. Done right, with interactive walkthroughs and whatnot, achievements could serve as an excellent supplement to documentation.

  32. Re:"Gamification" doesn't make dull things a game. by pjt33 · · Score: 2

    I think 5 curses in a file indicates bad design. If you need more than one library for handling your TUI you're clearing Doing It Wrong.

  33. Declare the variable where it is initialized by tepples · · Score: 2

    You could put the variable declaration outside the block assigned to null and then test if the value is null inside the finally

    Which would violate the commonly quoted best practice to make each variable's scope no longer than needed. That is, don't initialize the variable to null when you declare it and overwrite the null value later; instead, declare the variable where it is initialized for real.

    maybe it's time to think about decomposing the code into more manageable chunks

    Until the overhead of packing an inner chunk's return values into a return value object, passing it back to the caller, and unpacking them in the caller becomes measurable in the profile.

    1. Re:Declare the variable where it is initialized by DrXym · · Score: 2

      Best practice in Java is to immediately close streams when they are no longer used and the best way to do that is from a finally block. And the only way the finally block can see the variable is if it resides in the scope of the parent block or above. So it doesn't violate anything. The first response to this stackoverflow question demonstrates the typical way to do this. You will note that fis is set to null as I said and tested for null in the finally.

  34. Achievemnt Unlocked! Use a C99 Compliant Compiler by VortexCortex · · Score: 3, Insightful

    If only they'd put THAT in the damn compiler I MIGHT consider using it.

  35. Re:I've been trying to recover from decades of hat by Simulant · · Score: 2

    "I'm already addicted to achievements in videogames"

    You are being played.