Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming Microsoft

Visual Studio Gets Achievements, Badges, Leaderboards 353

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."
This discussion has been archived. No new comments can be posted.

Visual Studio Gets Achievements, Badges, Leaderboards

Comments Filter:
  • by elrous0 ( 869638 ) * on Thursday January 19, 2012 @09:30AM (#38747538)

    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.

    • by The MAZZTer ( 911996 ) <megazzt@nospAm.gmail.com> on Thursday January 19, 2012 @09:32AM (#38747556) Homepage
      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.
      • by Twylite ( 234238 ) <twylite@@@crypt...co...za> on Thursday January 19, 2012 @10:34AM (#38748222) Homepage

        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.

        • by Karrde712 ( 125745 ) on Thursday January 19, 2012 @11:04AM (#38748576)

          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.

      • by TheLink ( 130905 ) on Thursday January 19, 2012 @12:08PM (#38749406) Journal

        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...

    • by Robadob ( 1800074 ) on Thursday January 19, 2012 @09:33AM (#38747566)

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

    • by piripiri ( 1476949 ) on Thursday January 19, 2012 @09:34AM (#38747576) Journal
      Maybe you shouldn't nest these control structures like this... Flat programming, rings a bell?

      Oblig. KXCD [xkcd.com]
      • by Viol8 ( 599362 )

        Maybe you should try writing a serious program without nested control structures then and show us how it should be done or are you going to suggest just making endless function calls so the code is unintelligable and the cost of push and popping on the stack becomes huge?

        • 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.
          • 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).

    • Re: (Score:2, Informative)

      by Anonymous Coward

      What's your problem? Java supports loop labels [wikipedia.org].

    • 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. ;-)

    • by Anonymous Coward on Thursday January 19, 2012 @09:52AM (#38747798)

      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]

      • that might be true today, the the 'goto considered evil' has been around for a lot longer than CPUs with L2 cache.

        The problem was that it used to be used for program flow like it was an while statement. That led to some pretty convoluted and impossible to understand code, and we won't even go into jumping to other function code.

        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 t

        • by Grishnakh ( 216268 ) on Thursday January 19, 2012 @03:46PM (#38752682)

          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.

      • by Twylite ( 234238 ) <twylite@@@crypt...co...za> on Thursday January 19, 2012 @11:21AM (#38748812) Homepage

        [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 [wikipedia.org] 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 [utexas.edu] 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 [snu.ac.kr], 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".

    • by jps25 ( 1286898 ) on Thursday January 19, 2012 @10:01AM (#38747886)

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

      • by swillden ( 191260 ) <shawn-ds@willden.org> on Thursday January 19, 2012 @10:07AM (#38747952) Journal

        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.

        • 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.

      • Is it written entirely in ASM?

    • by dkf ( 304284 )

      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 inte

    • Not a Java developer, but a quick search for "java break statement" shows you can set labels in your code and then specify them when you break.
    • That's why the use of the GOTO statement is accepted by the Linux kernel coding style [kernel.org] (Chapter 7: Centralized exiting of functions).
      • by ifrag ( 984323 )

        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.

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

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

      RS

      • by gstoddart ( 321705 ) on Thursday January 19, 2012 @10:44AM (#38748338) Homepage

        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.

        • 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.

        • by Tom ( 822 )

          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

    • goto is not evil - it's just hidden inside modern languages. Every switch statement is really a goto, with the case: being a label (target). Anyone who's ever programmed in assembler knows that jmp is not evil.

      Does goto: lead to spaghetti code? That's up to the programmer - not the language feature. You want to see REAL spaghetti code? Look at some of the horrors coming out of Java.

      • by Rary ( 566291 ) on Thursday January 19, 2012 @11:45AM (#38749084)

        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.

    • 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 stru

    • 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 t

    • by alexo ( 9335 )

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

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

  • by Anonymous Coward

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

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

    • Re: (Score:2, Funny)

      by Anonymous Coward

      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.

      • by Lumpy ( 12016 )

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

      • by pjt33 ( 739471 )

        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.

    • Re: (Score:3, Insightful)

      by X0563511 ( 793323 )

      "achievements" ruin everything - games included.

  • Good idea (Score:3, Interesting)

    by XrayJunkie ( 2437814 ) on Thursday January 19, 2012 @09:48AM (#38747734)
    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.
    • by Speare ( 84249 )

      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.

    • This wont result in bad code.

      I'm guessing you didn't look at the list of achievements, particularly the "Don't Try This at Home" section. It has achievements for writing a 300 character-long line of code, or for having a method with 10 overloads.

  • Do While (Score:4, Funny)

    by QBasicer ( 781745 ) on Thursday January 19, 2012 @09:49AM (#38747752) Homepage Journal
    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.
    • 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

  • by ashmon ( 592459 ) on Thursday January 19, 2012 @09:57AM (#38747846)

    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...

  • by tucuxi ( 1146347 ) on Thursday January 19, 2012 @10:00AM (#38747880)

    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?

  • This makes me so very glad I didn't go into this field for a profession.

  • for writing my first 1000 lines of code!

  • by Etrahkad ( 1399575 ) on Thursday January 19, 2012 @10:02AM (#38747904)
    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.
  • Gotta get 'em all (Score:5, Insightful)

    by Lunaritian ( 2018246 ) * on Thursday January 19, 2012 @10:02AM (#38747912)

    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...

  • We don't need no stinking badges!

    Somebody had to say it.
  • by Coisiche ( 2000870 ) on Thursday January 19, 2012 @10:05AM (#38747938)

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

  • man, not vendor (Score:5, Insightful)

    by mapkinase ( 958129 ) on Thursday January 19, 2012 @10:11AM (#38747988) Homepage Journal

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

  • by ledow ( 319597 ) on Thursday January 19, 2012 @10:13AM (#38748014) Homepage

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

    Suddenly the Dungeon Collapses

    Achieved when you manage to crash the program.

  • WTF? (Score:5, Insightful)

    by gstoddart ( 321705 ) on Thursday January 19, 2012 @10:13AM (#38748022) Homepage

    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.

  • by Nelson ( 1275 ) on Thursday January 19, 2012 @10:26AM (#38748130)

    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.

  • This joke ridiculing a trend was turned into real thing ridiculing a trend, so it is evidence of a trend!

  • by Dcnjoe60 ( 682885 ) on Thursday January 19, 2012 @10:35AM (#38748234)

    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.

  • by geekoid ( 135745 ) <dadinportland.yahoo@com> on Thursday January 19, 2012 @11:02AM (#38748556) Homepage Journal

    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.

  • by alexo ( 9335 ) on Thursday January 19, 2012 @11:06AM (#38748608) Journal

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

  • by MobyDisk ( 75490 ) on Thursday January 19, 2012 @11:10AM (#38748668) Homepage

    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!

    • 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.
  • by PJ6 ( 1151747 ) on Thursday January 19, 2012 @11:35AM (#38748950)
    Meaningful coding achievements need to be task-oriented [projecteuler.net].

    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.
  • If only they'd put THAT in the damn compiler I MIGHT consider using it.

Statistics are no substitute for judgement. -- Henry Clay

Working...