Slashdot Mirror


'CodeSpells' Video Game Teaches Children Java Programming

CyberSlugGump writes "Computer scientists at UC San Diego have developed a 3D first-person video game designed to teach young students Java programming. In CodeSpells, a wizard must help a land of gnomes by writing spells in Java. Simple quests teach main Java components such as conditional and loop statements. Research presented March 8 at the 2013 SIGCSE Technical Symposium indicate that a test group of 40 girls aged 10-12 mastered many programming concepts in just one hour of playing."

21 of 245 comments (clear)

  1. not a complete success by Anonymous Coward · · Score: 4, Funny

    38 of the 40 girls in the test group complained that, once they were written in Java, the spells took forever to execute.

    1. Re:not a complete success by Anonymous Coward · · Score: 4, Informative

      Your joke was funny 15 years ago when Java was actually slow.

    2. Re:not a complete success by mark-t · · Score: 3, Insightful

      I've seen java programs actually run *faster* than native code under certain circumstances. In particular, object allocation with the 'new' keyword in Java is often far faster than dynamic allocation with the 'new' keyword in C++, even when you factor in the costs of garbage collection compared to manually invoking delete in C++.

    3. Re:not a complete success by Anonymous Coward · · Score: 3, Interesting

      I really can't tell if you're trolling. If you're not trolling then you should know that the reason heap allocation is faster in Java is because Java allocates a sizeable chunk of the systems memory on runtime startup to use as a pool allocator. In C++ you're expected to come up with your own allocation strategies because you know more than the compiler about what the high level behavior should be. What you were actually benchmarking was the overhead of the system calls/context switches that come with operator new versus just grabbing the next page in a pool. If you were to use a simple pool allocator in C++ as well, it would smoke Java as expected.

      Incidentally, this is the reason I started blacklisting the Java runtime on my machines: it used to render one of my older systems unusable because it would allocate a significant fraction of system memory if it was allowed to come up. Because it was a low-memory machine, occupying such a huge chunk of memory made it extremely easy to cause the machine to thrash if anything else were to run as well.

    4. Re:not a complete success by Kagato · · Score: 4, Interesting

      Yeah, that's fairly outdated thinking. Speed isn't derived by the language anymore. It's the execution that counts. Java Compiles down to op-code, which is run in the JVM. The JVM has decades worth of run-time optimizations. The majority of large scale web sites are written in Java.

      Hey, ever heard of Hadoop. You know the large scale Map-reduce framework based on Google's technology that sorts terabyte and petabyte of data? Java.

    5. Re:not a complete success by b4dc0d3r · · Score: 3, Interesting

      When Java first took off, and the web was made of Java content executed via plugin, Java was written by idiots who concatenated strings instead of using string builders, and similar abuses of common sense through ignorance and teaching materials that focused on results rather than good practice. Executables outside of plugins suffered the same deficiencies, although they were probably attempting loftier goals, and the performance was... what is the opposite of magnified, because it was slower than a sloth taking a crap?

      This lasted a number of years, even as the Java interpreter became stable and work was made to increase its performance. Idiot coders learned or abandoned Java, and the runtime made even the remaining idiots look better, if not "good".

      If you don't find this comment amusing, you either lack historical perspective, are a Java programmer, or should consult a medical professional to be diagnosed for your deficiency in some manner or other.

      Security problems these days seem to be focused on the browser plugin, rather than locally executing native apps, so the security comments mostly don't apply. Visiting a random internet web page and allowing it to execute poorly sand-boxed arbitrary code is a bit like licking random strangers' genitals. In case that interests you, let me state that it should not be done as a general practice, and you should consult a medical professional.

      I have read Java for over a decade, and I have coded in Java for 3 years or so. Having experience with x86 ASM (AT&T and MASM), K&R C, ANSI C, GWBasic, Turbo Pascal, C++ (VC 5-2010, gcc 2.x - 3.x, mingw), VB 5-6, C#, VB.NET, Python, Powershell, JavaScript (advanced, not your normal getElementById().Blink() shit) and several other introductions, I can say this:

      Java examples in the real world and in most printed books are the most incestuous, groupthink-y, overly-architected piles of verbosity I have ever had the displeasure to read. I completely understand the need for default parameters, dependency injection, constructor and method chaining, and all kinds of modern best practice.

      But I have never seen another language embrace the overbearance of best practice teachings without implementing some balance of solution soundness. Java examples and implementations (open source of course, because I have read them) seem to abound with overloaded methods under 5 lines of code, which initialize another parameter to call another overload. Now you have multiple functions to unit test, multiple code paths, multiple exception sources, and unless you are brainwashed in the spirit of Java, comprehension of the complete workings are complicated by scrolling off-screen with essentially purpose-free function declarations, whitespace between functions, and an essentially functional programming paradigm split over several different methods to give the appearance of flexibility, OOP, and conscious design.

      It reads to me like someone wrote that no method should ever take more than one additional parameter that you were not already given, and coherence be damned. I would much rather see a single method with 5 non-optional parameters than 5 overloads which calculate and pass one new parameter each time.

      The Java paradigm seems to be calculating things within the overloaded methods is preferable to factoring out these into unrelated functions. In a truly sane, OOP world, those calculations would be a part of the object, or if sufficiently general would be part of the object's base object.

      In fact, the Java approach seems to be the Builder design pattern, which I have not seen adopted as frequently as it should be. Obligatory link here.

      As sensible as the Builder pattern seems to be, I think it would still require a number of extra Set/Get property methods, which are function calls. Maybe Java has optimized this, but if you don't adopt it optimization can't he

  2. had a similar idea some time ago. by wierd_w · · Score: 4, Interesting

    I had a similar idea some time ago, but with an MMORPG setting.

    One of the issues that has always rankled me hard was the "cookie cutter" nature of the world events in those games, as well as the limiting gameplay options, so I had this idea for "obfuscated and sigilized" programming syntax as the basis for a game's magic system. Rather than presenting a loop as a nested block of instructions, it would depict it as a "container", with subcomponents inside. Kind of a mix of flowcharting and stylized syntax.

    The idea was that the layout of the "enchantment" could be moved and teased to make clever images out of the interconnected containers and symbolic representations, to make the programmatical nature of the system less banal, and much more aesthetically attractive, while simultanously making the kinds of magic and counter magic highly diverse and dynamic.

    I never really did much with the idea (ideas aren't worth much, despite what the USPTO and several shell corps may claim. Implementations are far more valuable.), and all the "on paper" mental models I tried kept having non-trivial problems.

    I like seeing that somebody had a similar idea, and made a working implementation.

    1. Re:had a similar idea some time ago. by exploder · · Score: 3, Funny

      Battlegrounds in World of Warcraft were kind of awesome back before they (quite correctly, I guess) put all sorts of restrictions on what kinds of things could be scripted. I used to *own* the level-19 battlegrounds with a warlock and an addon I wrote to keep track of enemy targets and optimally distribute my various curses and afflictions. I just ran around mashing the spacebar like crazy, because among the few restrictions was that every action had to be tied to a hardware event.

      I also earned 10,000 gold in the auction house with another addon of mine that helped me find and relist underpriced stuff. At that time, 10K gold was an eye-wateringly large sum. It's probably pocket change now...I've been out five years.

      Man, I really did feel like a wizard with arcane and hidden knowledge. It was great. I've often wished for a game where programming was the way you do magic, but only that once have I gotten it. I guess a key part of the experience was that hardly anyone else could do it, or knew how I was doing it, which is how magic is often imagined to be.

      --
      Yo dawg, I heard you like the Ackermann function, so OH GOD OH GOD OH GOD
  3. Re:The spell book looks INCREDIBLE: by Fluffeh · · Score: 4, Insightful

    The entire game looks pretty basic - and who the heck cares? Watch a two year old and see what happens when you give em a present. They are as likely to play in the big box as with the toy.

    Graphics might be important for the latest 3D shooter, but a good game doesn't HAVE to have cutting edge graphics. A game with amazing graphics can still be crap.

    If the idea is to teach kids how to code, and they enjoy playing the game enough to at least learn a little coding - then it is a GREAT product. If I was ten and wanted to learn java and had a choice of following tutorials/reading books/etc or playing a game that taught me the concepts, then I certainly know how I would have learned java. Sure, all my projectst might also include a random "Save the GNOMES!!" routine, but you know..

    --
    Moved to http://soylentnews.org/. You are invited to join us too!
  4. Re:How about Python or something? by Anonymous Coward · · Score: 3, Insightful

    Pointers really are complicated for anyone IQ 110 or below. Most people who attempt CS weed out classes are above average, but half struggle with pointers.

  5. Re:Doomed by Anonymous Coward · · Score: 3, Funny

    That's why Java has builtin garbage collection, DUH!

  6. Re:Let me read that again by Anonymous Coward · · Score: 5, Insightful

    Yeah, you go ahead and explain loops and conditional statements to 40 10-year-olds. They'll learn it in 5, master it in 10, forget all about it in 15. They'll probably be bored, too.

    Or you can use a software like this which will engage them, encourage them, and help them remember it when they go home that night. It sure would be a shame if they were excited to learn more the next day and had a platform that was there to teach them and give you time to grade their math tests.

  7. Re:How about Python or something? by xero314 · · Score: 3, Insightful

    Gee, when you talk to people that never learned programming they know nothing about programming. If you are having trouble explaining it then the problem might not be on their side.

  8. Re:How about Python or something? by jrumney · · Score: 3, Insightful

    Also, C is easier than Java.

    Perhaps to someone who has been trained in C but not Java. The biggest problems with C when compared against Java is the limited extent of its standard library, sorting through the plethora of poorly documented non-standard libraries that are available (vs Java, where if there isn't a standard for it, then the next obvious stop is apache.org) and the fact that you need to understand the hardware architecture of the system you are developing for in a lot of cases, as well as distinctions between stack and heap and a bunch of low level gotchas in the language that are far from obvious to the newbie, or even to experienced developers sometimes.

  9. Re:Let me read that again by qwak23 · · Score: 3, Interesting

    I wish I had mod points right now.

    One of the best things I ever had as a kid was a TRS-80 (CoCo - and not a true TRS-80 either, even though that was stamped on it) that booted to a BASIC interpreter. The code for any games I loaded directly off disk could be tinkered with easily, no need to compile. This was awesome as a curious 5 year old.

    Even better about it were the games "Rocky's Boots" and "Robot Odyssey". These games taught me the basics of digital electronics, lessons which have actually helped in my current career as a technician (with no formal training in digital logic). Seeing this kind of software being produced in a modern setting is awesome, I wish there was more of it.

  10. Re: How about Python or something? by Anonymous Coward · · Score: 5, Informative

    The reason that Java isn't as fun to program is the same reason that it's good for businesses. The language is very restrictive and prescriptive of how you should do things. For programmers that want flexibility and power, the constraints and extra typing (dual-meaning intended) chafe. But when you're using it as part of a large group, those same constraints become the things you can depend on. Where is a certain class located? Java requires it to be in a certain directory. What methods are available on a class? Java's static type system was designed to make tooling easy, so your IDE will tell you. And even talented programmers can mess up manual memory management...the less-talented wouldn't stand a chance without Java's memory management. The list of things that Java prevents you from screwing up is quite long.

    Basically, for my home coding projects and projects where I work with a small team of talented developers, Java is one of my last choices. But for my boring 9-5 job where I'm working with 30 knuckle-draggers who don't understand the purpose of an interface, let alone how to write functional code that's easy to read, I want them writing Java and I'm willing to pay the Java price to get that.

  11. Re:How about Python or something? by Samantha+Wright · · Score: 3, Interesting

    Irony of ironies, C# is almost exactly like Java at the language level, only with a totally different object hierarchy, which is why it's easier for UI development. The .NET hierarchy is somewhat influenced by classic VB, which was a very well-developed and efficient (if sometimes limiting) format for expressing common UI needs.

    Java's popularity, sadly, has to do exactly with that OOP evangelism. In the late eighties and early nineties, academic software engineers were absolutely convinced OOP was the silver-bullet software development paradigm for all ills, since encapsulation (hiding methods) made code re-use practical. They also believed it was the end to all programming practices that inhibited re-use, particularly global variables. Unfortunately they made the mistake of conflating these practices with "laziness," and very mistakenly believed in a bizarrely Victorian fashion that all beginners should be forced to use only best practices, as though we should be teaching infants proper manners straight out of the crib.

    It's stupid enough that I sometimes wonder if it was a massive conspiracy by Sun's marketing department, but to be honest computing has always been full of fads like this. In the early eighties, logic programming was The Way Of The Future; everyone thought that Prolog and constraint-satisfaction-based expert systems (basically, fancy predicate logic expression solvers) would dominate computing for the rest of time. Today, there are only a few niches where new Prolog code is considered desirable.

    --
    Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
  12. Re: How about Python or something? by phantomfive · · Score: 3

    In other words, "Java is for other people." I feel the same way: I used to hate Java, but now I respect it for the reasons you just described.

    --
    "First they came for the slanderers and i said nothing."
  13. Re:How about Python or something? by qwak23 · · Score: 4, Insightful

    At the elementary level I don't think the choice of language with reference to the business environment is that important. Teaching kids that they can make their computer/tablet/whatever DO STUFF and presenting it in an easy to digest format is much more valuable that what is big in the industry now. Keep in mind, elementary age... at least 20 years (on average) until they start rolling to the job market. Not all of them will be programmers. The languages we use now may be dying by that point. they may not all be programmers, some may be scientists using more focused languages in the vein of Matlab, some may be homemakers, some may be athletes, some may be artists. But they will all have an appreciation for technology and what it can do. They will all get introduced to logic and algorithmic structure at a much earlier age than is normal right now. Those things easily apply to other aspects of life. Hell, if they keep at programming strictly on a hobby basis, they may even catch on to when the developers at their company/organization/whatever are BS'ing them about what can and cannot be accomplished.

  14. Lua with Minecraft + Tekkit mod by uberbrainchild · · Score: 3, Informative

    Try tekkit for minecraft, it will give you a mod called computercraft which will allow you to place computers with consoles on the map and even hook up wireless modems and a disk drive to them. Using lua you can then program these computers to do whatever you want basically, me and my brother made 3 train stations which would handle carts and track switches with the computers. You can even program "bots" with lua and have them build structures and whatnot. They can even defend your area if you want. All this is done with lua inside the minecraft game. You can of course import larger scripts from outside the game since typing them in the console minecraft provides can take a while.

    --
    Anveto
  15. I feel... by HaZardman27 · · Score: 3, Funny

    I feel like my signature is very relevant today.

    --
    Apparently wizard is not a legitimate career path, so I chose programmer instead.