Slashdot Mirror


Good Language Choice For School Programming Test?

An anonymous reader writes "The Australian Informatics Olympiad programming test is being run in a couple of months. I'm an experienced programmer and I'm thinking of volunteering to tutor interested kids at my children's school to get them ready. There will be children of all levels in the group, from those that can't write 'hello world' in any language, to somewhat experienced programmers. For those starting from scratch, I'm wondering what language to teach them to code in. Accepted languages are C, C++, Pascal, Java, PHP, Python and Visual Basic. I'm leaning towards Python, because it is a powerful language with a simple syntax. However, the test has a run-time CPU seconds limit, so using an interpreted language like Python could put the students at a disadvantage compared to using C. Is it better to teach them something in 2 months that they're likely to be able to code in but possibly run foul of the CPU time limit, or struggle to teach them to code in a more complicated syntax like C/C++ which would however give them the best chance of having a fast solution?"

7 of 407 comments (clear)

  1. I'm guessing the CPU limits are generous. by Jason+Pollock · · Score: 5, Insightful

    I'm guessing that the CPU limits are generous and are more about filtering out bad algorithms than bad languages.

    For example, someone using stooge sort instead of quicksort...

    While the language used would increase the budget, the algorithms used will very quickly swamp any language gains.

    When I did programming contests, they were more bound on thought (how quickly you can come up with an algorithm) and then implementation time. Rarely did compute time come into it.

  2. Language shouldn't push you past the limit by EEBaum · · Score: 5, Interesting

    Having competed in a handful of collegiate programming contests about 10 years ago, the CPU time limit was never even a passing concern. Granted, we were coding in C++, but even in Python, any solution that hits the CPU limit on these contests is quite likely an unnecessarily complex algorithm. I always considered the CPU limit to be a safeguard against programs with infinite loops or REALLY slow solutions, so that the teams wouldn't claim "no, really, it works!" and drag the contest on for hours insisting that the right answer will reveal itself shortly. If your solution works, but has complexity of O(n!), I'd have a hard time calling it acceptable.

    If one of our entries was rejected due to exceeding the CPU limit, it was always due to a problem in our logic that the sample data hadn't triggered, but that the actual test data had.

    --
    -- I prefer the term "karma escort."
  3. Go With Your Gut by Bob(TM) · · Score: 5, Insightful

    Unless these kids already have a programming proficiency, go with your gut.

    The exercise is as much about allowing them to test the programming waters as it is about them winning. If you are starting with a blank slate, that means you need to create an environment that is intriguing. If YOU think Python is the thing, you'll be passionate ... and that is a lot of what makes a good coach/tutor in an olympiad.

    Further, I think you could do a lot worse than Python. It is really a great language and is popping up in a lot of disciplines as the scripting tool of choice. It will perform well and has great characteristics that make it well suited for someone learning the ropes. Plus, the language is modern enough to be relevant should they desire to pursue IT further.

    I would stay away from C/C++. In the hands of novices in a timed activity, I would wager it would be more trouble than it's worth.

    --

    The little guy just ain't getting it, is he?
  4. surely not; Pascal was meant for this by r00t · · Score: 5, Insightful

    We can sort of classify the languages into "slow" and "not slow" in various ways.

    • Learning: Pascal is fast. C++ is horribly slow. The rest are moderate.
    • Compiling: While it can't beat "no compile", Pascal is shockingly fast for people used to something like C or Java. C++ is horribly slow.
    • Start-up: Pascal again does fine. Here it's joined by C and C++. The interpreted stuff is typicallly an embarassment.
    • Run-time: Pascal again does fine. Here it's joined by C. C++ can be fast if you treat it like C or if you're a God-like expert in compiler/library details that normal mortals don't understand. The interpreted stuff is typically an embarassment.

    This should come as no surprise. Pascal was intended as a teaching language. None of the other languages was designed for teaching, unless you somehow equate Visual Basic with BASIC.

    The second choice is probably C, but you'll have some issues teaching about declarations/definitions (inside out) and string-related stuff. The meaning of '=' is also not compatible with normal math notation.

    The third choice is probably Java. You get most of the trouble of C, less speed, and greater need for boilerplate sourcecode bloat.

    1. Re:surely not; Pascal was meant for this by cibyr · · Score: 5, Informative

      Oh come on, Python was designed as a teaching language and in my experience students find it much easier to learn than Pascal (and it's much less limiting once you get past the basics).

      As far as speed is concerned, according to the Programming Language Game Pascal is at best 60x faster than Python, and these sorts of competitions usually give you a few orders of magnitude in margin - the idea is to make sure your solution is in the right complexity class, not to try and enforce the most efficient possible solution.

      --
      It's not exactly rocket surgery.
  5. Re:Faster than you think by Larryish · · Score: 5, Funny

    LOLCODE would be easiest to learn for the cellphone-texting rugrats of today.

    Example of Hello World program:

    HAI
    CAN HAS STDIO?
    VISIBLE "HAI WORLD!"
    KTHXBYE

  6. Re:Frameworks are more important than language by cbhacking · · Score: 5, Insightful

    Python, Java, and VB (one must assume it's VB.NET, and thus has the same libraries as C#) are definitely what I would suggest on the basis of libraries. OK, you can do C++ with the CLR and CLR libraries, but C++ is *not* a good choice for a first language.

    There's a lot of hate on /. for VB, perhaps because not many Slashdotters have tried any version of the language from the last 8 years, but it *is* a good first language - static and strong typing (by default now, I believe), either procedural or OOP (full support for inheritance, unlike legacy VB), BASIC-style syntax (intuitive and quick to pick up), fully memory managed (real GC, not just ref-counting), structured exception handling (no, it's not On Error Goto anymore), and all the .NET/Mono libraries available (before you ask, yes Mono has a VB compiler/runtime, and once you compile it all down to CIL the libraries are usable by any language).

    Java has about half those advantages plus a lot of silly restrictions (although at least Scanner makes getting keyboard input a lot less retarded than it used to be), but it's still a popular choice for learning a first language, and a practical choice for those who want to make a career of programming (though they should learn multiple languages anyhow). Python is a better choice, and possibly quicker to learn, although I'm not a fan of dynamically typed languages with significant whitespace.

    --
    There's no place I could be, since I've found Serenity...