Forgot your password?
typodupeerror
Australia Education Programming

Good Language Choice For School Programming Test? 407

Posted by timothy
from the 'strailian's-too-difficult dept.
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?"
This discussion has been archived. No new comments can be posted.

Good Language Choice For School Programming Test?

Comments Filter:
  • by davidwr (791652) on Sunday March 14, 2010 @09:07PM (#31476684) Homepage Journal

    English, Vulcan, or whatever the local human language is. Or just give everyone a translation device.

    Oh, you mean the language for the programs. My bad, I thought you meant for the instructions and problem description, sorry.

    But seriously....

    Your first line is to see what eligible language the students mostly know already or what is taught in that school or school system and go with it.

    Barring that, go with whatever is commonly used in most university college freshman programming classes. It may not give them the best chance to win but learning it will have practical value.

    If you know the types of problems they will give, everything else being equal go with the language that is best suited for the problem type.

  • by EEBaum (520514) on Sunday March 14, 2010 @09:12PM (#31476728) Homepage
    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.
  • by mdf356 (774923) <mdf356NO@SPAMgmail.com> on Sunday March 14, 2010 @09:13PM (#31476730) Homepage

    In a programming contest memory leaks and such are meaningless. In fact, algorithmic complexity is also nearly meaningless. O(n^3) solutions that you can code in 5 minutes win over the O(n lg n) solution that takes an hour to code up.

  • Pascal (Score:2, Interesting)

    by jadrian (1150317) on Sunday March 14, 2010 @09:18PM (#31476802)

    I would go with Pascal. And if not, Java.

    Pascal has a is very simple and clear syntax and semantics. It has strong and static typing, making many errors very easy to catch at compile time. The case for Java is similar but the syntax and semantics are a bit more complicated.

    C is terrible to teach, they'll have to deal with pointers all the time. Reading something from input? Pointers. Passing by reference? Pointers. Strings? Pointers. Sure you may omit that those are pointers but the segmentation faults will show up for regular reality checks. Same for C++. Python means working with dynamic typing. PHP dynamic and weak typing. Don't get me started on Visual Basic.

  • Ask them (Score:3, Interesting)

    by igotmybfg (525391) <slashdot@dan[ ]t ... t ['iel' in gap]> on Sunday March 14, 2010 @09:30PM (#31476908) Homepage
    Explain the situation to your students; give them the options available with pros and cons for each; and let them decide for themselves.
  • by zach_the_lizard (1317619) on Sunday March 14, 2010 @09:42PM (#31477024)
    Some algorithms are better suited for some languages or paradigms than others. Quicksort, for example, relies on mutability to be efficient. A language like Haskell, where the list to be sorted would be recreated a bunch of times, would not be well suited. Even with the same algorithm, it would run slower. Sometimes the language dictates the algorithm that would be best to use, or what data structures make sense. That said, I think I would have to recommend, of the languages listed, Python because of its general reputation for being easy to learn. Plus, it has decent support for several paradigms. Want to be OO? Cool. Want to functional? We can do that too. It opens the mind to more ways of thinking about a problem than more single paradigm languages, and that can be very useful in this sort of contest.
  • Probably Java (Bleh) (Score:2, Interesting)

    by pookemon (909195) on Sunday March 14, 2010 @09:43PM (#31477038) Homepage
    When I first read the list I thought "Pascal". The reasons are that it's a structured language, it is very easy to use and it's able to teach extremely useful concepts like linked lists, recursive algo's etc.

    However... It's nigh on useless these days to have "Pascal" on your CV (I'm sure both the Pascal developers out there will disagree - Yes I'm looking at you Delphi devs...)

    I did C, Pascal and COBOL at UNI and since then I have spent some 15 years writing VB (3->.Net), C, C++, C# etc. In the last 2 years I have been working mostly with Java. And I hate it. It's slow, memory hungry, it's tools are Sh*t (Matisse's creators are on drugs).

    That being said, pick up your local paper (or go to Seek - also bleh) and look at the proportion of jobs advertised these days that require Java. It's quite significant. That's the sort of thing that you should be looking at when making your decision. Sure, you'll find a few that require any of your listed languages. And sure, when these kids have finished UNI and want to work in IT (poor bastards) Java will be dead and buried, but there'll be a million and one "Legacy" systems lying around that use Java.

    Oh and teach them some database skills. The local UNI here puts out graduates that don't know anything but Cross joins and have no idea what a left join is...
  • by v1 (525388) on Sunday March 14, 2010 @10:19PM (#31477314) Homepage Journal

    I read over quite a few already and find it funny people are saying things like python are the easiest of the bunch to learn. Command line easiest? really?

    As much as I don't like MS, their VB is by far the easiest of the bunch to learn. And you won't have any speed issues at all to deal with, it executes extremely fast. It's an event-driven language also which makes it easier to compartmentalize things and avoid confusion for new users. Debugging in C can be a nightmare. VB does a great deal to force proper coding, it's hard to write something that compiles that doesn't run anything like it should, and with breakpoints and stepping, a higher level language like vb is very easy to debug. Strong typing is another plus.

    Beware of people replying back with what's easiest for them. You're going to get a lot of that.

  • by fractoid (1076465) on Sunday March 14, 2010 @10:54PM (#31477528) Homepage

    As the summary says "Accepted languages" (presumably the competition rules), I would tend to agree. They're not going to ask your students to complete something that those languages cannot reasonably accomplish. Bad C++ code will be slower than halfway-decent Python code. Teach a good foundation, and let the chips fall where they may.

    Agreed. I've done a couple of these programming competitions in my youth (heh :P ) and in my experience, the runtime limit is in place to force you to use a more efficient algorithm, not to force you to streamline your brute force approach. So there might be a problem that would take an hour to solve using brute force, or a couple of seconds using dynamic programming, for instance - choice of language isn't going to affect the performance appreciably compared to choice of algorithm.

    For what it's worth, I too say Python. It's easy to learn, flexible, and executes fast enough.

  • by Jeff Satterley (1622949) on Sunday March 14, 2010 @11:09PM (#31477630)
    Teach the kids Scheme! Seriously, it's a better transition from pure math to programming. (http://www.teach-scheme.org/)
  • by Kaz Kylheku (1484) on Sunday March 14, 2010 @11:15PM (#31477678) Homepage

    The difference between C++ and Python isn't simply that C++ has a more complicated syntax.

    In C++, the kids will have to wrestle with the static type system and the lack of automated memory management. (Problems that can be partially overcome with a lot of "greenspunning" that requires significant C++ experience).

    The number one factor in performance is the choice of algorithms. A Python program with good algorithms will beat a C++ program which uses poor algorithms, or which does stupid things like copy aggregate objects in order to avoid memory management difficulties.

    It's sad that the list of languages includes only immature dynamic languages du jour like Python and excludes mature dynamic languages that have good compilers. Bad education!

  • It's just me (Score:4, Interesting)

    by Exitar (809068) on Monday March 15, 2010 @05:37AM (#31479536)

    or teaching a language to non programmers children and sending them to Informatics Olympiad after two months is pretending too much?
    In addition to the language, you must first teach them very basic concepts like variables, loops, recursion...
    As soon as they start to digest them and write their first "Hello World"... BANG! You send them to Informatics Olympiad!

  • by jonadab (583620) on Monday March 15, 2010 @06:40AM (#31479922) Homepage Journal
    The CPU time limit is less important in this instance than the two months you have to teach them. In that amount of time, starting them from scratch, you won't likely get to the point of teaching them algorithm analysis and optimization anyway, much less benchmarks and profiling.

    Consequently, Python will probably be a good deal *faster* than C, because its low-level stuff has already been optimized by people who know how.

    If you use C, can you imagine getting new programming students, within two months, to the point where they are implementing hash-based associative arrays and a fast stable sort routine? I can't. In two months, working in C, you'll be lucky if they can remember how to copy a string.
  • by DavidApi (136128) on Monday March 15, 2010 @06:48AM (#31479982)

    Do they realise how much of the world's systems run Perl? And given that it's pretty much built into every major OS (yes, Windows needs a download). Wow, this is mind-boggling. I still can't get over it. And the fact that simple Perl is just that - so simple. Hello World is a one liner. No classes to define, no libraries to import, no header files to include.

    And you can write poetry with it! (bonus points?)

  • by Antique Geekmeister (740220) on Monday March 15, 2010 @07:28AM (#31480186)

    There is an incredible performance penalty for most object oriented code written by beginners: they aren't taught to avoid the layers of abstraction that eat away at your performance, and they often hide incredible errors behind layers of abstraction that make debugging a nightmare.

    Python seems a good compromise: as a scripted language, it's quite portable. It has good text processing, there's a large base of small examples to teach students with, and it doesn't suffer from that horrid mass of badly written, interdependendent, unstable and unnecessary utilities known as CPAN that clutters a lot of Perl programming.

  • by ThePhilips (752041) on Monday March 15, 2010 @07:57AM (#31480376) Homepage Journal

    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.

    In my experience time limits are there to prevent students using primitive algorithms (the ones with exponential asymptotic performance).

    N.B. I would have recommended Perl instead - but I'd refrain :)

    Python should be and is in fact fast enough for most tasks. Taking algorithms into account, C gives only marginal advantage: bubble sort would suck even if you'd write it in assembler.

    P.S. If that is still concern, one can allow interpreted languages to have e.g. twice more time compared to compiled languages.

As the trials of life continue to take their toll, remember that there is always a future in Computer Maintenance. -- National Lampoon, "Deteriorata"

Working...