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?"

4 of 407 comments (clear)

  1. Re:There's C then there's C written by newbies by betterunixthanunix · · Score: 4, Informative

    That is not universally true, at least not in the college level contests I participated in as an undergrad. They used to test with very large inputs, to deliberately throw off solutions that leaked memory (they set a ulimit before running the code) or inefficient solutions (except in cases where they gave us NP complete problems)...

    --
    Palm trees and 8
  2. Re:Faster than you think by WrongSizeGlass · · Score: 4, Informative

    I think you should pick something that would be the easiest for them to learn. Python is probably the best choice out of those languages (I'm not a Python programer and my exposure to Python has been limited - though I do code in C/C++, PHP & VB and I've coded and taught Java & PASCAL).

    You can't really worry about the runtime limit since it should be rather liberal for a student's competition and you'll never know what the system's config will be (so Python may be fast or slow).

    If you're going to be teaching new programmers, get them started on something they can use and something they can expand upon. Of the languages available to you I would say Python is the best choice.

  3. 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.
  4. Re:surely not; Pascal was meant for this by Glonoinha · · Score: 4, Informative

    I took a few minutes to RTFA and the software equivalent of scholastic olympics today are pretty much the same as they were in 1984 when my team took second place at the state level. It is a medium low level software engineering test demonstrated via a few medium low level implementations.

    They are looking for two things:
    Can you read the requirements and come up with an appropriate algorithm?
    Can you implement the algorithm in their favorite language (pretty much any language in common use)?

    The CPU time limit is to keep people from using bogo-sort (ie, randomize the data and then check if it is sorted, repeat until it's actually sorted.) If the students understand how to break a problem down and implement it using a standard approach, they will beat the CPU time limit. Even if they use bubble sort.

    The real thing they are up against is the design and implementation time limit - I'm guessing they have three or four problems and four hours per team. The libraries they are allowed to use are basically nonexistent, meaning they software they are expected to write is going to be a software implementation of some algorithm, and they aren't going to be able to Google for syntax assistance so they need to be fluent in their language. They will have access to hardcopy manuals and manuals in electronic format, but that will just slow them down.

    Given the limit on imported packages and code complexity (not to mention source code size - no more than 40,000 characters (which is ultra-overkill - it would take a week to hand write 40k worth of source code for an application that actually needs 40k worth of source code)) compile time will be negligible. A few seconds tops. Don't worry about compile times for this competition, worry about the time to actually come up with the algorithm and then to implement it in the correct syntax.

    They aren't doing any serious object oriented coding because everything is in one class, and because they're allowing Borland's Pascal (well technically Delphi but they are using is as a super powerful Turbo Pascal. This means implementing simple algorithms.

    If you want your kids to succeed in this arena, here's the best toolset to train them. Two piece of paper, a pencil, and a few crayons. Verbally describe a simple problem for them. Explain it only once. As you are explaining it to them, have them take notes on one piece of paper and capture the requirements. On the second piece of paper, using the crayons diagram their solution. A sort can be diagrammed by drawing boxes and arrows showing how things move around. String manipulation or array manipulation can be diagrammed by drawing a word with numbers below it and arrows above it showing how the elements are moved around. Teach them to understand the problem, come up with a practical approach, and then code it in the basic syntax in any language.

    Because I expect the problems to have solutions that would be simpler if the language has iterators, and since they are disallowing pretty much all of the good Java external packages to do those things - I'm going to suggest a language with simple pointers - either Pascal or C/C++. Rearranging arrays (of characters, structures, or whatever) is trivial in either of those languages, and rearranging or iterating over an array is the perfect example of algorithm design and implementation typical of this type of challenge.

    --
    Glonoinha the MebiByte Slayer