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

407 comments

  1. Faster than you think by Anonymous Coward · · Score: 1, Informative

    Python is faster than you think.

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

    2. Re:Faster than you think by Anonymous Coward · · Score: 0

      There are a few things that need to be considered, these are children, showing them something that gives immediate results is good, python for example works fine, and PHP too I guess, but if they have any interest in this they'll want to try this at home too. Downloading a zip file for python seems the simplest thing, and second if they want to try something new they will find tons of tutorials on the net.

      In highschool I had to go through Pascal, C, C++ and Foxpro, after that I started on my own wadding through PHP, ruby and python. The only thing that kept me sane was the documentation and tutorials found on the web.

    3. Re:Faster than you think by gd2shoe · · Score: 4, Insightful

      You can't really worry about the runtime limit since it should be rather liberal for a student's competition...

      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.

      (And I too vote Python, by the way.)

      --
      I won't join Slashcott. OTOH, If Beta goes live, I just won't be back until it's fixed. Sorry Dice.
    4. Re:Faster than you think by rwa2 · · Score: 2, Informative

      In college I wasted SO much time debugging C/C++ code memory errors. Python was such a breath of fresh air. I could think of something with a mildly complex structure, implement it, and have it work pretty much on the first go.

      I've spent days, DAYS debugging weird stack memory limitations in C++, where it would work right on a small data sample, but completely fail on a slightly larger set.

      I used psyco on my Master's thesis to greatly speed up my python simulation (10-100x with a simple import statement). Unfortunately it only works on 32-bit ix86. Supposedly other projects like pypy are supposed to reintroduce that kind of optimization to modern python, but I finished my thesis :P It's easy enough to link to C/C++ code for parts that really have to run fast though.

      So yeah, start them off with python. And maybe teach the advanced students how to link to C/C++ modules for performance-critical functions.

    5. Re:Faster than you think by webruss · · Score: 1

      I have to agree. I think python is going to be the easiest to teach them and will be plenty fast enough. Here is a link to an article about a teacher introducing high school students to python and the successes encountered. http://www.python.org/workshops/2000-01/proceedings/papers/elkner/pyYHS.html

    6. Re:Faster than you think by goombah99 · · Score: 1

      Python is faster than you think.

      huh? it's about 1000x slower than C. and No i'm not exaggerating. Numpy is fast and close to C. Python itself is not.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    7. Re:Faster than you think by fractoid · · Score: 2, Interesting

      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.

      --
      Rampant carbon sequestration destroyed the Dinosaurs' tropical paradise. I'm here to help repair the damage.
    8. 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

    9. Re:Faster than you think by frosty_tsm · · Score: 1

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

      I'll add to this.

      I would expect that having a runtime limit, they are trying to weed out horribly inefficient and/or bad code. Teaching something easier for them to understand will help avoid this.

    10. Re:Faster than you think by collinstocks · · Score: 1

      I have a programming contest coming up this Thursday at NJIT. We have two choices: Java, or C++. There is a one minute runtime limit for the solution (which is why we came in sixth place last year instead of first -- we focused too much on finishing all the problems than coming up with efficient solutions for two of them).

      Anyway, for a runtime limit like that, there really is no difference between Java and C++. They will both do well or poorly depending on the algorithm. It's much better to be able to finish coding everything with time to spare than to spend too much time debugging.

    11. Re:Faster than you think by beakerMeep · · Score: 1

      Where's the Logo love?

      --
      meep
    12. Re:Faster than you think by timmarhy · · Score: 1
      i've written 3d geological models in python with over 400,000 data points, and it rendered in seconds and ran at about 5fps on my onboard video card and core 2 duo cpu. sure it'd be faster in c++, but i knocked out the application that produces the models in an afternoon tinkering. no way you'd do that in c++.

      python is perfect for people who want to learn and want to produce something useful in a short time.

      --
      If you mod me down, I will become more powerful than you can imagine....
    13. Re:Faster than you think by timmarhy · · Score: 1

      if speed is an issue you can always execute something written in C and have python deal with the results. do the high level stuff in python where speed isn't an issue. best tool for the job and all that.

      --
      If you mod me down, I will become more powerful than you can imagine....
    14. Re:Faster than you think by Z00L00K · · Score: 1

      I would call in Pascal since it's a language that's fairly easy to understand and learn and it is a lot less prone to strange bugs than C/C++.

      Since it's a compiling language you will also find out inconsistencies before you execute. Scripting languages are sometimes filled with time-delayed bombs waiting to go off in inconvenient moments due to undeclared or misdeclared entities.

      What you get with Pascal is also a structured way of doing things. The code is easy to read and understand even if you don't know Pascal before. Experience in structure earned from Pascal can easily be translated to C, Java or C#.

      Visual Basic is a big NO in my book. Too much problems have been caused by VB already.

      And if you are counting CPU cycles - any language with a virtual machine has already lost.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    15. Re:Faster than you think by smash · · Score: 1
      And this is critical for a school project how?

      Choosing a language based on fast runtime speed when

      1. speed is not an explicit requirement
      2. you'll get better performance benefits from getting the algorithm correct
      3. in an educational situation, a slower language will show poor code up even more

      ... is retarded. There's plenty of real software out there written in python, and being easier to learn than C will make it easier for students to tweak algorithms. Getting algorithms correct is the more important programmer skill - implementing the actual algorithm in language X is a dumb task that may even be made redundant as compilers and programming languages advance.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    16. Re:Faster than you think by dvice_null · · Score: 1

      C is faster in the hands of experienced programmers. Python is probably faster in the hands of newbies as there are lots of build in functions that most likely do things faster than they could do if they wrote those functions themselves in C.

    17. Re:Faster than you think by ObsessiveMathsFreak · · Score: 1

      VISIBLE "HAI WORLD!"

      The only thing holding LOLCODE back is the VISIBLE keyword. It's not funny, makes little sense, and breaks the whole illusion of an informal programming langauage by throwing right back into stuffed shirt syntax.

      FAIL.

      --
      May the Maths Be with you!
    18. Re:Faster than you think by quadrox · · Score: 1

      awesome - somebody should make this a real language. Who knows, maybe even me.

    19. Re:Faster than you think by vlm · · Score: 1

      awesome - somebody should make this a real language. Who knows, maybe even me.

      L8 2 DA PARTY. CAN HAZ IMPLEMENTATIONS?

      http://lolcode.com/implementations/implementations

      --
      "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
    20. Re:Faster than you think by EngivalX · · Score: 1

      Shouldn't it be: KITTEH SEZ, "Hai!"

    21. Re:Faster than you think by kirill.s · · Score: 1

      Python would definitely be a good choice, but the kids risk not being able to understand the Compiling joke.

    22. Re:Faster than you think by Razalhague · · Score: 1

      It comes from these type of lolcats. Sure, it's not the best choice, but it's far from "stuffed shirt syntax".

    23. Re:Faster than you think by daveime · · Score: 1

      +1

      KITTEH IS IN UR TV GOIN DOWN / UP / BACKWD / FORWD
      (for cursor placement)

      KITTEH SEZ GTFO
      (clear screen)

      KITTEH SEZ "HAI"
      (print something to screen)

    24. Re:Faster than you think by wvmarle · · Score: 1

      And considering Java, PHP and Visual Basic are also in the list I don't think speed is too much of an issue really. Those languages are not known for speedy execution.

      I have heard the rule of thumb that a Python solution is something like half the speed of a C solution, so that's not too bad.

      Pascal may be nice too. My college was teaching Turbo Pascal, that was very easy for me to pick up (especially as I knew the idea of programming thanks to BASIC already). I found it a quite easy syntax to pick up, not as easy and clear as Python which is my current favourite, it certainly will be easier than C/C++ (I tasted that and found it too hard to learn for my purposes, especially thanks to the fact that you have to compile before you can run - Python debugs easier).

      If I were to do something like you propose I'd go for Python. From what I've seen from the other languages it's the easiest to learn. I think it's the best current language for teaching programming.

    25. Re:Faster than you think by Schadrach · · Score: 1

      The runtime limits on these competitions are mostly there to provide a flat cutoff for exceptionally bad algorithms and for infinite loops. They are usually very generous to the point of "If it runs over the time limit, then either you are doing it *very* wrong or are stuck in an infinite loop on our example data".

      For example, say you have to find the max path sum down an equilateral triangle of numbers. There is a solution that involves visiting each position in the triangle once for an arbitrary size of triangle. There are also solutions that involve individually testing every possible path one at a time. The former is probably under the limit when presented with a 500 level deep triangle, the latter probably isn't.

      For the most part, you're best bet is to give them a good understanding of the basics of the language, a reference book (if such are allowed in your competition), and then go heavy into general problem solving, especially ways to simplify seemingly computationally intensive problems.

    26. Re:Faster than you think by Nesman64 · · Score: 1

      I'm not an expert with LOLCODE, but I've seen an image macro of a cat or two. I'm thinking that the visible keyword probably has a counterpart named after, or is at least a reference to, the "invisible" meme.

      http://icanhascheezburger.com/2007/01/25/invisible-bike-2/

      --
      coffee | nose > keyboard
    27. Re:Faster than you think by suisui · · Score: 1

      Then NOT INVISIBLE "HAI WORLD!" strikes me as the correct syntax.

    28. Re:Faster than you think by Anonymous Coward · · Score: 0

      Just to agree with everyone else, the major difference in execution times will be due to algorithm selection. The overhead of being interpreted will only come into play when two programs are implementing the same algorithm.

  2. Too easy... can't resist... by Anonymous Coward · · Score: 1, Funny

    If there's a runtime CPU limit, then why is Java even an option?

    1. Re:Too easy... can't resist... by WrongSizeGlass · · Score: 4, Funny

      It's the whole "4 out of 5 doctors ..." scenario. Any kid who picks Java will be taken away to be deprogrammed and then reintroduced to programming society once they're ready to be released into the wild.

      Born free, free as the wind blows ...

    2. Re:Too easy... can't resist... by hedrick · · Score: 1

      Java's pretty good these days, aside from taking longer to start.

    3. Re:Too easy... can't resist... by Schraegstrichpunkt · · Score: 1

      No, it isn't. What else have you used?

    4. Re:Too easy... can't resist... by binarylarry · · Score: 1

      Java is easily the 2nd or 3rd fastest on the list.

      --
      Mod me down, my New Earth Global Warmingist friends!
    5. Re:Too easy... can't resist... by Anpheus · · Score: 1, Troll

      Are there only 2 or 3 languages on the list? (Did not even read TFS.)

    6. Re:Too easy... can't resist... by binarylarry · · Score: 1

      Basically, the real choices were C, Java and Python.

      Java would squarely be 2nd in that case.

      --
      Mod me down, my New Earth Global Warmingist friends!
    7. Re:Too easy... can't resist... by Anonymous Coward · · Score: 0

      Why leave out C++? It's not like they'll need to implement design patterns.

    8. Re:Too easy... can't resist... by Joce640k · · Score: 1

      C++ is definitely the best language in the world but half-learned C++ is worse than no C++ at all.

      --
      No sig today...
    9. Re:Too easy... can't resist... by binarylarry · · Score: 3, Funny

      C++ is definitely the best language in the world.

      My god

      --
      Mod me down, my New Earth Global Warmingist friends!
    10. Re:Too easy... can't resist... by Anonymous Coward · · Score: 1, Funny

      ...it's full of templates!

    11. Re:Too easy... can't resist... by smash · · Score: 1

      For values of "best" meaning "best for kool-aid drinkers"

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    12. Re:Too easy... can't resist... by Anonymous Coward · · Score: 0

      It's the whole "4 out of 5 doctors ..." scenario. Any kid who picks Java will be taken away to be deprogrammed and then reintroduced to programming society once they're ready to be released into the wild.

      Born free, free as the wind blows ...

      i would agree. but i think people should be using C# but thats just me

    13. Re:Too easy... can't resist... by Anonymous Coward · · Score: 0

      Born free, free as the wind blows ...

      That'll be 12 cents per kilowatt hour.

    14. Re:Too easy... can't resist... by TheDarkMaster · · Score: 1

      When you JRE is ready to load your app, the time limit is already over :)

      --
      Religion: The greatest weapon of mass destruction of all time
  3. INTERCAL by Anonymous Coward · · Score: 0

    Master it and everything else seems easy.

    1. Re:INTERCAL by Bill,+Shooter+of+Bul · · Score: 1

      Nah, go esoteric or go home.

      http://en.wikipedia.org/wiki/Brainfuck

      --
      Well.. maybe. Or Maybe not. But Definitely not sort of.
    2. Re:INTERCAL by Brian+Gordon · · Score: 1

      Looks cleaner than some of the Perl I've seen :)

    3. Re:INTERCAL by Torodung · · Score: 1

      PLEASE DO FORGET #1
      GIVE UP

    4. Re:INTERCAL by Anonymous Coward · · Score: 0

      Malbolge was here, Brainfuck ain't got nothing on me.

    5. Re:INTERCAL by Bill,+Shooter+of+Bul · · Score: 1

      Yeah, I know. I considered recommending Malbolge, but Brainfuck is the most esoteric language that can actually be programmed on purpose, without having to result to brute force searching for a program that does what you want. It would be easier to be just given a block of data and have to create a turing complete language that interpreted the data as a program that you wanted.

      --
      Well.. maybe. Or Maybe not. But Definitely not sort of.
  4. Tough Decision by Anonymous Coward · · Score: 0

    It depends whether you are trying to teach them how to program, or teach them how to win. If you teach them something hard to start with, they may become frustrated and quit. If you teach them something easier, they may not win the competition. Personally, I'd lean towards teaching them, rather than pushing them into something they aren't ready for.

    1. Re:Tough Decision by ElSupreme · · Score: 1

      Mod parent up!

      I would teach them something they can compete with. Not necessicarilly what is the most competitive. Who cares if C is faster, if they don't have enough knowledge to solve the problems. I would try to teach them something to maximize their utility and scrap time. If they continue to program they have reall won (or lost) not sure which way to go on that one.

      But really if you give them good ability to solve problems via programming you really let them win. They can go lear C over the following year.

      --
      My addiction: Arguing with idiots. AKA Slashdot!
  5. Many good choices by DoofusOfDeath · · Score: 4, Funny

    You don't want a test that favors kids who have studied that particular language in the past. I suggest the Turing-complete language LaTeX. It's the only way to be sure.

    1. Re:Many good choices by Anonymous Coward · · Score: 0

      I guess one would really suggest plain TeX. The macro packages make the challenge too comfortable.

    2. Re:Many good choices by Anonymous Coward · · Score: 0

      Go for C++ Templates instead. It's even an allowed language for the contest!

    3. Re:Many good choices by nacturation · · Score: 1

      What, you have something against PostScript?

      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    4. Re:Many good choices by wuzzeb · · Score: 1

      Perhaps you might be interested in the article in the Monad.Reader Issue 13 (warning: pdf) where the TeX language is used to solve the 2008 ICFP programming contest.

      He writes a program to control a Mars rover in TeX, it is really impressive. You can even download the source code.

    5. Re:Many good choices by Anonymous Coward · · Score: 0

      TeX is a Turing-complete language. LaTeX is a library written in TeX.

    6. Re:Many good choices by pantherace · · Score: 1

      Not really, we can specify it as an output.

    7. Re:Many good choices by Anonymous Coward · · Score: 0

      Teach in a Teaching language not a "popular language" Scheme Lisp, Squeak Smalltalk, etc... are made for teaching programming concepts. Use them.

  6. There's C then there's C written by newbies by squidgit · · Score: 2, Informative

    OK C could be a computationally fast solution, but I'd go for Python anyway. Why? Mainly this: How many new C programmers (i.e. less than 1 or 2 years experience) can write programs without obscure memory leak/access problems? How much time have slashdotters wasted looking for elusive segfaults in C code? I know I've wasted hours, days, chasing buffer overruns in school assignments. Or worse are the ones you don't see; they only trigger on the examiner's machine..

    1. Re:There's C then there's C written by newbies by mdf356 · · Score: 2, Interesting

      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.

      --
      Terrorist, bomb, al Qaeda, nuclear, yellowcake, kill, assassinate. Carnivore is dead... long live Echelon.
    2. 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
    3. Re:There's C then there's C written by newbies by squidgit · · Score: 1

      Well that's true up to the point that your careless memory leaks cause you to hit some threshold and are terminated! Really, I've had this happen to me in a programming contest, it sucks :-) Maybe of more interest is the memory access part of my post - who hasn't had their C SIGSEGV'd for invalid pointer and/or buffer overrun offences? btw I agree wrt algorithmic complexity but then I've never coded in a contest with a CPU time bound like this one apparently has..

    4. Re:There's C then there's C written by newbies by Anonymous Coward · · Score: 0

      In the case of leaking, any. You have to be a retard to leak memory in C. A free for each malloc isn't rocket science. Bad design and ignorance are the most common causes for memory leaks. You either create a mess so complicated that you can't figure where to free your memory or just don't know that you are supposed to free it. Objective-C and especially C++ have more problems because of the whole instance creation and destruction abstraction, but in the end the problem is ignorance from ex-Java people that were used to create objects and let the Garbage collector pick them up.

      Buffer overflows and off by one on the other hand are more frequent problems in C (Where frequent is at all because managed languages are unable to break free from their head protections), but knowing about them and avoiding overflow fodder(strcpy, gets) is often enough to keep them close to 0.

    5. Re:There's C then there's C written by newbies by mkiwi · · Score: 1

      I don't know too many novice (fresh off the boat) C programmers who ever need to worry about memory leak or access problems that wouldn't exist in any other strongly typed language. That's something an intermediate or advanced person does. More powerful features are for people who know the language better. C is simple if you stick to basics.

    6. Re:There's C then there's C written by newbies by oldhack · · Score: 1

      And C++ only compounds the problem.

      This is an educational venture, right? You have Python, a reasonably clean yet expressive high-level language to get kids hooked on programming. Kids can write simple procedural programs to solve the problem at hand, without encumbering them with OO baggage that may not be useful. It even comes with an animal icon. Where is the dilemma?

      --
      Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
    7. Re:There's C then there's C written by newbies by oldhack · · Score: 3, Funny

      Actually, I take this back.

      Go with C++. If not, in 20 years, some of these kids will come after you for ruining their lives by seducing them into the nasty painful world of programmers. It's a nasty way of life. Scare them shitless off it - teach them Perl and make them debug each other's code. Tell them all the grownups use Perl.

      --
      Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
    8. Re:There's C then there's C written by newbies by fractoid · · Score: 1

      In a programming contest memory leaks and such are meaningless.

      Correct. Spitting out the right answer in a reasonable time is the only thing which is important.

      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.

      Correct for your example (meh, polynomial, that's good enough) but not for the questions they'll be asking in the test. It typically won't be a choice between O(n^3) and O(n log n), more like a choice between O(n^4) and O(n^n). And then they'll give you examples with n=3 and n=4, and their test case will have n=17.

      --
      Rampant carbon sequestration destroyed the Dinosaurs' tropical paradise. I'm here to help repair the damage.
    9. Re:There's C then there's C written by newbies by squidgit · · Score: 1

      By "memory access" I mean pointers, buffers etc. You can't code in C and get away from these and they are a (the?) common source of newbie programming bugs in C code. Hells, at least Java, Ada etc have the good sense (and, yes, runtime overhead) of bitching at you when you overstep your bounds.

    10. Re:There's C then there's C written by newbies by Anonymous Coward · · Score: 0

      BWWHAHAHHAH! Perl is line noise! It's a write-only language!

      Look, this is perl:

      ####JGJGJJR$$
          #&R&%&%&%&%&
            (^(^(^((^(^
              #*#*#*#*#*

      LOLz! Golly, this is good stuff.

    11. Re:There's C then there's C written by newbies by binarylarry · · Score: 1

      Does that make it PERL'in noise?

      hahahaha

      --
      Mod me down, my New Earth Global Warmingist friends!
    12. Re:There's C then there's C written by newbies by cripeon · · Score: 1

      In the case of leaking, any. You have to be a retard to leak memory in C. A free for each malloc isn't rocket science. Bad design and ignorance are the most common causes for memory leaks. You either create a mess so complicated that you can't figure where to free your memory or just don't know that you are supposed to free it. Objective-C and especially C++ have more problems because of the whole instance creation and destruction abstraction, but in the end the problem is ignorance from ex-Java people that were used to create objects and let the Garbage collector pick them up.

      For complex data structures, one free for every malloc can indeed get very tricky to handle. For example, in C++, one can just write a destructor for a tree node that calls delete on it's children before delete'ing itself. Free'ing all memory is as simple as calling delete on the root node. Writing a recursive deallocator in C is trickier to get correct.

      There's also issues of pointer ownership, problems that C++ and Java also inherit. Sure, this can be avoided if you have very clear cut guidelines on who owns what, but even these will fall short on some cases and those exceptions will need to be treated very carefully. The Python C interface has such guidelines.

      My point is, you can be very intelligent and still manage to leak memory in C. It's completely doable, and as the complexity of your code increases, so do the chances of memory leaks. C++ and Java abstractions go a ways to help, but aren't enough by a long shot. This is why tools like valgrind are still relevant.

    13. Re:There's C then there's C written by newbies by sydneyfong · · Score: 1

      Then you're doing it wrong.

      The way to handle memory for most tasks in these competitions is to statically declare the structures you need, and use them intelligently. There was almost never a need to malloc() or "new" objects.

      The large inputs are usually there to force solutions use efficient algorithms, not to filter out the ones that leak memory...

      --
      Don't quote me on this.
    14. Re:There's C then there's C written by newbies by Anonymous Coward · · Score: 0

      My point was that Java-style(or Python-style) abstractions are the root of most problems for C++ programmers.

      That doesn't usually apply to C programs because C programs tend to be more modular and less overengineered. I think that is because of the lack of syntax sugar.

      Even if that kind of design is absolutely needed, creating constructors/destructors and keeping a reference count takes little more time than OO boilerplate code. With the difference that you know exactly what is happening and you don't have to worry about the differences between c++ and ++c or what means today.

      If you have leaks the problem happened well before you introduced the leak. I concede that sometimes you can't do anything about it as some bastard sitting in an ISO chair designed the interface. But this is a programming contest.

      The real problem is that Object Orientation in the form present in most widely used OO-languages promotes lack of modularity when OO is really all about modularity and lack of side-effects.

      What's the point in encapsulating behavior if your overall design has objects of any type own and access objects of any type? You are just wasting your time using accessor functions when semantically you could as well be writing to raw memory.

    15. Re:There's C then there's C written by newbies by Anonymous Coward · · Score: 0

      I don't know about Australia, but in my home country, the best coders in the National Informatics Olympiad are sent to the International Informatics Olympiad. In order to get to the national team, one has to really consider algorithmic complexity. Everybody gets lectures on the Big O notation.

      I took part of the competition in high school 5 years ago. For each problem, they tested your program against a number of input files. The first tests checked simple and special cases. The last test input files were very big (up to several megabytes). The run time for the program to qualify was 1 second. My program ran for 1.5 seconds. The tester looked at the source code to see if there was an easy way to fix to speed up my program (I was sitting next to the tester). There was not. Then we tried to compile with more compiler optimizations turned on, but it increased the run time to 2 seconds. There was simply no way to make my algorithm run faster. It was inherently slow.

      The winner's solution ran well under 1 second. I did not qualify for the National team.

      I would also recommend Python, because it is not very slow. It is compiled before the first execution. And it reduces lots of tedious work. I remember the times when competitors had the quicksort algorithm memorized, just to be able to write it a bit faster than the others. And when PHP was first allowed, it made the typical beginners' exercises, like radix conversion, solvable in one line.

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

      Which was my point -- the contests were unforgiving when people were not intelligent about these things.

      --
      Palm trees and 8
    17. Re:There's C then there's C written by newbies by Estanislao+Mart�nez · · Score: 1

      You have to be a retard to leak memory in C.

      This only confirms my suspicion that the software industry is full of retards, and they all program in C.

    18. Re:There's C then there's C written by newbies by Estanislao+Mart�nez · · Score: 1

      For complex data structures, one free for every malloc can indeed get very tricky to handle. For example, in C++, one can just write a destructor for a tree node that calls delete on it's children before delete'ing itself. Free'ing all memory is as simple as calling delete on the root node.

      But what if you want to deallocate the parent node and all of its children except for one? E.g., you may have a situation where you can prove that your program will "go down" one particular branch of a very large tree and never need any of the rest. In this case, your proposal requires the program to hang on to the whole tree for the whole computation, when it only needs successively smaller subtrees.

      Writing a recursive deallocator in C is trickier to get correct.

      Why would it be any trickier? Writing a dealloc_tree function is trivial: the function first calls itself on the child nodes, then frees the parent node's memory. The big question marks are whether to free the data element pointed by each node (the data ownership problem), and how to free them. The first should be as much as a question mark in C as in C++. The second can be saved by using function pointers to pass in a custom function to free the node element.

    19. Re:There's C then there's C written by newbies by jamie(really) · · Score: 1

      And such things cannot be done by newbies in java and python? I suppose it takes real experts to code up a massive memory leak in java (*cough* meta data not unloaded in apache *cough*).

  7. English, but seriously by davidwr · · Score: 2, Interesting

    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.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
  8. Strange limitation by Anonymous Coward · · Score: 1, Insightful

    What a ridiculous limitation! CPU time is only interesting for hardcore programming these days. If you're writing a cutting edge game or analyzing data from an radio telescope, sure, but if you're teaching kids to program: keep it simple. Teach them how to write their name 1000 times, and if they want to do that faster they'll discover C for themselves.

    1. Re:Strange limitation by godrik · · Score: 3, Insightful

      The contest has a cpu time limit which seems to be reasonnable for a programming contest.

    2. Re:Strange limitation by Charan · · Score: 4, Insightful

      I'm sure the CPU time limit would be generous enough that it won't matter if your programming language is interpreted 10x slower than hand-tuned assembly. They want to make sure you aren't using a brute-force O(n^3) algorithm when a linear one would work well enough.

      Plus, the judges need a rule to allow them to terminate programs that may be stuck in infinite loops. Otherwise, a contestant could delay the results of a competition indefinitely.

      (Imagine: "This competition was rigged! The judges killed my program before it had a chance to finish. It was working fine, and I was the first one to submit answers to all the problems. What? So it has a long start up time. You don't have a rule against 100-hour programs.")

    3. Re:Strange limitation by zappepcs · · Score: 1

      I think you are right, and there is no telling that one of the students won't code it in C to get those extra milliseconds. When there is a prize or bragging rights at stake, people (even kids) can be pretty relentless.

    4. Re:Strange limitation by ottothecow · · Score: 1
      Exactly, I am sure it is a pretty generous limit, made to prevent serious flaws in technique...or more: force people to correct their inefficient errors instead of just saying "well, it works eventually"

      If they are trying to teach people to program...there are probably kids who will want to stop at "good enough" (no incentive to make a program they won't actually use be any faster) and this gives you a reason why that they won't question. You just say "oh, doesn't meet the time limit" and it is done...much easier than trying to convince them to make it faster with no basis.

      --
      Bottles.
    5. Re:Strange limitation by godrik · · Score: 1

      Indeed, Most of the time using C for getting those CPU cycles will be useless.

    6. Re:Strange limitation by sydneyfong · · Score: 1

      The competition is pretty hardcore at higher levels.

      --
      Don't quote me on this.
    7. Re:Strange limitation by TheDarkMaster · · Score: 1

      CPU time and memory are finite resources. The sooner the new developer learn this, better.

      --
      Religion: The greatest weapon of mass destruction of all time
    8. Re:Strange limitation by Qu4Z · · Score: 1

      Not to mention that if you don't specify a CPU time limit, and you get an (apparently) infinitely running process you have no way of determining a winner short of solving the halting problem -- which may be a little too much effort if you're just looking to have a kids' programming competition.

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

    1. Re:I'm guessing the CPU limits are generous. by Anonymous Coward · · Score: 2, Insightful

      I agree. Some problems in programming competitions could be solved with a simple exhaustive algorithm. The main point of the CPU time limit is to make people use better and more creative algorithms, i.e. if you solve it correctly CPU time shouldn't be an issue in any language.

    2. Re:I'm guessing the CPU limits are generous. by bill_mcgonigle · · Score: 4, Funny

      Right, the OP says that Python is an accepted language, so it's only sensible to assume that this isn't a sneaky trap set by the Ruby Mafia intending to disqualify testers for using it.

      The Navy research showed Python is a good language for learning OOP and if programming contests today are anything like what they were when I was in ACSL, boy would having a scripting language be handy. I wonder how anybody could compete in c (but perhaps that's a built-in test - picking the right language for the job is an important skill).

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    3. Re:I'm guessing the CPU limits are generous. by zach_the_lizard · · Score: 2, Interesting

      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.

      --
      SSC
    4. Re:I'm guessing the CPU limits are generous. by Anne_Nonymous · · Score: 1

      >> The Navy research showed Python is a good language for learning OOP

      I read that as OPP, and strangely, the sentence still sort of works.

    5. Re:I'm guessing the CPU limits are generous. by Angst+Badger · · Score: 1

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

      I get so tired of hearing this nonsense go unchallenged. If, for a given task, there is a fastest known algorithm, it's almost always going to run much faster in a compiled language than an interpreted language, period. The idea that one can simply change algorithms to get better performance only applies when a better algorithm is known, and even then, it's still highly likely to run faster in a compiled language.

      The exceptions are largely those cases where the bulk of the computation utilizes a highly optimized compiled routine in the interpreter. The reason it's so hard to beat the performance of the major interpreted languages on regular expression matching is that their regex engines are generally written in carefully tuned C.

      This isn't to say that a compiled language is always the right tool for the job. Often, it is more cost-effective to spend less expensive programmer time on a project and throw the necessary hardware at it, but sometimes this is not possible or practical, as when one is coding for a resource-constrained platform. Also, over a long enough period of time, the cost of maintaining the hardware will eventually exceed the cost programming a more efficient solution. (With power-hungry PC servers, this point comes sooner than most people would expect, but generally not within the same quarter as the hardware allocation is made, so the accountants are blissfully oblivious to it.)

      The long and the short of it is that, all other things being equal, most compiled languages are substantially faster than interpreted languages, often by an order of magnitude. Interpreted languages exist as a concession to the scarcity and cost of programmer time, not because one can always (or even often) magically pull a better algorithm out of one's hat and match the performance of compiled code.

      --
      Proud member of the Weirdo-American community.
    6. Re:I'm guessing the CPU limits are generous. by pem · · Score: 1
      But the point is, C is very difficult to code and debug some advanced algorithms in. Yes, once you do, it will be faster, but in the programming contest (and often in real life) exploring different algorithms and getting stuff working at all will be faster in Python.

      In fact, probably enough faster in Python that, even if C is required for speed, you could do the prototype in Python and then recode it in C faster than if you just started off coding it in C.

      But that's just my experience.

    7. Re:I'm guessing the CPU limits are generous. by Anonymous Coward · · Score: 0

      It's a 4 hour programming contest, not a real-time cell phone billing system.

    8. Re:I'm guessing the CPU limits are generous. by jthill · · Score: 1

      Haskell makes quicksort run slow?

      --
      As always, all IMO. Insert "I think" everywhere grammatically possible.
    9. Re:I'm guessing the CPU limits are generous. by Corporate+T00l · · Score: 1

      Man, ACSL, that really takes me back. I used to submit my solutions in Prograph for the in-school problem sets (couldn't do this at the nationals, where we were using the centrally supplied computers). My peers would submit 2-3 page solutions in Pascal, my solutions would be like 15-20 pages of printed box and line diagrams.

      Implementing recursion and linked lists was kind of weird as well, with no variables...

    10. Re:I'm guessing the CPU limits are generous. by Anonymous Coward · · Score: 0

      No, unless you implement it with lists instead of arrays.

    11. Re:I'm guessing the CPU limits are generous. by smash · · Score: 1

      I get so tired of hearing this nonsense go unchallenged. If, for a given task, there is a fastest known algorithm, it's almost always going to run much faster in a compiled language than an interpreted language, period

      Uh... no shit.

      However, having an easier to code language that runs slower will:

      1. show more easily measured difference between various algorithms
      2. thus more easily showing the correct algorithm
      3. which can then have its hot spot(s) re-written in C or even assembler

      Using a low level language on 90% of the code that is not performance sensitive is masochistic, bug-prone and largely un-necessary.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    12. Re:I'm guessing the CPU limits are generous. by Anonymous Coward · · Score: 0

      I'd go with C/C++.

      In my experience, Python is not the right language for the job. Yes, it's simple, but if the programmer relies on its simplicity they generally don't understand the inner workings to get to the end solution as well as with a more in-depth language like C/C++. I'm an old-schooler, though, and I'd be happy to see ASM on there.

    13. Re:I'm guessing the CPU limits are generous. by JesseMcDonald · · Score: 1

      Haskell makes quicksort run slow?

      It would be more accurate to say that you can't implement the QuickSort algorithm properly with immutable arrays; its performance relies on being able to sort the elements in-place, without allocating new memory at every step. Haskell does have mutable arrays, however: IOArray and STArray. (more info) There are also sorting algorithms better suited to immutable data.

      Note that the introduction of mutable references makes the GC process much less efficient. The unboxed mutable array types (IOUArray, STUArray) do not have this drawback, but are limited to plain, fixed-size values.

      --
      "The state is that great fiction by which everyone tries to live at the expense of everyone else." - Bastiat
    14. Re:I'm guessing the CPU limits are generous. by Abcd1234 · · Score: 1

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

      Unless, of course, running time features into the scoring...

    15. Re:I'm guessing the CPU limits are generous. by Abcd1234 · · Score: 1

      Eeeep... "figures into"...

    16. Re:I'm guessing the CPU limits are generous. by Anonymous Coward · · Score: 0

      The "Ruby Mafia" ?

      I suppose you believe in the "liberal media" too?

    17. Re:I'm guessing the CPU limits are generous. by niftymitch · · Score: 1

      And much of the Python library hot spots have been coded in "C" to the point that they are not interpreted. Python continues to impress me as to how fast it can be.

      --
      Truth is stranger than fiction, but it is because Fiction is obliged to stick to possibilities; Truth isn't. Mark Twain.
  10. Psyco by headkase · · Score: 3, Informative

    For Python, can they use: Psyco as a library? That would help being practically a Just In Time compiler. It's x86 architectures only but that should be what they're running. As a side point I find it irritating that a language that is designed to be friendly and powerful is disadvantaged by counting CPU cycles: especially since in the real world those are plentiful compared to the scarce resources available for the hard work of debugging. And in Python if the CPU is your constraint - which it isn't in most programs - then you write that little bit of CPU code in C or C++ and call that one part from Python. This keeps the rest of the program easy to debug and portable.

    --
    Shh.
    1. Re:Psyco by maxume · · Score: 1

      I would imagine that they limits are somewhat of a practical matter. For tasks that are computationally simple, letting the programs run and run and run is a much bigger pain than simply allowing a given time on a fast computer and failing (and killing the process of) anything that takes longer.

      --
      Nerd rage is the funniest rage.
    2. Re:Psyco by zippthorne · · Score: 1

      Python doesn't have a built-in JIT?? What's with all the Perl hate, then?

      --
      Can you be Even More Awesome?!
    3. Re:Psyco by Anonymous Coward · · Score: 0

      Because it prevents you from having Perl Jam. Why would you do that?

    4. Re:Psyco by Anonymous Coward · · Score: 0

      Python doesn't have a built-in JIT?? What's with all the Perl hate, then?

      ()*&#)(*&!@#)(*&@)(!*^)@(^!!!!?

    5. Re:Psyco by EvanED · · Score: 1

      Personally, my dislike for Perl has almost nothing to do with the runtime environment and more to do with the mindset that causes someone to think this is a good idea.

    6. Re:Psyco by gd2shoe · · Score: 1

      Python people don't (generally) claim Perl is slow. Their objection is the language itself.

      (I liked my brief exposure to Perl, but it is a tough language to learn and retain.)

      --
      I won't join Slashcott. OTOH, If Beta goes live, I just won't be back until it's fixed. Sorry Dice.
    7. Re:Psyco by dougmc · · Score: 2, Insightful
      Of course, that's for perl 6 -- which hasn't been released, and it's hard to tell when or if it'll ever be released.

      Personally, I think a lot of the perl hate comes from the perl users getting stuff solved fast and (often) ugly, when the perl haters spend far more time creating their (often) far prettier solutions. If the programs need to be written quickly, I'd say perl would be the language to use (except that it's not permitted, of course.) If the programs need to execute quickly, C -- but it'll take longer to write them. In most cases (real world and contests!), time to write the program is more important than execution time -- though I'm not familiar with this contest.

    8. Re:Psyco by RAMMS+EIN · · Score: 1

      ``Python doesn't have a built-in JIT??''

      Does have. Just that JIT compilation doesn't necessarily mean you are going to be winning speed contests.

      ``What's with all the Perl hate, then?''

      What's that got to do with anything?

      --
      Please correct me if I got my facts wrong.
    9. Re:Psyco by RAMMS+EIN · · Score: 1

      ``And in Python if the CPU is your constraint - which it isn't in most programs - then you write that little bit of CPU code in C or C++ and call that one part from Python. This keeps the rest of the program easy to debug and portable.''

      While this is certainly a good point, I have found that, in practice, most programs fall in one of two categories:

      1. CPU usage isn't much of a problem. Python is a great choice.

      2. The bulk of your program needs to be _fast_. This practically rules out current Python implementations.

      In the second case, you could still write the rest of your program in Python, but it isn't always clear that this is a good idea. You would be pulling in a dependency on a specific implementation of a pretty bulky library (no Python implementation I know of is really small, and compatibility of the foreign function interface isn't great between different implementations, and I'm not even sure about different versions of the same implementation).

      There are, of course, also cases where you can write most of your program in Python and small parts in different languages, but I find those cases to be relatively rare.

      --
      Please correct me if I got my facts wrong.
    10. Re:Psyco by cbhacking · · Score: 1

      Hmm... this depends on the implementation that the examiners require. If you're allowed to use any runtime at all, then there are lots of (JIT) compilers for Python - IronPython, Jython, and Unladen Swallow are all reasonably fast (Psyco may be faster; I've never seen it used). However, they all also have slight differences, even if only in what version of the language they support, from the reference implementation.

      --
      There's no place I could be, since I've found Serenity...
    11. Re:Psyco by EvanED · · Score: 1

      Does have. Just that JIT compilation doesn't necessarily mean you are going to be winning speed contests.

      CPython (the standard Python implementation you get from Python.org) does not have a JIT compiler. It doesn't do straight Python interpretation, but it does do straight bytecode interpretation. (That's different from a JIT compiler though.)

    12. Re:Psyco by Anonymous Coward · · Score: 0

      The hating on Perl was about Perl's syntax, semantics, and maintainability, not about the efficiency of the main implementations of Python and Perl.

    13. Re:Psyco by Anonymous Coward · · Score: 0

      Psyco is nearly useless.

    14. Re:Psyco by Anonymous Coward · · Score: 0

      Perl is write only, while Python is fairly easy to read even if you don't know it.

      Just sayin.

    15. Re:Psyco by xiong.chiamiov · · Score: 1

      For Python, can they use: Psyco as a library? That would help being practically a Just In Time compiler.

      Or they could use the recent release of Pypy. I haven't used it myself, but the benchmarks look appealing.

  11. Re:anusscript by Anonymous Coward · · Score: 0

    I heard it worked for the GPL!

  12. 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."
    1. Re:Language shouldn't push you past the limit by Zillidot · · Score: 2, Insightful

      I have competed in both the informatics olympiads and the ACM collegiate programming contests, and in my experience there was a much greater emphasis on algorithms in the informatics olympiad. Whether your algorithm was O(n^3) or O(n^4) did make a difference to the results.

      That said, the choice of programming language only adds a constant factor to the runtime, so your point still stands.

    2. Re:Language shouldn't push you past the limit by Anonymous Coward · · Score: 0

      Having competed in them this year, I can most definitely say that it is for weeding out bad algorithms. Most all of the problems were set up in such a way that you could brute force the solution, but it wouldn't be pretty in terms of runtime. However, they also had a "right" way to solve them (a well-known or obscure algorithm for solving that problem), and the trick was recognizing how to map the problem statement onto graph theory, whether or not the greedy solution works, etc. The differences in runtimes of the right algorithm to naive algorithms would run in the factors of 10^(~10), so the factor of roughly two-ish that language choice will cause is nowhere near enough to put you over.

      That said, my team coded C++, but that was just because we all knew C++ already.

    3. Re:Language shouldn't push you past the limit by verdante · · Score: 2, Insightful

      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.

      Python makes for much faster coding and debugging and works on many problems. But there's a whole range of contest problems bomb out in Python:

      1) Large inputs or outputs and short time limits. Python's "print" statement is simply not fast enough for large-output problems.

      2) Billions of booleans. In C++ you would use bitboards and bitarrays, maybe a 100MB worth. Using native Python data structures the memory can run into gigabytes. Using numpy, the bit-twiddling will still be many times slower.

      3) Some problems with tight loops and a time limit is set at a couple times the speed of the author's C or Java solution. Python being 10x slower on such loops takes it over the time limit.

  13. They won't hit the time limit by JamesP · · Score: 1

    Really

    If they hit it, they're doing it wrong or you have the next Rain Man meets Linus Torvalds in your class.

    But if you're worried, I'd say go with Java (what I would say really is go with C# but since you can't do it)

    But python is fine so don't worry.

    --
    how long until /. fixes commenting on Chrome?
  14. Go with an Interpreted Language by Anonymous Coward · · Score: 0

    I think you're interested in teaching the principles, rather than the mechanics of the programming process. If so, avoid steps like compiling - with its time overhead. So, no C-derivative.

    I'd go with an interpreted language in order to get directly to the problem - my guess is that yr stated concern re 'efficiency' is unjustified here. Ideally, it's Pascal for its clarity, but I don't know of an interpreted Pascal. So maybe - a surprise here - PHP.

    AS

    1. Re:Go with an Interpreted Language by Nursie · · Score: 2, Informative

      For relatively simple programs (like a school programming test or competition entry), you can compile the C in under a second. Pascal has almost no commercial use these days and is not going to be a good thing to teach them from a skills perspective.

      That said - python would be a good choice, IMHO

  15. Pascal by jadrian · · Score: 2, Interesting

    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.

    1. Re:Pascal by Anonymous Coward · · Score: 0

      Programming solutions for this kind of problems does not require even knowing about pointers, and even less about OO.

      CPU time limit, as pointed elsewhere, is mostly about catching infinite loops.

      I would suggest teaching a language subset where the kids have the following tools:
      - routines;
      - simple textual I/O;
      - basic imperative programming constructs: variables, assignments, conditional and loops;
      - teach them about basic data types;
      - a safe implementation of strings (not C's char *);
      - a safe implementation of arrays (not C's []);
      - a couple of collections, such as C++ vector, list and set.

      Have fun...

    2. Re:Pascal by slashqwerty · · Score: 1

      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.

      VB.Net* has the advantages you've listed for Pascal and Java, and it solves all the problems you listed for other languages so why not get you started on it? Its only real drawback is that it's a proprietary language. That won't effect the contest.

      *VB 6 is not supported any more, and VBA and VB Script would be absurd suggestions, so the story submitter is obviously referring to VB.Net.

    3. Re:Pascal by buntsai · · Score: 1

      Most people miss the point that python has strong (dynamic) typing.

      As for c++, modern (i.e. good!) c++ code should look very much like python, except that it is statically typed, of course: Pointers should be avoided. No char*, definitely no manual memory management. No "delete"s. Only strings and vectors. Segmentation faults usual indicate that programming skills need to be updated...

      Having said that, I would still recommend python: clean and elegant.

      I started off with Pascal but it is a strait jacket of a language. Too old fashioned for this day and age. It is curious that Pascal has aged so much more badly than Lisp.

    4. Re:Pascal by Undead+Waffle · · Score: 1

      Don't use VB anything unless you hate these kids. I haven't used VB.Net but if it bears any resemblance to VBA and VBScript whatsoever stay far away.

    5. Re:Pascal by nmb3000 · · Score: 1

      As for c++, modern (i.e. good!) c++ code should look very much like python, except that it is statically typed, of course: Pointers should be avoided. No char*, definitely no manual memory management. No "delete"s. Only strings and vectors. Segmentation faults usual indicate that programming skills need to be updated...

      You're kidding, right? If you think "good" C++ code avoids all use of pointers, new and delete then you have obviously never worked on a project of any meaningful size or scope. Pointers and heap allocation methods are very much part of "good" C++ code.

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
    6. Re:Pascal by Amanieu · · Score: 1

      Actually VB.Net is quite different from VB6/VBA/VBS. It's basically C# with a VB-like syntax.

    7. Re:Pascal by Undead+Waffle · · Score: 1

      Well I would argue that VB's syntax is trash and should have been killed off long ago, but I guess that's subjective. Anyway, thanks for the clarification.

    8. Re:Pascal by Logic+and+Reason · · Score: 1

      If you think "good" C++ code avoids all use of pointers, new and delete then you have obviously never worked on a project of any meaningful size or scope.

      He didn't proscribe "new" specifically, so I'm guessing he meant no manual memory deallocation. That also explains the "no pointers" thing, assuming he was referring to raw pointers.

    9. Re:Pascal by RAMMS+EIN · · Score: 1

      ``Its only real drawback is that it's a proprietary language. That won't effect the contest.''

      You mean requiring kids to install a huge blob of closed-source software just so they can participate in the contest isn't a problem? Perhaps you don't have a problem with that, but I do. I don't think it's right to force software on people, much less if there are other languages you could choose that leave the kids free to choose the implementation they want to use.

      --
      Please correct me if I got my facts wrong.
    10. Re:Pascal by RAMMS+EIN · · Score: 1

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

      "A bit more complicated"? Java has grown to where any real-world program involves so many concepts that I wouldn't burden a beginning programmer with that. It's widely used and seems to be here to stay, so if the contest allows multiple languages, I think Java should certainly be one of them, but I sure hope it wouldn't be the only language allowed. It's just too complex.

      --
      Please correct me if I got my facts wrong.
    11. Re:Pascal by cbhacking · · Score: 1

      I'm actually somewhat surprised that of the (wide variety of) languages that can run on .NET / Mono, the only major one they're missing is the language that was built for the framework. C# is basically Java with more C-like syntax (namespaces, the use of : for inheritance, etc.), fewer restrictions on what you can do (stack-allocated objects, unsigned types, et.c), fewer stupid restrictions (multiple public classes per file allowed, or one class across multiple files, no requirements of classname = filename or directory structure = namespace structure), fewer legacy hacks (generics, I'm looking at you), and the ability to use pointers if you *REALLY* want to.

      VB.NET is typesafe and statically typed (I think you could force VB6 to do the same, not that it matters), and its syntax is, well, BASIC. Love it or hate it, it's undeniably simple and quick to pick up. Although technically proprietary, Mono has a pretty good implementation of the language; aside from a few intrinsic functions carried over from legacy VB (most of which have .NET/Mono library equivalents) it's not that hard to compile or run once you've got a working Common Language Runtime.

      For Python, I suppose they probably want the reference implementation (CPython) but IronPython is also quite a good implementation, and has become fairly popular. I wouldn't be surprised if it's the 3rd-most common CLR language after C# and VB, although C++ might have it beat there.

      C++ is not a language I would suggest starting on, although it's a valuable one to know. It also makes for pretty seamless interaction between managed and unmanaged code, if you want to link it into the CLR... but for a project like this it's not the right choice, I think. Too much weird syntax, too much potential for obscure error messages, and while you *can* avoid the issue of manual memory management I would not choose C++ as my language of choice if I'm working entirely with memory-managed code.

      --
      There's no place I could be, since I've found Serenity...
    12. Re:Pascal by jadrian · · Score: 1

      True, I did not phrase it very well. Of course Java is huge, but you for this purpose you can strip it down to a much smaller language that is not too complicated, although still not as simple as Pascal.

      As another example, I'd probably take Scala over Pascal, and would argue you can easily work with a Pascal like restriction of Scala with very very clear syntax and semantics.

    13. Re:Pascal by Anonymous Coward · · Score: 0

      > C# is basically Java with more C-like syntax (namespaces, the use of : for inheritance, etc.), fewer restrictions on what you can do (stack-allocated objects, unsigned types, et.c), fewer stupid restrictions (multiple public classes per file allowed, or one class across multiple files, no requirements of classname = filename or directory structure = namespace structure), fewer legacy hacks (generics, I'm looking at you),

      I believe the word you were looking for was 'C++-like', not C-like. Although maybe C has changed since I last used it and now has inheritance, objects, classes, generics...

    14. Re:Pascal by cbhacking · · Score: 1

      Are you seriously comparing a modern language that supports OOP or procedural code with structured exception handling and runs on a cross-platform garbage-collected type-safe JIT-compiled runtime to
      A) A language primarily used to write macros in Excel and becoming obsolete even there,
      and
      B) A scripting language which is already quite obsolete?

      Don't use Java/C#/Python anything unless you hate these kids. I haven't used Java/C#/Python but if they bear any resemblance to K&R C or ADA 83 whatsoever stay far away.

      I generally hate this meme, but seriously, fixed that for you. Languages are often a *lot* better than their predecessors, let alone the special-purpose offshoots of said predecessors.

      --
      There's no place I could be, since I've found Serenity...
    15. Re:Pascal by jgrahn · · Score: 1

      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.

      It's also useless in the real world. I haven't seen Pascal since 1996 (VaxPascal, which my C code was to replace).

      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.

      Yes, it's pointers. But correctly taught they aren't too hard to understand. I don't believe C is a good beginner language, but the concept of pointers is not the reason

      Same for C++.

      That makes me think you haven't seen C++ since about the time I saw VaxPascal. You can get a long way without pointers, if you stay away from the C compatibility parts.

  16. 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?
    1. Re:Go With Your Gut by Anonymous Coward · · Score: 0

      UThe exercise is as much about allowing them to test the programming waters as it is about them winning.

      Agreed. You should view this as an exercise for the edification of your students, not a die-hard competition. If you think your students will be more interested in and better able to comprehend Python, then that's what you should teach them. Any kind of penalty that hinders their chances of victory is at best a secondary concern.

    2. Re:Go With Your Gut by ignavus · · Score: 1

      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.

      Who knows? There might be a prize for getting the biggest memory leak.

      --
      I am anarch of all I survey.
    3. Re:Go With Your Gut by Anonymous Coward · · Score: 0

      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.

      Novices? In the hands of experts in a timed activity, it's more trouble than it's worth!

      Using C or C++ at all is usually a case of premature optimization being the root of all evil. Sadly, the time limit seems to reinforce the idea that premature optimization might be required.

      I think it's a great shame they don't allow you to use any language you like. I would go for Common LISP myself :)

    4. Re:Go With Your Gut by Anonymous Coward · · Score: 0

      Where do you download the gut compiler from?

    5. Re:Go With Your Gut by Monkeedude1212 · · Score: 1

      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.

      What do they mean "End of statement expected"?

      Oh right. I forgot the Semicolon.

      Now I've got 4 other errors by puting in that semicolon. Better take it away again.

  17. If Python is an allowed choice then... by Frequency+Domain · · Score: 3, Insightful

    Any CPU limits should be generous enough to accommodate correct solutions in any of the permissible languages.

  18. No option of Fortran? by zebadee · · Score: 1

    The forgotten language....... For numerical stuff it still works great.

    1. Re:No option of Fortran? by zippthorne · · Score: 1

      Fortran is great, if you use the appropriate wrapper. i.e. MATLAB...

      --
      Can you be Even More Awesome?!
    2. Re:No option of Fortran? by Stephen+Tennant · · Score: 2, Funny

      But then he must add a module for maintaining neckbeard

      --
      I spend most of my time in bed, darling.
    3. Re:No option of Fortran? by colinrichardday · · Score: 1

      Given that they are students, he may need to add a module for creating neckbeards.

    4. Re:No option of Fortran? by BigFootApe · · Score: 1

      They'll just have to learn how to write FORTRAN in any language. Soon enough, they will become a Real Programmer.

      A valuable lesson, really.

  19. Python will give you th least problems by gweihir · · Score: 4, Insightful

    C, C++ and Java are not an option. They all need years to master and have numerous non-obvious pitfalls. Pascal is pretty limitad and definitly a historic design. PHP is obscure in palaces. Visual Basic still is a bad joke, confined to just one platform and wioth numerous design problems.

    On the other hand Python is fine, with the only thing to master the indention. Not on the list, but Ruby would also be nice. And for a minimalistic, yet powerful language, loot at (again not on the list) Lua.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    1. Re:Python will give you th least problems by Samah · · Score: 2, Insightful

      And for a minimalistic, yet powerful language, loot at (again not on the list) Lua.

      You beat me to it. Lua is ridiculously easy to pick up and will give the students a chance to worry about actual algorithms and lateral thinking rather than jumping straight into OOP. For the uninitiated: Lua does not natively support a polymorphic OO environment but it is very easily implemented with metatables.

      Disclaimer: I'm a Lua fanboy. :)

      --
      Homonyms are fun!
      You're driving your car, but they're riding their bikes there.
    2. Re:Python will give you th least problems by Undead+Waffle · · Score: 1

      C, C++ and Java are not an option. They all need years to master and have numerous non-obvious pitfalls. Pascal is pretty limitad and definitly a historic design. PHP is obscure in palaces. Visual Basic still is a bad joke, confined to just one platform and wioth numerous design problems.

      On the other hand Python is fine, with the only thing to master the indention. Not on the list, but Ruby would also be nice. And for a minimalistic, yet powerful language, loot at (again not on the list) Lua.

      So I've gotten from this post that PHP is fine as long as you're not coding in palaces and Lua contains other programming languages if you loot it.

    3. Re:Python will give you th least problems by dunkelfalke · · Score: 3, Insightful

      Pray tell me how a modern Pascal dialect (as used by Free Pascal Compiler for example) is "limitad".

      --
      "It's such a fine line between stupid and clever" -- David St. Hubbins, Spinal Tap
    4. Re:Python will give you th least problems by TheDarkMaster · · Score: 1

      There is a really good reason for Ruby not be listed. Just look at the benchmarks it against other languages. And again, I would like to remind that no language can become a incompetent developer able to make good software.

      --
      Religion: The greatest weapon of mass destruction of all time
    5. Re:Python will give you th least problems by magus_melchior · · Score: 1

      Not on the list, but Ruby would also be nice.

      I'm sure someone mentioned this (and if there's a comment to this effect, mod Redundant please), but the contest regs rule out Ruby and Lua. Considering it would waste time and concentration in this context, so I'd stick with Python.

      Still, it would be nice to see at least 4 more languages, like the aforementioned Ruby, Lua, Lisp (and/or a derivative), and one less mainstream language like Haskell or Ada. That they're including VB and PHP but not any of these is a little disheartening, though not surprising-- programming curricula are not known for creativity.

      --
      "We are Microsoft. You shall be assimilated. Competition is futile."
    6. Re:Python will give you th least problems by LCValentine · · Score: 1

      PHP is obscure in palaces

      I miss PHP's obscure palaces. Once I get to level 6 I'm sure there will be more though!

    7. Re:Python will give you th least problems by gweihir · · Score: 2, Insightful

      Well, scripting is not about execution speed, but development speed. You are of course right on the developer angle. Language, process, design method, etc. cannot cause incompetent developers to create good software. That is just the vision by incompetent management (of which there is a lot), because they would like to treat developers as exchangeable components, not individuals that are, on to bottom line, possible worth a lot more than they are.

      However, language can stand in your way, making development more complicated. For compentent, experienced developers, this will just increse development time and increase the number of bugs. For inexperienced developers, it can be catastrophic.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    8. Re:Python will give you th least problems by obarel · · Score: 2, Insightful

      I'm also a Lua fanboy, but for motivation and inspiration I'd use Python and not Lua.

      Just think about this problem: how do you get a directory listing in Lua?

      Lua doesn't have an immense standard libraries. Even though it's extremely powerful, the power is in the flexibility, not in the environment. Of course, there are many many libraries that you can pretty much download and use (depending on OS, of course), but it still doesn't come "batteries included" like Python.

      Also, Lua is very simple to learn, but even then you have to know a bit before you can have some fun. Compare:
      Lua: for _,v in ipairs(list)
      Python: for x in list

      Even for basic loops you have to call a function.

      Compare:
      Lua: print(string.format("Your age is %d", age))
      Python: print("Your age is %d" % age)

      Even for basic output you have to call a function.

      Lua is fantastic, I've used it in many projects - at work and at home. But in my opinion Python is better for "get something working quickly" (i.e. the modern, much much better, equivalent of BASIC as a first language). As my "scratchpad" / calculator / quick eval-print-loop I always use Python.

    9. Re:Python will give you th least problems by Anonymous Coward · · Score: 0

      First the OP says any language and then supplies an arbitrary list of acceptable languages.

      Huh ? I bet his students will be equally puzzled.

      Honestly scheme or squeak would be the best choices imo

    10. Re:Python will give you th least problems by Anonymous Coward · · Score: 0

      var Pascal : Limitad

  20. Performance isn't the most important issue by urusan · · Score: 1

    Despite the performance issues, Python is still useful for a huge number of things. The performance issues are generally only a problem for HPC, high-throughput server programs, and high-end gaming. I would be less worried about that and more worried about what impact it will have on the students.

    In this context, the main advantage of Python over C/C++ is that it's a relatively fun language and will be more likely to catch the attention of the students. It will allow them to take on more complex (and interesting) projects in a shorter time. It would also be more valuable to future non-programmers, who could use it for scripting.

    On the other hand, it seems to me that those students that are going to be programmers in the future would be better off being exposed to things like static typing and pointers. C would be much better in this regard, so if the students are being tracked towards programming majors then it would probably be a better choice.

    1. Re:Performance isn't the most important issue by Undead+Waffle · · Score: 1

      Anyone going into a programming major will at one point or another be exposed to C or C++ unless their university is garbage. I do agree that showing them static typing and memory management early is good, but it doesn't need to be their first exposure to programming.

  21. Programming time is more important than CPU time by UTF-8 · · Score: 1

    I participated in an ACM programming contest once, and you're not looking at the time issue correctly. I remember one problem that involved complicated time calculation that was impossible with writing in C/C++ from scratch on short notice, but it's easy with the Gregorian calendar class in Java. Good programmers can handle any mainstream language syntax, but the capability of the language and its libraries are much more important when programming time is even more important.

  22. Pthon, definitely by cheese1756 · · Score: 1

    While I wish I could say Java, I think that Python is easier to teach for beginning programmers. If the kids have some experience, though, you should teach them Java or C++.

  23. Ask them by igotmybfg · · Score: 2, Interesting

    Explain the situation to your students; give them the options available with pros and cons for each; and let them decide for themselves.

    1. Re:Ask them by dgym · · Score: 1

      To give them a reasonable chance of making a good decision make sure they understand that when development time is limited C is rarely going to produce the fastest results.

      Given the obvious (and hopefully obviously wrong to anyone with experience) observation that C is harder to program but runs faster, and Python is easy to program but runs slower, I think a lot of people would go for C because it seems to be better placed for winning the competition.

      However, code normally has bottlenecks, so 95% of run time will be spent in 5% of the code. Optimizing the parts that aren't bottlenecks is a severe waste of time, and will surely affect your competition results. Anyone who knew what they were doing and wanted to win would (1) write the bulk in a high level language, (2) use a profiler and identify the bottle necks (3) spend their time trying to find better algorithms at the bottle necks, (4) finally optimize the code at the bottlenecks, pushing it to a lower level language if skill and time allowed.

      Going with the OP's original inclination would work well here. Python can be used for stages 1-3 and will give students time to try more algorithms on the all important stage 3. For stage 4 you can use c to create a dll/so and use the ctypes library to drive it directly from Python. If anyone stumbles at this stage then it isn't too much of a problem, they already have a viable entry they can submit and be proud of from the end of stage 3, this extra bit is just for the really talented to go for 1st place.

      Not only would this approach give the students an advantage in the competition, but also a really good idea of how to tackle projects in the real world too.

  24. Stick with Python or Java by offrdbandit · · Score: 1

    If you have students just beginning, the most important thing you can do to help them is to introduce them to a language/framework they can tinker with themselves. C and C++ can be problematic if the students run Windows at home. Be honest. If the students have as little experience as you say, the students will get far more benefit from becoming familiar with a language they can use at home, on the weekends, or whenever they feel like tinkering than they will being shoehorned into using C to fit under a competition's "CPU limit". Disclaimer: I have no personal experience with VB or Pascal, so I didn't comment on them.

  25. Python+shedskin by correnos · · Score: 0

    Program it in python, then use shedskin if you find processing time starts to become an issue.

  26. Think long term by sictransitgloriacfa · · Score: 1

    After the test has come and gone, will they still be interested in programming? Only if they've had fun doing it. For that you want something they can learn quickly and do significant projects with. In short, Python.

  27. Do some testing by boxie · · Score: 1

    Look at the questions from previous years and implement some of them in python and see if your going to have run time issues.

    if you have no issues, then chances are the kids are not either (since your teaching them, they will code in your style until they learn their own)

    --
    A Tale of 2 idle hands
  28. Python would be my choice by collywally · · Score: 2, Informative

    I tried teaching my self some Python a while back and found it very easy. The only experience that I had before in any computer language is MEL (Maya Embedded Language). I bought a book called Game Programming (Publiser: Wiley, ISBN 978-0-470-06822-9) and over my two week Christmas break I was able to build a nice little top down shooter with programmer graphics.

    It uses the pyGame library for most of the heavy hitting (like writing to the screen and the like) but it also introduced me to Objects and Classes as well as how to think in small steps to help break down what I was trying to do.

    I always suggest this book to artists that I meet who wants to get into scripting. And most of them who have borrowed it end up buying it for themselves when thay have to give back my book.

  29. Probably Java (Bleh) by pookemon · · Score: 2, Interesting

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

    --
    dnuof eruc rof aixelsid
    1. Re:Probably Java (Bleh) by TheDarkMaster · · Score: 1

      I agree with you. I too think the Java is a powerfull tool to create bloated, slow and memory-hungry apps, with junk-like IDEs to play (sorry guys, Eclipse is nowhere near the Visual Studio). But, unfortunately the labor market uses it a lot.

      --
      Religion: The greatest weapon of mass destruction of all time
    2. Re:Probably Java (Bleh) by xiong.chiamiov · · Score: 1

      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.

      There will also be a shitton of "Java programmers" churned out by the current schooling system. There's more than enough competition to go around.

  30. No Perl ? by Anonymous Coward · · Score: 2, Insightful

    Probably because there would already by a module that solves the problem.

  31. How about the simplest of languages?... by javabandit · · Score: 2

    Brainfuck.

    1. Re:How about the simplest of languages?... by Anonymous Coward · · Score: 0

      Brainfuck.

      Whitespace would be a good alternative

    2. Re:How about the simplest of languages?... by Anonymous Coward · · Score: 0

      Or, if you're not too concerned about readability, you could go for Whitespace: http://en.wikipedia.org/wiki/Whitespace_(programming_language)

  32. Looking Beyond AOI by carlzum · · Score: 1

    The FAQ says the International competition offers fewer options, "Note that at the IOI only C, C++ and Pascal are permitted." If you're only considering the AOI, Python seems likes the most efficient, portable approach.

  33. Perl !! by QX-Mat · · Score: 3, Insightful

    Perl is very simple to learn (check out "Robert's Perl Tutorial"). Perl allows the programmer to do what he wants - regardless of the style. There's even English.pm. Perl has many upsides ie: it's a powerful parser and indispensable toolkit... and highly embeddable. If there was ever a seed language to learn, it's Perl.

    There's also the fact that Perl programmers are real unix men - and let's face it, you'd rather have real unix graduates than Ruby fannies?

    1. Re:Perl !! by LodCrappo · · Score: 3, Insightful

      I'm a big fan of Perl myself but I wouldn't recommend it for new programmers. The phrase "enough rope to hang yourself" doesn't begin to describe it. It's also probably a bad choice in this scenario because it isn't on the list of accepted languages, although if you were decently skilled I'm sure you could write one liner to translate your perl source into any one of the accepted list.

      --
      -Lod
    2. Re:Perl !! by henni16 · · Score: 1

      If the real unix men's attitude is "Sorry, I can't hear the specification over the sound of how awesome Perl is" and they ignore the requirements at hand to produce a really awesome Perl program that can't be executed in the target environment, I would rather give those fannies a chance.

    3. Re:Perl !! by palegray.net · · Score: 2, Funny

      although if you were decently skilled I'm sure you could write one liner to translate your perl source into any one of the accepted list

      Not necessary, just do this:

      #!/usr/bin/python
      import os
      lulz = os.system('perl myprogram.pl')


      Look, it's in Python! :)

    4. Re:Perl !! by Anonymous Coward · · Score: 0

      Perl is very simple to learn (check out "Robert's Perl Tutorial").

      "Easy to learn, hard to master." is a compliment for games, but not for programming languages.

    5. Re:Perl !! by Anonymous Coward · · Score: 0

      Perl allows the programmer to do what he wants - regardless of the style

      So long as the name of their style includes the word "obfuscated" somewhere in it.

      LISP is the One True seed language.

    6. Re:Perl !! by lucian1900 · · Score: 1

      No, you didn't just suggest Perl...

    7. Re:Perl !! by sreservoir · · Score: 1

      don't. can't you see it's ten years old?

  34. Hello World by gd2shoe · · Score: 4, Funny

    On the plus side, you could make a really spiffy "Hello World".

    --
    I won't join Slashcott. OTOH, If Beta goes live, I just won't be back until it's fixed. Sorry Dice.
  35. Forget the higher level languages by dynchaw · · Score: 1

    If you want to give these kids a solid foundation to build on that will instill good habits and understanding of how computers work - C.

    Java runs on top of an engine written in C - same with Python. They're great for doing that they do which is providing a massive library to take out all the menial tasks, but those menial tasks are the ones that teach people how everything works in the first place. How do they become a menial task if no one ever learned they were there?

    Do we teach calculus without first teaching numbers and then general addition, subtraction, multiplication, division, etc etc etc

    I have spent years beating the bad habits of Java out of programmers. Garbage collection is all nice and wonderful but it prevents programmers from having to think about memory at all. Taking that Java programmer and trying to get them to write even simple C/C++ code or even something as basic as assembler is damn hard! Everything they have learned has to be re-grounded. It's like boot camp - break them down to so they can be built up into something useful.

    It's easy to teach someone who knows C how to write C++, Java, Python, or the zillion of other languages out there.

    1. Re:Forget the higher level languages by binarylarry · · Score: 1

      C isn't really representative, at all, of how computers work. If you want that, teach them assembly language.

      Java is typically running on a VM written in C++ and Java. It's not really similar to CPython's runtime at all, it's more like Psyco.

      --
      Mod me down, my New Earth Global Warmingist friends!
    2. Re:Forget the higher level languages by Anonymous Coward · · Score: 0

      If you want to give these kids a solid foundation to build on that will instill good habits and understanding of how computers work - C.

      I assume you meant to say 'machine language'.

    3. Re:Forget the higher level languages by anonymousbob22 · · Score: 1

      Java is typically running on a VM written in C++ and Java.

      It's Java all the way down?

  36. Langage for Programming Competition by Students by Anonymous Coward · · Score: 0

    BASIC... Beginners All-Purpose Symbolic Instruction Code. Anny student can become proficient in BASIC within a couple of weekends while gaining the self-confidence to tackle a variety of programming challenges during the competition. Python has the stupid whitespace as indentation issue. Java is a horrid language for beginners due to its comlexity.

  37. Python or Java by M.+Baranczak · · Score: 3, Insightful

    I assume you want something that'll give the kids an advantage in the competition, and be useful if they want to start programming seriously.

    Pascal - it was nice back when Reagan was in the White House and Michael Jackson still had his nose, but it's obsolete.

    PHP is for writing dynamic web pages. It's good at what it does, but it isn't really a general-purpose language.

    C and C++ are faster than interpreted languages. That is, sometimes they're slightly faster. And they're almost always harder to write in.

    VB? Go fuck yourself.

    So that leaves Java and Python.

    1. Re:Python or Java by FyRE666 · · Score: 1

      I'm interested in hearing your theory on why PHP is not a general-purpose language. Especially since it's capable of being used for web, command-line and GUI applications. As for C/C++ sometimes being slightly faster, well there's a reason any application requiring high performance is written in these languages - they're often more than a little faster. I shudder to think how MW2 would run if written in Python...

      Aside from this, Java or C++ would get my vote - bigger potential employment market.

    2. Re:Python or Java by Xest · · Score: 0, Flamebait

      PHP for anything other than web stuff is a bad idea simply because PHP is just a horrendously bad language, it's truly awful. The only reason you'd use it on the web is because it's so well supported in terms of libraries and so forth, and generally available on cheap hosting options.

      It doesn't have these advantages outside the web- the libraries aren't as common or well tested, and it's less available on say, desktop PCs than Java, .NET or native binary support is. Examples of problems with it are it's terrible hacked on OOP support, lack of proper namespaces, clunky syntax. Why would you put yourself through that when you can just use C, C++, Java, or one of the .NET languages? It's best to just leave PHP where it belongs.

      C/C++ may be more than a little faster than Python certainly, but they're barely faster if at all than Java/JVM or C++,C#,VB,etc./CLR. See this site, which is now 6 years old (things have moved on even more since then) to better understand why C/C++ do not have much of an advantage in performance anymore, and have no advantage whatsoever when you factor in ease of development against performance:

      http://www.idiom.com/~zilla/Computer/javaCbenchmark.html

      The idea that things that require high performance are written in C/C++ is a little bit of a straw man. Games are written in C++ because it's the only langauge that's portable across the Wii, the PS3, the Xbox 360, the PC, Mac, Linux and because it's what companies have been using for decades and as such have millions of lines of libraries written for and have developer teams skilled up in. It's certainly not about performance nowadays, head to java.com and look up their case studies list for high performance computing for example. The fundamental problem is that when you compile C/C++ code you're generally compiling for a generic chipset so that's the best that the compiler can optimise for, with VM based languages like Java and the .NET languages, they use JIT compilation so that the bytecode is compiled into natively executable code and optimised for the specific abilities of the system on which it is being run- this gives it an inherent advantage in terms of optimisation because it does not have that disadvantage of needing to be generic enough to run on any compatible system like compiled C/C++ generally does. You could get the same benefits with C/C++ and allow it to keep it's slight edge by distributing an executable optimised for each type of AMD processors with 1gb, 2gb, 3gb, 4gb RAM and so on and then the same for Intel and other factors, but you get a combinatorial explosion of the amount of executables you'd need to distribute and the user would probably struggle to know which one to use.

    3. Re:Python or Java by Xamusk · · Score: 1

      You forgot the most important fact in you advantages list: with Python, lists are a built-in type. Which pretty much means you have built-in powerful sort, without the need for importing nothing, and some other useful methods. Also, it has built-in strings, with many built-in methods. That pretty much covers many of the problems writing competition software, and definitely will give an edge, since properly programming those algorithms take a lot of time.

    4. Re:Python or Java by lucian1900 · · Score: 1

      Java is horrible for beginners and too restrictive for experts. So that leaves Python.

    5. Re:Python or Java by M.+Baranczak · · Score: 1

      Sorry, you're not making any sense. First of all, I didn't write a list of advantages, but a list of disadvantages. Strings? Every language developed in the last 40 years has them. And all of the languages on our list except C and Pascal include some sort of list type as part of the standard libraries.

    6. Re:Python or Java by Xest · · Score: 1

      If Java is horrible for beginners and too restrictive for experts, then why is it both the most popular teaching language, and the most popular business language? See here:

      http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

      What exactly is it about Java that makes you think it's too restrictive for 'experts'?

    7. Re:Python or Java by M.+Baranczak · · Score: 1

      I didn't get that either. I can see how Java is more restrictive than C (and most of the time, that's a good thing), but how is it more restrictive than Python? Is it the static typing?

    8. Re:Python or Java by Xest · · Score: 1

      Even then there's the Java Native Interface though, so even worst case you can do anything in Java that you could do in C.

      Of course, if you were using Java in the first places then you really wouldn't want to, because as you say, Java's restrictions exist for good reason.

    9. Re:Python or Java by lucian1900 · · Score: 1

      It severely lacks the level of expressiveness found in other languages, like Ruby or Python. It forces object orientation without doing it properly (classes and methods aren't objects). Calling C code is indeed very hard without JNA.

    10. Re:Python or Java by lucian1900 · · Score: 1

      It because so popular in the industry because of marketing. It is the most popular for teaching because it is popular in the industry. By its merits alone, it would not be used as much.

    11. Re:Python or Java by Xest · · Score: 1

      Ah, so your comments are based entirely on some completely unfounded theory?

      Do you really not have any actual solid evidence to back up your point? I think you'll find that most 'experts' are happy using Java, because it's the best tool for the job- if you can find any other cross platform, language with as big an abundance of solid, secure, well tested libraries, and with as secure a virtual machine that performs well as C++ in the majority of cases then let me know.

      The problem is, you wont find such things, hence why Java is the language of choice. The closest you've got is C#, the CLR and .NET which is IMO a better language, but is limited to Microsoft only so loses a lot of points for that.

  38. Stooge sort by davidwr · · Score: 1

    I've yet to see a Stooge Sort that works well with n>4. Fortunately, I've never seen an input size > 4 so it's kind of moot.

    Maybe if they had Moe Stooges this would be a problem.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
  39. assembler by swigabyte · · Score: 1

    Go with assembler.

    1. Re:assembler by binarylarry · · Score: 1

      I think you mean "assembly." ;)

      --
      Mod me down, my New Earth Global Warmingist friends!
  40. javascript - jsdb by Anonymous Coward · · Score: 0

    www.jsdb.org

  41. Just my opinion. by TaggartAleslayer · · Score: 1

    I'm a proponent of teaching C/C++. If you know those, you can learn Python, Java and PHP. Visual Basic is not a consideration nowadays.

    Regardless of language, teach proper logic. A good coder in any language will have a better run time than a bad coder in any language.

    As a person in a place to teach, I truly urge you to teach logic before syntax. Logic before language. It's very important.

  42. Be aware of prohibited stuff by azh · · Score: 1

    Be aware if your language choice is based on build-in constructs, such as C++ vector. They sometimes are prohibited. Though if you are allowed to use standard library choose the language with the most powerful one/best known to you. In this case you will never face a need to recall quicksort algorithm, but simply call sort() method which is faster than everything you probably can write.

  43. Just pick whatever you want by Anonymous Coward · · Score: 0

    If you're going to run into a time limit at a programming contest, you're not doing it right. If you have a good algorithm, it shouldn't matter - the judges will make sure that their reasonable algorithm wont hit time limit bounds on any problem.

  44. Boy you're going to get lots of replies by v1 · · Score: 1, Interesting

    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.

    --
    I work for the Department of Redundancy Department.
    1. Re:Boy you're going to get lots of replies by BoppreH · · Score: 1

      Command line easiest? really?

      What you probably know as "python" is actually the Python Interactive Interpreter. This tool is used only when you need to make a quick "import os; dir(os)" call to make sure that you are spelling a function name correctly, or when your friend REALLY wants to know how much is 3^21.

      The actual use of python consists of text files with .py extension, working just like any other interpreted language.

    2. Re:Boy you're going to get lots of replies by LodCrappo · · Score: 1

      If the only goal is to get these kids doing well in the contest, I agree that VB might have some merit, although there are IDEs for other languages that provide similar tools.

      However, if the instructor also intends to give these kids skill with something they could actually use later in life, VB seems a poor choice compared to almost all of the others (Pascal being an obvious exception).

      --
      -Lod
    3. Re:Boy you're going to get lots of replies by v1 · · Score: 1

      However, if the instructor also intends to give these kids skill with something they could actually use later in life, VB seems a poor choice compared to almost all of the others

      You would be amazed at how many big titles are written in VB (windows) and RB (macintosh). Heck, our store's POS system is written in RB. (though they don't advertise it as such!) It's out there, all over the place. It just has a bad rep on being a kiddy language and so the publishers don't tend to brag it up.

      My hobbies tend to shift around, but a few yrs back I was writing commercial-grade apps in RB. I'm fluent with more programming languages than most devs can list off, (college focus was on programming languages in general, learn them all) and nothing beats RB/VB for rapid prototyping, which is basically what timed programming contests demand.

      --
      I work for the Department of Redundancy Department.
    4. Re:Boy you're going to get lots of replies by Anonymous Coward · · Score: 0

      Really a story on slashdot that triggers over zelous responses advocating people favourite programming language? That's be a first.... NOT

    5. Re:Boy you're going to get lots of replies by JMZero · · Score: 1

      For industry/career use, VB.net is perhaps not a top choice - but it is not altogether unused. And, in any case, the important concepts learned in this kind of contest will be language independent.

      And, yeah, VB is really easy to teach: great IDE, magically good edit-and-continue, simple debugging options, simple syntax, no worries about object lifetimes, intuitive handling/conversion of strings and integers, and a good set of generic lists, dictionaries, hashtables, etc that are reasonably easy to use...

      (Of course, there's still a few real "gotchas" that are likely to come up in a programming competition: no bignums, goofy array syntax, automatic type conversion with division, no short circuiting by default, sometimes unintuitive operator precedence... but nothing that can't be gotten around or debugged through relatively simply).

      --
      Let's not stir that bag of worms...
    6. Re:Boy you're going to get lots of replies by Novus · · Score: 1

      While the event-driven approach used by VB is often useful, especially in GUI programming, it is not really relevant for a programming competition that focuses almost entirely on designing and implementing an algorithm to solve a small, specific problem. Even the "interactive" tasks tend to be of the form "read a line of input, update data structures, output new state".

    7. Re:Boy you're going to get lots of replies by v1 · · Score: 1

      I'll have to agree with that... most programming contests do not involve interactive interfaces. But I have seen a few examples. Things like "accept entry of a list of xxxx and produce xxxx. the following are legal inputs xx xx xx xx, all others should be rejected."

      This is unfortunate however, as a serial interface is so much less desirable than an actual even-driven nonlinear one. Except in data-entry applications, for almost any other operation non-linearity is preferred. I personally can't stand using forced-linear applications where they're not necessary. Gives the contests and their students a poor idea of what to strive for in a user-friendly application.

      --
      I work for the Department of Redundancy Department.
  45. Multiple modern ones... by Anonymous Coward · · Score: 0

    Ruby, Python, Erlang, ARM Assembler.
    Have fun.

  46. Good Language Choice? by martas · · Score: 0

    I'd start by avoiding Fuck, Shit, Damn... you get the picture.

    1. Re:Good Language Choice? by Anonymous Coward · · Score: 0

      The results of the "Lamest joke this week" contest just came in. You got it!

  47. A wiseguy, eh? by Anonymous Coward · · Score: 0

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

    That depends. If you're putting Moe in front of Larry, or if you're putting Larry in front of Curly. And if you add Shemp, well then, you start getting into reeeeaaallly intersting stuff! Nyuk,nyuk, nyuk. Woowoowoowoowoo.

  48. Logo by Anonymous Coward · · Score: 0

    If you have not yet considered Logo yet, perhaps you should do. The language itself as a procedural language, combined with turtle graphics can not only provide instruction but visual feedback as well which IMO is important to students these days. If they can see cause and effect it keeps them interested for longer.

    1. Re:Logo by Anonymous Coward · · Score: 0

      ICHTST

  49. almost had it by NEDHead · · Score: 1

    I put together a really great algorithm to weigh the available choices and their tradeoffs, but I ran out of cpu cycles before mom sent me to bed.

  50. 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.
    2. Re:surely not; Pascal was meant for this by grae · · Score: 1

      This is a student's programming contest, right? Why are you even concerned about compile time or "startup" time?

      As far as compile time goes, if any sort of program you can write to solve a toy problem that's one of the problems in a competition like this actually takes a long time to compile (remember, you're not actually allowed to include that much code, according to the rules) you're doing something weird.

      As far as "startup" time, I'm assuming how much time you mean the interpreter takes to start, which seems like even less of an issue, because the rules explicitly state that the time limit might be increased, at the judges' discretion, for interpreted languages.

      Your classification of speeds might be relevant for some sort of question other than "what language should I use for this programming contest?" but given the rules of this particular contest, I think a better characterization of what is "slow" and "not slow" depends on whether the student can manage to code an efficient solution.

      These days I would probably choose python for something like this, even though Pascal was my first language. Python's used a bit more extensively than Pascal, so you might as well teach something that will have applicability outside of the bounds of a contest (it also happens to be a fairly easy language to learn, and for people used to developing in interpreted environments, allows for quicker development time because of the lack of a compile phase in the testing cycle.)

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

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

      You have missed out the most important point for a programming competition:

      • Implementation (actually writing and debugging the code): Python craps all over the others probably.

      Pascal is a great language for teaching the concepts of programming, but the task here is not just to do that but to be able to get a team together for a programming competition and there's only a couple of months available. C and C++ would be even worse since in two months, they will still be trying to cope with buffer overruns and double frees and all the other gotchas that C and C++ have.

      Java would be OK, but Python is more expressive, so I'd go for Python in this instance.

      --
      All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
    5. Re:surely not; Pascal was meant for this by pantherace · · Score: 1

      Where's fortran in that?

    6. Re:surely not; Pascal was meant for this by Just+Some+Guy · · Score: 1

      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.

      You just had to slip that in there, didn't you.

      By the way, winning felt even better. ;-)

      --
      Dewey, what part of this looks like authorities should be involved?
    7. Re:surely not; Pascal was meant for this by goombah99 · · Score: 1

      f2py is a match made in heaven. Fortran 77 is a very fast and very simple memory model. it's hard to make typographic errors in fortran that will execute (e.g. no == ). and it compiles lightning fast.

      but fortran 77 sucks for expression of complex ideas that python excels at.

      I often have python write fortran code on the fly, compile it and execute it.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    8. Re:surely not; Pascal was meant for this by Anonymous Coward · · Score: 0

      I agree with the parent, but... uh, I do not think you can teach this kind of thinking AND a programming language in two months part-time to the average "sort of" motivated kid. Not. A. Chance.

      This is algorithms and data structures teaching and a programming language, plus possibly some maths. Even if your kids learn better than the average computer science student, you're still not going to get it done in less than half a year.

      Save yourself the hassle and simply teach them without the competition, then you can also use the best libraries available, no matter what language you choose. You'll then either be able to address things kids really like to do, such as doing some 2D GUI based animations and games and such (presumably with one of the major languages), which will simply be fun or teach them Haskell, Smalltalk, Scala or any other language that is partially or entirely functional and thus allows a very rewarding "assemble program bits by bits without a lot of rewrites" experience even on free style mid-size projects.

    9. Re:surely not; Pascal was meant for this by pantherace · · Score: 1

      What you are describing sounds like Python to Fortran, Why is it f2py then? Not py2f?

  51. You are not experienced. by Anonymous Coward · · Score: 0

    Your assumption that Python is inherently slower than “compiled” languages demonstrates naivety that most mature engineers have moved beyond. I would recommend you avoid teaching others until after you have better educated yourself.

    1. Re:You are not experienced. by Anonymous Coward · · Score: 0
  52. IDE by Trieuvan · · Score: 1

    I think java is the best because it has good IDE (eclipse, netbeans etc...) . Good IDE may help you learn the language quickly write code fast. Btw, top ten in topcoder, 8 use C++ and 2 use java :) http://www.topcoder.com/tc?module=AlgoRank

  53. Re:Programming time is more important than CPU tim by Anonymous Coward · · Score: 0

    Are programming contests measured in time like a few hours? If so, that's a mistake and I would want kids to do that.

  54. You are silly. by Anonymous Coward · · Score: 0

    You realize C was considered “high level” at one point? Your comment about the Java “engine” is likewise baloney. Your post is saturated with ignorance and it is shameful you have positioned yourself to impose any habits on anyone.

  55. Java by syousef · · Score: 1

    + Serious real world scalable language used in both business and science
    + Freely available on a wide variety of hardware -> gives access to any child with any kind of computer
    + Learn OO from day 1
    + Java collections give students access to data structures and algorithms without having to get bogged down in writing them at a low level
    - Never learn to implement those low level data structures in algorithms (but don't forget you have just 2 months!)
    - Slower than C
    - Not as close to the hardware as C

    Overall a decent compromise.

    --
    These posts express my own personal views, not those of my employer
  56. Why no functional languages? by Jeff+Satterley · · Score: 2, Interesting

    Teach the kids Scheme! Seriously, it's a better transition from pure math to programming. (http://www.teach-scheme.org/)

  57. Submitter should have RTFA by BoppreH · · Score: 1
    From the rulebook (pdf file):

    Programs written in Visual Basic, Java, PHP or Python may run slower due to the overhead of the associated interpreters and/or virtual machines. The judges may at their discretion increase the time limits for these languages accordingly. Contestants should note that this will not give these languages an advantage

    That's how contests with multiple language choices almost always work. It's really easy to implement a naive solution in C that performs 10x better than a good solution in Python, even for fairly large inputs.

    With that rule in mind, I say go for Python all the way.

  58. The syntax viewpoint is an oversimplification. by Kaz+Kylheku · · Score: 2, Interesting

    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!

    1. Re:The syntax viewpoint is an oversimplification. by Anonymous Coward · · Score: 0

      Python is two decades old and has an extensive amount of high-profile usage. Yes, the implementation isn't exactly the fastest thing ever, but calling it an "immature language du jour" when it's quite a bit older than a lot of other popular languages and has been used in so many major projects is pushing it a bit. It's hardly the minor toy language you seem to think it is.

    2. Re:The syntax viewpoint is an oversimplification. by sydneyfong · · Score: 1

      In fact, in 99.99% of the problems encountered in these "informatics" competitions, you don't need any memory management. You need to allocate memory (usually declaring a large array or something like that), but you don't need to worry about free() or cleaning up anything.

      The static type system doesn't get in the way either. The input is usually just numbers (frequently integers) and that's what you deal with.

      --
      Don't quote me on this.
    3. Re:The syntax viewpoint is an oversimplification. by Anonymous Coward · · Score: 0

      A Python program with good algorithms will beat a C++ program which uses poor algorithms

      But:

      A C++ program which uses poor algorithms will beat a Python program which uses the same poor algorithms
      A C++ program which uses great algorithms will beat a Python program which uses the same great algorithms
      A C++ program which uses great algorithms will crap all over a Python program that uses poor algorithms

      So in only 1 case out of 4 does Python in fact beat C++.

      Python wins only if the time to implement the great algorithm in Python is significantly less than in C++. Which it almost certainly is, but wall-time-limited coding competitions really exaggerate this aspect.

    4. Re:The syntax viewpoint is an oversimplification. by Anonymous Coward · · Score: 0

      I realize you are quite old (and trust me, I will get off your lawn asap!), but Python is anything but a "immature" language "du jour".

      First, it is around 19 years old (yes, seriously). I would hate to see any language that is 19 years old and still "immature".

      Second, it is used quite heavily by modern Linux distributions as well as large corporations as Google. This tends to indicate is probably isnt a "du jour" technology, as I highly doubt these corporations would invest in something unless they expected maintained use of the product.

    5. Re:The syntax viewpoint is an oversimplification. by Just+Some+Guy · · Score: 2, Funny

      It's sad that the list of languages includes only immature dynamic languages du jour like Python

      I think you meant "du last two decades", as Python's first release was in 1991. What qualifies as "mature" in your opinion? Is it OK to start using ALGOL yet?

      --
      Dewey, what part of this looks like authorities should be involved?
  59. Teach algorithms, not languages by Zillidot · · Score: 1

    These types of programming contests are all about whether you can come up with a clever algorithm for solving the problem. With the right algorithm, CPU time limits should not be a problem for any of the languages; but if you're using the wrong algorithm, you're going to run out of time regardless of what language you use.

    (Note: I was once a contestant in the Australian Informatics Olympiad as well as the International Olympiad in Informatics, and in subsequent years I have also tutored kids participating in the contest. None of the kids were at the beginners level, however.)

  60. agree! by Anonymous Coward · · Score: 0

    That's is so true. I started with Basic in school, continued with Pascal in the university, learn myself assembler and decided to go with C/C++.
    Then, I learned Java, Javascript and started my own website.
    Later I discovered Linux I was pleased that most of software written on C/CPP using some frameworks like QT. I tried RoR and was surprised with ActiveRecords. And so on ...
    You have to be open minded and feel each situation, because there are some reasons why we have so many co-existing languages today.

  61. Complexity and data structures are more important by dleonard0 · · Score: 1

    I think if you are worried about the efficiency of their solution you ought to explain complexity/order notation, and then apply it to a some practical data structures, like arrays or hash maps. Even more awesome if you get them to do some time measurements in easy language X so to demonstrate the effect of complexity. At crunch time, if they can judge the design trade-offs of their model&implementation, then that will eclipse any speed benefits of a compiled language. Good luck!

  62. Re:My $0.02 by Joce640k · · Score: 2, Insightful

    C shouldn't even be on the list, neither should Pascal.

    C++ is my favorite language but there's no way you can learn it in that time scale.

    VB is almost obsolete and too much tied into to MS APIs.

    That really only leaves Python or PHP.

    Python is cute but it's not really very good for writing software that has to be published/deployed.

    I'd go with PHP because it's much more useful for getting jobs, etc., after the competition.

    --
    No sig today...
  63. Simple by bugs2squash · · Score: 1

    What is it that you're programming that can't be done with scratch ?

    --
    Nullius in verba
    1. Re:Simple by Anonymous Coward · · Score: 0
      Umm, anything allowed in the competition since there's list of allowed languages. From TFS:

      Accepted languages are C, C++, Pascal, Java, PHP, Python and Visual Basic.

  64. Things you might want to consider by sydneyfong · · Score: 4, Insightful

    I've participated in local and regional Informatics Olympiads, and went to the IOI once. I was involved in training local students a few years ago, so I know quite a bit of the ins and outs of these competitions.

    All the languages have pros and cons, but PHP and VB obviously aren't suitable (if only for their encouragement of crappy coding practices). Java offers little advantage over C/C++, and it forces OOP onto you so it adds an unnecessary layer of complexity for the students.

    The "industry standard" of competitive programming is C++, since it offers near-C speed with the power of various algorithms (eg. sort) and data structures ( maps, sets, priority queues ). Those who intend to take the competition seriously should be using C++ as their primary language. But then judging from your requirements the vast majority of your students won't fall into this category, so I wouldn't recommend C++, at least not at this stage.

    Python generally is a good first language for its simplicity and power. There are a few problems with using python for competitive programming though. First, speed can become a problem for *some* contests, which have rather tight runtime constraints. The contests that cater for a wide range of languages are usually better in this respect, but a lot out there are primarily C/C++/Pascal/Java. Secondly, the fact that python supports a range of built in advanced data structures and algorithms means that you may lose the chance to teach them how to implement the basic stuff, eg. using a binary search tree to implement a map (typing `` mymap = {}; mymap[foo] = bar; '' is surely easier than implementing a BST yourself). You might ask why learn to reinvent the wheel when most modern languages provide these features, but these data structures and algorithms is the core of informatics olympiads, and one needs to learn from the basics. That being said, if the timeframe is just 2 months, I think teaching python might be most rewarding for the students.

    C and Pascal are basically on the same league. C is a bit more "archaic" than Pascal in terms of the way it does things, but feature-wise they are roughly equivalent. The languages are simple, fast, and bare bones enough to force the user to implement the basic stuff. In the long term they are good languages for teaching data structures and algorithms, but require a bit of patience on the part of the student since you need to know quite a bit before you can do anything "flashy" with them.

    My experience with most average students is that they usually struggle to form precise ideas on what to tell the program to do, and then when they do have rough ideas they then fail to write a syntactically correct program, and if they really do write a syntactically correct program the program usually fails on correctness for most inputs, or simply do the wrong thing. Running time shouldn't be a concern before the students actually get a correct program, and my experience is, unless you have really really bright students, most of them probably won't be able to come close to writing a correct program within competition constraints, so don't worry too much about running time.

    In short, I recommend python, but in the long term you might want to think about using C/Pascal. And if you restrain yourself to a subset of C++, it might work too.

    --
    Don't quote me on this.
    1. Re:Things you might want to consider by EMN13 · · Score: 1

      I've done quite a few programming competitions and am organising one in two months; I agree with the parent: Use C++ or python. I've used C#, Java, C++, C and Haskell in the past, but often decent data structure support is critical. I'm particularly shoked that C# lacked a priority queue, for instance. C++ Just Works: and modern C++ isn't as nasty as it was a decade ago: error messages have gotten better, and RAII memory containers (and the fact that memory "leaks" are fine so long as they aren't looped) mean that for programming competition style programs you often never need see a delete keyword... Finally, the static typing nature helps; you generally don't get the time or the sample inputs to really test very well, so a decent compiler and liberally applied warnings can matter.

      Having said that, python might be better (certainly the syntax is). You'd need to look at the class library to make sure it's complete. C# is a fine language but it really doesn't offer any advantages over C++ for this purpose and is missing critical data structures. Java used to too, but IIRC the class library is fairly decent by now. Still, what's the point? You'll be dealing with small puzzels; being forced to write classes is at best merely a waste of time and at worst a distraction. The only advantage I can think of is the GC - which isn't a big one in small short-running programs.

    2. Re:Things you might want to consider by Anonymous Coward · · Score: 0

      Having more than 20 years of experience with programming contests (both as a contestant and as an organizer/coach), I fully agree with the above.

    3. Re:Things you might want to consider by Anonymous Coward · · Score: 0

      Oh sure, we wouldn't want to encourage the students to work in a language like PHP or ASP that is actually relevant or embraced outside the academy. That might puncture the walls of isolation between academic programmers and those that do actual work in the real world.

    4. Re:Things you might want to consider by sydneyfong · · Score: 1

      10 years ago when I didn't know better, I thought PHP was an OK language. Ever since I got used to writing with "real" languages, PHP's inconsistent function calls, flat namespaces, OOP-as-afterthought and other poor design choices really bugged the hell out of me. These days I question the sanity of the people who designed PHP in the first place.

      Sure PHP might be superficially useful in the "real world", but then you can learn it in a week once you've grasped basic programming. And if I'm hiring, I probably wouldn't hire one that uses PHP as his only primary language, even if I'm looking for a PHP developer. Why? Because if the only language you know is PHP, you can't be writing good code. More likely, you're one of those creating trivial SQL injections.

      As for VB, I'll be less harsh, since particularly that the "new" VB.NET is essentially C# in another dialect, which isn't too bad. But then, it's Microsoft lock-in without much advantage to compensate for.

      --
      Don't quote me on this.
  65. Gratz on your reading skillz by Anonymous Coward · · Score: 0

    Using a non-accepted language is bound to win them points

  66. I also recommend Python by O('_')O_Bush · · Score: 2, Insightful

    Even though I do 99% of my work in Java, C/C++, VB, or shell scripts, the few times that I have written in Python, it was an absolute pleasure.

    The libraries that I used kicked Java/C++ library asses, to the extend that what was going to be a "short" 500 line program in Java dealing with parsing images, turned into an 80 line program in Python.

    The best part is, it was extremely easy to debug as I wrote, since just about any line I dropped into the source file, I could check with the interpreter.

    It also only took half an hour to pick up from other OOP languages.

    I <3 Python

    --
    while(1) attack(People.Sandy);
  67. C/C++ by mmmmbeer · · Score: 1

    Generally, when teaching kids how to program, you should not teach them a "simple" language. You need to teach them the core concepts of programming, and there's no language better than C/C++ for that. First you teach them basic concepts in C, then you add OO using C++. Once they understand the fundamentals as used in C++, they will be able to convert to any of the other languages fairly easily. On the other hand, if they start off with an easier, but - for lack of a better term - less precise, language, they will have a much harder time ever transferring to other languages. C++ is the best teaching language for exactly the reason why many people don't like to program with it - it makes you understand the differences in the concepts you are using.

    I can understand the desire to simplify things for the sake of the competition, and maybe for some of the students you might need to, but I think you would be doing them a disservice in the long run.

  68. Re:My $0.02 by Anonymous Coward · · Score: 0

    It's only useful for getting a job if the job is web development. I should hope that many students would aspire to better than that.

  69. Frameworks are more important than language by u.hertlein · · Score: 3, Insightful

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

    What I find interesting is that no one has mentioned that what's actually more important than the language itself is the available libraries/toolkit/frameworks that it comes with.

    Let's face it, after you've learned a few languages it pretty much comes down to "what is printf called this week?" when you pick up a new language (functional languages aside). Getting familiar with frameworks is actually what takes the most time.

    C++ and C are pretty bad in this department. STL is nice but only gets you so far. Threads? Nope (not yet). Sockets? No. XML/encryption/whatnot? Sorry. You have to write an awful lot of code to come up with this or find (and learn!) a support lib that does this. (I do C++ for a living.)

    So I'd say: Python. Or C#/Mono (but that's not on the list, why?)

    --
    Geek by Nature - Linux by Choice.
    1. Re:Frameworks are more important than language by Anonymous Coward · · Score: 0

      C#/Mono isn't on the list because it's just a Java knockoff.

    2. Re:Frameworks are more important than language by firstnevyn · · Score: 1
    3. Re:Frameworks are more important than language by Anonymous Coward · · Score: 0

      I've coded in C#. It's java for .NET, and that's the only good thing I have to say about it.

    4. 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...
    5. Re:Frameworks are more important than language by Unequivocal · · Score: 2, Informative

      Just curious - what other language besides Python is dynamically typed with significant whitespace? I've only run across Python in this category.. Thanks!

    6. Re:Frameworks are more important than language by Anonymous Coward · · Score: 0

      I've coded in C#. It's java for .NET, and that's the only good thing I have to say about it.

      Then you're either lying or you didn't do anything beyond a Hello World program. Get back to me when Java has closures and real generics.

    7. Re:Frameworks are more important than language by Machtyn · · Score: 1

      Arguably, it is a better Java knockoff

    8. Re:Frameworks are more important than language by vlokje · · Score: 1

      In real-world programming, libraries and frameworks are very important. But in programming contests the emphasis is usually on algorithms, and only some basis IO (read problem, write solution) is needed from a library. In a typical contest, the challenge might be something like 'apply divide-and-conquer to this problem'. If the challenge is well designed, no library of framework will help much.

    9. Re:Frameworks are more important than language by Anonymous Coward · · Score: 0

      It would never occur to me to call VB.NET's support for inheritance "full" as there is still quite a lot missing. If by full you mean it supports all the inheritance features the CLR supports well yeah then its "full", but full as in all the features of inheritance - No.

    10. Re:Frameworks are more important than language by cbhacking · · Score: 1

      Other than multiple inheritance, which as far as I know is present in exactly one language, what do you consider critical for "full" inheritance then?

      It's got interfaces and abstract classes, overloadable and non-overloadable functions, visibility modifiers including things like protected (might use a different keyword, but same effect), you can get your superclass, every class inherits from a base class... seriously, that's a pretty good set of inheritance features.

      --
      There's no place I could be, since I've found Serenity...
    11. Re:Frameworks are more important than language by gparent · · Score: 1

      If you really do C++ for a living then you probably know about Boost, which does a lot of the important things that other languages may have built in (such as threads and sockets).

  70. What's more important: the kids or the school? by c0lo · · Score: 0

    Your responsibility as a teacher/trainer/coach is toward the kids and not towards the olympic committee.
    And, based on your question, I think you are about to fail them: if you raised the question only with 2 months in advance and expect to make a kid (that doesn't know to write a "Hello world" in any language) suddenly so highly competitive that the speed of execution is the main discriminant.
    But again, no wonder... what can I expect from someone turning to Slashdot to get answers that are going to influence the life of some kids!

    --
    Questions raise, answers kill. Raise questions to stay alive.
  71. Once upon a time by Calculus2 · · Score: 1

    I did pretty well in this particular comp (several years ago) and I used Pascal at the time.

    If I knew back then all that I know about programming today, I'd be using C++.

    But given that I didn't, I would recommend Python.

  72. Perl! by hotfireball · · Score: 1

    Everybody should start learn from Perl. Only potentially real programmers can withstand such brain abuse...

  73. PHP all the way by unity100 · · Score: 1

    1 - syntax is similar with C

    2 - they can create things that they can see firsthand, use firsthand and show off to others firsthand on the web. (great incentive and motivation)

    3 - php is an enterprise level language itself, used with many serious web presences and has serious backing with more to come. it will be a good start for them

    4 - its easy to learn and possible to make extremely complex applications with, as well as making 20 line, working and useful scripts.

    1. Re:PHP all the way by lucian1900 · · Score: 1

      Oh, come on. It's one of the worst dynamic languages in existence. Being cursed with PHP is a great burden.

    2. Re:PHP all the way by unity100 · · Score: 1

      did you use php 5 ?

  74. Re:My $0.02 by pem · · Score: 2, Insightful

    Python is cute but it's not really very good for writing software that has to be published/deployed.

    I can only respond to this statement by quoting Wolfgang Paul: "Not only is it not right, it's not even wrong!"

  75. Relative speed depends a lot on the problem domain by pem · · Score: 1

    And since it's a programming contest, the limits on coding time are probably a more difficult obstacle than the limits on run time.

  76. PHP by bzipitidoo · · Score: 1

    I agree about C. Nasty for novices, and that's because of pointers. For instance, does *n++ mean (*n)++ or *(n++)?

    But Pascal? No, I don't agree. Pascal hasn't been an important language since the 1980s, C still is. The C syntax is superior. Efficient syntax is important in a programming contest. You can type "{" and "}" faster than "begin" and "end" and "If () { }" faster than "if then begin end". The curly braces are less clutter on the screen, and better for those whose first language is not English. Passing by reference in Pascal is lame, what with having to add "var" to every such parameter. C isn't great either, with the pointer syntax for that, and then having to pollute the function body with '*' characters. I like C++ a bit better there, with the '&' in front of the parameter.

    I would pick C++ ahead of C, not for the OOP, but for things like '&' and not having to use the keyword "struct" as much as you have to in C, or, rather, not having to do that boilerplate typedef trick so you don't have to type in "struct" all the time. I'd pick something with C syntax ahead of C++, in this case, Java or PHP. Nice features of Java are automatic garbage collection and not having to sprinkle asterisks everywhere, but Java has some other features that are a pain, particularly this business of having to put each class in a separate file, and the rather clunky "classpath" environment variable. PHP on the other hand is another of those languages that insists on a funny symbol in front of every variable reference, a common tradeoff for not having to explicitly declare every variable. Still, being able to bang out a quick script is very nice, so I'd go with PHP over Java.

    As this is a programming contest, I'm putting a big premium on minimum amount of typing and display space. Quickly banging out code is everything, and if it's dirty, so be it. Having to flip back and forth between multiple files can be a real time killer. Boilerplate such as "main" in C/C++ and the "begin" and "end." of Pascal is also bad, just more lines of crap you have to shove into your code and scroll past before you can get to the business of banging out a solution. So, a scripting language seems best.

    --
    Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
  77. I think Java by LongearedBat · · Score: 1

    Start off with only writing functions in the main class. Thus starting them off with procedural programming.

    If they grasp that soon enough, then you might be able to teach OO. Sure OO can be hard for newbies, but it is possible to teach OO in a very short time. (I've done it a few times. But that was with adults with some programming experience. Adults have better focus than kids.)

    Also, I see Java as a much better/gentler languange for beginners than C. I don't know Python, so I don't have an opinion on it.

    And if they do want to continue programming after your course, then a free Java IDE is only a download away.

  78. How about a pencil and paper and some 3x5 cards by FlyingGuy · · Score: 1

    The elements of good foundation in programming do not require a computer.

    It requires that someone understand that programming is nothing more then looping and branching.

    Teach them to wite their 1st program on 3x5 cards and stay away from the any language that has a runtime that prvides more then the most basics functionality.

    Even if they end up using a garbage collected language they need to understand memory allocation and manipulation.

    3x5 cards can emulate memory perfectly and can teach them the fundamentals of a stack ( no pun intended ).

    .

    One of the biggest problems I see today are "programmers" who do not have a clue as to hat the machine is doing, all they know is you go out and google for a library that will to "stuff" for them without ever knowing what the stuff IS or how it works.

    --
    Hey KID! Yeah you, get the fuck off my lawn!
  79. python python python blahblahblah by unity100 · · Score: 1

    http://wiki.python.org/moin/PythonVsPhp

    this is from python's own wikia. i dont see why some of you try to lord it over everyone over php. and despise the latter.

    1. Re:python python python blahblahblah by Tack · · Score: 1

      Because comparing languages is not about counting up a feature checklist and seeing who has more.

      Python's core is elegant and coding in it is enjoyable. In contrast, after a few hours with PHP I feel like I need a scalding shower and a strong exfoliating bodywash.

    2. Re:python python python blahblahblah by unity100 · · Score: 1

      you are exaggerating. it smells like elitism.

    3. Re:python python python blahblahblah by Just+Some+Guy · · Score: 1

      you are exaggerating.

      PHP has 5718 functions in the main namespace. Python has 79. Which is easier to learn and less likely to cause collisions?

      --
      Dewey, what part of this looks like authorities should be involved?
  80. Re:My $0.02 by timmarhy · · Score: 1

    why is python no good for software that is to be deployed?

    --
    If you mod me down, I will become more powerful than you can imagine....
  81. Re:My $0.02 by dgatwood · · Score: 1

    C may well be a perfectly fine language, depending on the types of programs that are typical in these sorts of contests. For anything mathematical in nature, C is a decent choice; there's minimal bloat (hence faster performance) and it has a very simple syntax. If the questions involve lots of string manipulation, on the other hand, C is out.

    The same logic applies to Pascal, except that it's basically not used anywhere anymore, making it not particularly useful in the long term. That may or may not be a good reason to avoid it, but it is certainly worth considering.

    I tend to agree, however, that PHP is probably the best compromise. It's a broadly used language, it is close enough to C at a syntactical level that students can easily learn C in the future (and, consequently, C++, Java, JavaScript, etc.). More importantly, it is the only language on your list other than C and Pascal that can be used completely procedurally without the need to teach young students OOP. That's a rather big advantage; younger kids may have a hard time with such an abstract concept. And it still provides built-in Perl-compatible regular expressions, stacks, arrays, associative arrays, simple string concatenation and manipulation, etc., unlike pure C or Pascal.

    --

    Check out my sci-fi/humor trilogy at PatriotsBooks.

  82. Python or BASIC would be a good match by ralphbecket · · Score: 1

    You probably want something small and imperative. I'd recommend either Python or some not-too-clever dialect of BASIC. Either will do fine for one-page programs, which sounds like what your students will be writing.

    My experience is that strong static typing is vital for programming in the large, but is a serious impediment to beginners. The extra protection and performance it offers usually isn't neccessary for one-page programs.

  83. Re:My $0.02 by Anonymous Coward · · Score: 0

    C is pretty poor for doing mathematics. Go with a functional language for that. Or Fortran, if you need speed.

  84. assume they don't get it right the first time by r00t · · Score: 3, Insightful

    This is a student's programming contest, right? Why are you even concerned about compile time or "startup" time?

    Normally there is a time limit during which the competition runs. The faster your tools are, the more time you have to write code.

    A kid might need 50 tries to get his program right.

    1. Re:assume they don't get it right the first time by CastrTroy · · Score: 1

      Which leads to some good advice. If at all possible, pick a language for which a good debugger is available. Python debugging works pretty well in Eclipse. From the list of languages, it seems that all of them have good debuggers and IDE's available (apart from pascal, it may or may not, I'm not familiar with it). Teach the students to learn to use the debugger early. Don't even mention stuff like printf debugging. It will just harm them for life.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  85. Re:My $0.02 by Anonymous Coward · · Score: 0

    Python is cute but it's not really very good for writing software that has to be published/deployed.

    ROFL

    That was meant to be funny, right?

  86. My personal experience. by Anonymous Coward · · Score: 0

    I competed in the 2004 Australasian Informatics Competition (which was renamed to Olympiad in 2005 iirc), and at that stage I had been learning C++ for about 2 months, and had very little programming experience before that. Although I had a lack of programming experience, I still placed within the top 100 students in Australasia and got my school a grant for new computers (which I never got to use).

    Now that I have learned other languages as well (Python, Java and Pascal), I would honestly say there is no clear cut advantage to any programming language. No problem required OOP, it was moreso about the problem solving and getting it into algorithms rather than a test of programming. While efficiency is a marking criteria, it doesn't feature anywhere near as heavily as actually solving the problems. I only finished 2/4 of my programs and did (in my opinion) fairly well.

    If you want to tutor them for this competition, tutor them in a language that they feel comfortable with and is accessible to them where they will be taking the test.

  87. Re:My $0.02 by smash · · Score: 2, Insightful
    Eve online has stacks of code written in python. If that isn't "published" enough for you, then Civ4 runs a stack of python code as well.

    PHP is not really what I'd suggest as a good choice. Unless you're doing web development it is fairly unused. And even if you ARE doing web development, its had plenty of bugs and major language changes from release to release.

    PERL would be a better choice from a pure "usefulness in getting a job" standpoint. It can be used for web development, and a whole heap of other tasks.

    But having seen the range of things python has been used to implement, and what I've heard about how easy it is to learn (i'm not a python coder at the moment), I'd agree with the GP that it is a fine choice.

    --
    I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
  88. Identical rules and practical use by SpaghettiPattern · · Score: 1

    If the same rules apply for all students and if only one programming language is allowed, CPU shouldn't be an issue.

    What are the objectives? If it's a thorough introduction of the system that lies at your finger tips, choose C as it is intended to access the hardware as directly as possible (without having to write assembly.) Choose an OO language if you want to teach OO. If you want the kids to actually use the language think of applicability.

    For instance, I'm very proficient in Perl but I would never ever teach it as a first language because getting to the basics is too tough. The data types are too general and friendly and don't make you think enough about what you're doing. For an OO language I'd take openness, applicability and development environment into consideration. In short, I'd choose between C and Java.

    --

    I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
  89. Python. Run time isn't a big deal here. by Sarusa · · Score: 1

    We run python on our embedded 125 MHz ARM systems. For most things it's just as fast as C - on tight loops, you can get 40% faster in C, though not as often as you might think. Sometimes the Python is even faster just because it's optimized for things you normally want to do. Really, most of the time is in the launch, so as long as there's already an instance of python in memory linux's shared pages takes care of that.

    More to the point, you can develop 10x faster in Python than C++. Literally. And it's so much easier to learn and more intuitive. And I say that as someone who is considered the company expert on C++. There are times when I still use it, but for instances where speed of development is a big deal? Never. Rather we write in Python then if necessary do tiny sections in C and call them from the Python. For any kind of problem I can see being asked at a competition like this the speed of development and the freedom to work out a smart algorithm via rapid iteration (if you don't have the experience to know already) will swamp the CPU overhead. If you really want an ace in the hole give your smartest student the task of learning how to call C from Python (you don't need C++ at all if you know both of those).

    I'd also say Ruby - you can crank out stuff in Ruby even faster than in Python (though it's not as maintainable thanks to all the perl-y syntax) but this doesn't seem to be on the list here. And Teaching Visual Basic or PHP to students who don't have a very specific need for either would just be a crime.

  90. Anonymous Coward by Anonymous Coward · · Score: 0

    Python; but stay with ver. 2.5, if speed becomes an issue just compile with Cython with minimal changes. This is probably a worthwhile pedagogical exercise, if time permits anyway. Optimization after functionality. Also, while Python 3.1 is probably best for an individual aware of backward incompatibility; for a classroom, use Python 2.5 to avoid confusion over the vast majority of code examples and books that hopefully the students will want to explore.

  91. Run-time limits... by Chris+Snook · · Score: 1

    ...are meant to sidestep the halting problem. I've never seen a programming contest problem that couldn't be solved within the time limit with a naive O(n^3) algorithm in the slowest interpreted language available.

    Python will be fine.

    --
    There's no failure quite as dissatisfying as a complete and total solution to the wrong problem.
  92. Know how these contests work by GeniusDex · · Score: 1

    I have participated in plenty of contests and know enough about the rules to say that you don't have to worry about runtime and memory usage differences between programming language. Depending on the language used, a solution can take longer or use more memory so that the programming language is pretty much moot and the algorithm is the important bit.

    Usually, the runtimes are used to filter algorithms to ones that use the correct runtime. If a problem is about sorting, they will want a O(n log n) algorithm. Nearly any O(n log n) algorithm will work and anything higher (usually O(n^2)) will fail.

    Now that we've leveled the playing field we can get to the language features. My language of choice for these contests is C++ for two reasons. The first one is personal: i know C/C++ pretty well. The second one is a main advantage: the C++ STL provides a larger number of containers and standard algorithms with runtime guarantees which greatly speed up writing code if you know how to use them. Many of the newer languages do provide these kinds of libraries, but in my limited experience with the other languages i have been unable to like them as much as the STL for this purpose. The fact that you have runtime guarantees in the STL makes it particularly suited for this contests, where runtime is key.

    In the end it all depends on what you want to teach tho. I would dare to dive into C++ with new students, as long as they are eager to learn and show a reasonable level of thinking like a programmer. If you know a lot more about python and can explain and use the algorithmic basics of runtime and memory usage well in python, go ahead and use python. Any language which allows you to strictly adhere to runtime instructions will work.

  93. Logo by Nyder · · Score: 1

    Teach them Logo, it was good enough when I was a kid.

    --
    Be seeing you...
  94. How about iron python? by kiddygrinder · · Score: 1

    I'm not sure if this is allowed but it has largely the same syntax as python plus the JIT compiler of mono/.net which i assume adds a fair chunk of speed. they can take the knowledge of python and do real things with it after the contest too

    --
    This is a joke. I am joking. Joke joke joke.
  95. Re:My $0.02 by Vapula · · Score: 1

    Well, Python is not a good langage for several reason.

    Main reason is the indent craze.
    I agree that it's important to give proper indenting to your code... but relying on indenting for the syntax is lmooking for trouble..

    Think about

    if (a) {
        b();
        if (c) {
            d();
            e();
        }
    }

    and compare with

    if (a) {
        b();
        if (c) {
            d();
        }
        e();
    }

    Only difference between the two code is ONE tabulation. And as there are no matching pairs of markers (braces, if...fi, ...) there is no way for a syntax checker to see that something went wrong. That's the kind of mistake that'll be a nightmare to find but that could easily be done (even more when you do a lot of copy/paste)

    Speaking of copy-paste, you'd better have a VERY GOOD code editor if you want to be sure that indenting is still correct.

    C/C++/... have code reformatters which can take care of applying the same code structure (indenting style and size, position of the opening brace, ...) so there is no need to force it through the programmer's throat

    But it's also a "marginal" langage... see TIOBE index...
    1 : Java 18%
    2 : C 17%
    3 : PHP 10%
    4 : C++ 10%
    5 : VB 7%
    6 : C# 4%
    7 : Python 4%
    8 : Perl 4%

    If you want to teach something to your students, teach them something that'll be useful in the future... PHP is a good choice : easy to learn, lots of demand, powerful libraries, clean syntax,...

  96. Read the contest rules by jibjibjib · · Score: 1

    If you read the contest rules, you'll see that the judges may increase the time limits for interpreted languages at their discretion. It's intended that, as much as possible, no particular language has an advantage over another.

  97. Java != slow by Vapula · · Score: 3, Insightful

    Well, it's true that the JVM may take some time to start... but once it's running, JIT and other make it run quite fast... You see game servers hosting hundred of players on a "normal" machine (not 8-CPU 4-core or similar), web sites using JSP, ...

    And if you don't start to use the latest API (reflexion and similar) and stick to "standard" java, it'll make you create clean code...

    But I agree that starting the JVM is rather slow... Even slower if you start it in "server" mode (but then, you'll get a speed increase while running the code)

  98. Teaching language by KlausBreuer · · Score: 1

    Well, while Python is definitively an interesting language, the original teaching language (created to teach programming, and taught before the first compiler for it existed) is Pascal. The original Pascal is of course somewhat outdated by now, but the useful version was pushed onto the PC by Borland in the form of 'Turbo Pascal' (dirt cheap, graphics capable, screamingly fast - in '86!).
    The language (later called 'Delphi' under Windoze) managed to stay around for a long time despite Borlands best efforts at lousy support. I still use it quite a bit, especially as the compiler is still extremely fast.

    These days you'd want something like FreePascal using the Lazarus interface (http://www.lazarus.freepascal.org/), which is not only free but runs on Windows, Linux and Mac. A 'Hello World' is done within minutes by an absolute beginner, who can then concentrate on the code itself instead of the interface :)

    --
    Free PC version of ChipWits at http://www.breueronline.de/klaus/chipwits/
  99. I'd vote for PHP for newbies by beneppel · · Score: 1

    PHP is a great language to teach people programming on because it's simple, and practical, I think your aim should be to teach them something that they can use rather than to get them to win any contest. After a few PHP lessons, and a dollar or two for a cheap hosting solution, they can have something cool to show for it.

  100. Teach them C++ by AlgorithMan · · Score: 2, Informative
    teach them C++, because
    • Most software (iirc 80% or so) today is written in C or C++
    • C++ is the mandatory language for nearly all well paid programming jobs
    • C++ makes it easy to learn Java (but not vice versa), which is also popular with employers
    • C is C++ for masochists. C++ has everything C has, but not vice versa
    • forget turbo pascal! that's an educational language, which is hardly used in the real world (esp. because of the lack of object orientation)
    • google dijkstras comment on BASIC
    • Python is OK, but not so widely used AND it's an interpreter language (automatic deduction of points)
    • I wouldn't use PHP, since it makes it hard to execute (you need to run a webserver with PHP support and browse to it) and PHP will be dead as soon as the http & html+js+css+flash+AJAX+... mess is cleaned up...
    --
    The MAFIAA is a bunch of mindless jerks who will be the first up against the wall when the revolution comes
    1. Re:Teach them C++ by dutchd00d · · Score: 1

      C is C++ for masochists.

      I think you got that the wrong way around.

    2. Re:Teach them C++ by dunkelfalke · · Score: 3, Informative

      forget turbo pascal! that's an educational language, which is hardly used in the real world (esp. because of the lack of object orientation)

      How does it feel living at least 22 years behind the rest of the world? I am asking because Turbo Pascal supports OOP for that long.

      --
      "It's such a fine line between stupid and clever" -- David St. Hubbins, Spinal Tap
    3. Re:Teach them C++ by AlgorithMan · · Score: 1

      so what is easier in C, than in C++? write ANY C code, run it through a C++ compiler and you have proof that it is AT LEAST as easy in C++ as in C...

      --
      The MAFIAA is a bunch of mindless jerks who will be the first up against the wall when the revolution comes
    4. Re:Teach them C++ by AlgorithMan · · Score: 1
      2010 - 1989 = 22?
      but okay - I admit that the last time I used turbo pascal was before I learned what OOP is and my school teacher hadn't taught us about that feature. That TP actually has OOP was new to me.

      In other news: the last version of Turbo Pascal is 18 years old, so who is behind the rest of the world now?

      okay, okay - you'll tell me about Delphi now, I know... but let me tell you about parametric polymorphism, generic classes, multiple inheritance, operator overloading,...

      I can already hear your excuses, that these features are unneccessary (yeah, syntactic sugar is for pussies! let's go back to ASM!), but I've worked with Delphi and the very first class I wrote would have needed multiple inheritance. Also the codes that I have seen were far, far, FAAAAAAAR bigger and unclearer than equivalent C++ codes would have been. So you can keep
      • using a school-kid programming language, that is not suitable for enterprise level programming (unless that enterprise likes paying twice as much for development, than needed)
      • dreaming about Pascal derivates being good enough
      • trashing ideas that can't be implemented in them
      • writing your classes dozens of times over and over again
      • making up increasingly confusing names for methods that basically do the same thing with different datastructures

      while I use a programming language that can do f*ckin anything and that is widely used in the real world...

      --
      The MAFIAA is a bunch of mindless jerks who will be the first up against the wall when the revolution comes
    5. Re:Teach them C++ by cbhacking · · Score: 1

      C++ is definitely still a very popular language, but it is losing ground. While I doubt it will ever vanish entirely, I expect that within the next decade it will diminish until it is no longer the most common language for new development, let alone being more popular than the rest put together. JIT-compiled languages like Java and C# are catching up very rapidly. True embedded development will always be in a relatively low-level language, but things like phones are started to expect developers to use Java or C# or sometimes even Python. Finally, don't forget JavaScript - not only is it also becoming a JIT-compiled language on most popular implementations (even IE, whenever 9 comes out), it's used on nearly every PC-like device (smartphones, Internet tablets, handheld gaming consoles, and of course desktops/laptops).

      As for C vs. C++, there are definitely some advantages to learning C. One of them is that learning the C++ way of doing things obscures some information from the inexperienced coder - e.g. a lot of people seem to not realize that overloaded operators, such as for cout, are actually procedure calls - and another is that C++ is a much more complex language to learn; C holds your hand less, but learning enough to read other peoples' C code, and write good C code for other people to read, takes less time than the equivalent learning for C++.

      As another poster pointed out, your knowledge of Pascal is completely obsolete. In similar vein, I wonder if you've even glanced at a modern BASIC derivative; aside from the generally human-readable syntax, which admittedly constrains one's options slightly in how you write your code (no, for(;;) is not a valid way to write a "forever" or while (true) loop in VB, I'm sorry) it bears almost no resemblance to the BASIC of which Dijkstra spoke. I see more goto in C/C++ than in modern VB (which doesn't even need it for exceptions anymore), it cleanly supports procedural or OOP paradigms, and while it does suffer the "hides what the runtime is doing" somewhat (garbage collection, etc.) it is functionally near-identical to Java.

      --
      There's no place I could be, since I've found Serenity...
    6. Re:Teach them C++ by injustus · · Score: 1

      I would not let any student touch PHP with a ten-foot pole, but your statement is false, no webserver need, you can run PHP from command line.

    7. Re:Teach them C++ by dunkelfalke · · Score: 1

      Generic classes and operator overloading are supported by Delphi. I am not sure about parametric polymorphism and in my opinion, multiple inheritances are downright evil (and it is not because I know only Delphi, I normally develop in C++ and C#). But nice usage of buzz words.

      When you tell that Delphi is not suited for enterprise programming, you are a liar. There are some huge custom enterprise applications written in Delphi (I actually have written a few myself). The code is also much more clean, readable and safe than C++ code because it takes long time and complicated measures to write safe code in C++ and it isn't small. If you want small code, you have to resort to C hacks and it makes the code a mess.

      The rest of your rant just shows that you don't know what you are talking about. Combined with your preference for buzz words and your silly arguments (millions of flies cannot be wrong and such) I think you should quit being a software developer and move to the marketing department.

      --
      "It's such a fine line between stupid and clever" -- David St. Hubbins, Spinal Tap
    8. Re:Teach them C++ by Anonymous Coward · · Score: 0

      teach them C++, because

      • Most software (iirc 80% or so) today is written in C or C++
      • C++ is the mandatory language for nearly all well paid programming jobs

      I think you misspelled "Java and C#" and wrote "C++" instead.

    9. Re:Teach them C++ by Anonymous Coward · · Score: 0

      Rate parent funny!

    10. Re:Teach them C++ by Anonymous Coward · · Score: 0

      teach them C++, because

      We all want these _kids_ to continue on to coding later, but you must face that most of them won't, and handle the short-term nature of the problem posed.

      Except for your BASIC point, your points are only relevant for long-time professionals and benefits that won't happen in the measly "2 months" that the submitter has to prepare the kids. C++'s ease of switch to a different language, or an ability to _read source_ on 80% of available software, isn't useful for this single _chosen_ language. They will learn to code to only work for the few hours the contest will last. That any one language will soon be "outdated" does not matter to these contest organizers.

      The poster doesn't believe he's bridging the students into anything, and just wants a quick-to-learn syntax not prone to hidden side effects (I'm glaring at C and family there.) I suggest Python or VB, and lean to the latter. Casual Python users get no standard dev environment on Linux Distros or Windows, while VB's Official GUI underlines obvious mistakes and allow debugging runs when something isn't quite right. While I have yet to see any command line VB out there, kids REALLY won't like the CLI-related mucking that Python and most others require by default. A kid will miss the meaning of compiler errors that they will inevitably make, and make often. See this screenshot for a taste of sourness that VB doesn't suffer from: http://www.scripting.com/images/pythonErrorsMuticall.gif

      Geez. I don't even recommend the language to grownups, but my hand was forced for the short amount of time. Rapid prototyping is the trait that is helpful here. A learning tool is supposed to have kids "riding bikes" with confidence first, and if they enjoy it then they are free move on to learn all of the remaining languages and use your insight in college and beyond.

    11. Re:Teach them C++ by Endophage · · Score: 1

      I think you would be amazed how much software for major (multi-billion $) companies is written in Java. While C is (or at least was a year or so ago) the most popular choice for new open source projects, companies that rely on their software are turning to Java because of the existence of really good IDEs that make managing large code bases much easier. In most cases I'd agree that learning C++ does make learning Java easier but if you want to teach some kids, Java is a much better option as pointers and pointer arithmetic is probably beyond most people without some previous knowledge of programming. I don't think we need to worry about employers as these are just kids we're talking about. If they become interested enough in computing to want to have a career in it there's plenty of time to learn C++.

      You might want to double check your facts on PHP. You don't need a webserver. You can just install php and run it from the command line ("$>php file.php") and it certainly won't be dead as soon as what you're calling a mess is "cleaned up". PHP is a server side language, everything you mention is client side or markup apart from AJAX that uses js at the client and PHP/ASP/Java/Ruby/etc... at the server end.

    12. Re:Teach them C++ by Anonymous Coward · · Score: 0

      You don't need a webserver to run php, try the php5-cli package or just the php5 installer for windows. What do you think that line is at the top of

    13. Re:Teach them C++ by HeavensTrash · · Score: 1

      ...I wouldn't use PHP, since it makes it hard to execute (you need to run a webserver with PHP support and browse to it)...

      Since when?

      #!/usr/local/bin/php
      <?
      echo 'Hello World';

      Yes, PHP command-line does exist.

    14. Re:Teach them C++ by alexo · · Score: 1

      okay, okay - you'll tell me about Delphi now, I know... but let me tell you about parametric polymorphism, generic classes, multiple inheritance, operator overloading,...

      Are you dissing Delphi or Java?

  101. Wel my school by Anonymous Coward · · Score: 0

    Used Pascal, and then I used it in the ACSL contests with no problem.

  102. It's just me by Exitar · · Score: 3, Interesting

    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!

  103. Re:My $0.02 by timmarhy · · Score: 1
    your example is flawed because python doesn't use curly brackets to deliniate the IF block, it uses it's indentation. i think this is fundamental problem non python people have understanding the language, and until they use it they don't understand why it's just an elegant design. also, beginners NEED proper indenting practises to be forced down their throat.

    I've written millions of lines of python in production and i've never found the indentation to be a problem. i could just as easily make the arguement that curly bracket hell is worse, because there's nothing forcing proper formatting.

    if you do have indented incorrectly, just like any other compiler it tells you what line the error is on. it's not a problem.

    --
    If you mod me down, I will become more powerful than you can imagine....
  104. Beginners: teach concepts, not languages by Anonymous Coward · · Score: 0

    Presumably for these beginners, you're teaching programming concepts: symbolic logic, input, output etc.

    So while you could dive right into programming languages as we know them, or give them something like Turtle/Logo

    My kids' primary school uses Scratch for this. Of course, you could just give 'em actual Logo via KTurtle.

    1. Re:Beginners: teach concepts, not languages by JSBiff · · Score: 1

      I think the point of the article is that this programming contest the article submitter is interested in having his students participate in only allows a limited list of languages. Now, you could potentially, I suppose, start with something like Scratch or Turtle/Logo to teach them foundational concepts, then transition to one of the other languages, as you're suggesting. But, it would seem like, since the teacher has a (relatively) limited amount of time, he may not feel he has enough time to teach them 2 or 3 programming languages.

      The thing about programming, I've found, is that languages, per-se, aren't really that interesting. What's more interesting are the function/class libraries provided by the language, and learning how to construct an elegant solution to a problem using the available algorithms and data types defined by those standard libraries. I'd want to spend more of my time teaching students to think about things like when it's better to use an array vs a linked list, or even the possibility of doing things like linked-lists of pointers to arrays. Trees and graphs. Different sorting algorithms. Hash tables. Etc. Get them thinking about real software design problems, vs. spending too much time worrying about the specific language to use.

      That said though, I think I'd avoid straight C (because it's not object-oriented, and I really think that object orientation often does make for easier to understand code; also, C's pointer syntax, I've found, seems to be a bit harder to get 'right' than using references in some of the other languages, I think - although it's maybe a little bit more powerful too).

  105. don't use C# by Anonymous Coward · · Score: 0

    please! whatever you do, just don't think of using C#!

    in fact, C# isn't even a programming language anymore since it has context-sensitive statements. so there really even is no reason to think such foolish thoughts.

  106. Python or C by Anonymous Coward · · Score: 0

    Go Python or C.
    Python - interpreted and OOPsy. Simplified and limited C curriculum is easy to understand.
    Visual Basic - never really used it, although my first language was plain old BASIC.
    Pascal - no use in learning this language any more. C++ simply sucks. Java is a better choice than Pascal or C++.

  107. Re:My $0.02 by SausageOfDoom · · Score: 1

    Re-read his example - he was saying in languages with braces it's obvious that you want e() if (c), and the compiler can check that; without braces in python it's one keystroke's difference, or a dodgy copy/paste.

    Explicit braces does help code clarity. Also it annoys me when people argue the significant whitespace is good for beginners because it enforces good coding style, because it does not. Not only that, but it often gets in the way for non-beginners.

    For example, long().chained().method().calls() can only be split inside brackets unless you use the god-awful \, which makes the code harder to read and/or harder to refactor.

    Not to mention that you can make multiple();statements();on();one();line() - again, python thinks it's fine, but that's not good code style. You can't do brace matching to jump to the top/bottom of a code block, and you have to use "pass" to show you really did mean to leave that placeholder method empty for now, rather than just typing {} to come back to later.

    About 75% of my work is in python at the moment, and there are many things I like about it, but saying that it enforces good coding style simply isn't true - in every language there will always be a way for bad programmers to write bad code. At least if you hand me a horrifically-formatted piece of perl, c# or javascript, you can just send it through a reformatter, which will be able to change indentation based on brackets and give you code which is laid out perfectly, without needing to worry that the whitespace it just added has broken the functionality.

    It's not as if python saves us from that problem - not all indentation is equal. I frequently run into code that uses two spaces or a tab character for indentation, whereas I use 4 spaces. If I'm copy/pasting a snippet from documentation or a snippet site, I need to make sure its indentation is the same as mine. Not to mention what happens if you copy it from or paste it into a source where leading whitespace is lost. Trying to paste a few lines of python code in a chat client is frustrating at best.

    Now, if you'd said that the lack of braces makes code more concise vertically, that it makes it look "cleaner" then I may agree, but if you want to teach people to write good code, teach them re-usable language-independent style guidelines at the same time you teach them algorithm design etc - the compiler is the wrong place to learn good code layout.

  108. The two months' learning time is the real limit. by jonadab · · Score: 2, Interesting

    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.

    --
    Cut that out, or I will ship you to Norilsk in a box.
  109. No Perl? You've got to be f**ken kidding by DavidApi · · Score: 2, Interesting

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

  110. Congratulations! by Anonymous Coward · · Score: 0

    The way to handle memory for most tasks in these competitions is to statically declare the structures you need, and use them intelligently.

    You've just invented your own dynamic memory allocation implementation.

  111. Avoid "object oriented" languages by Antique+Geekmeister · · Score: 2, Interesting

    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.

  112. Flowcharts by vlm · · Score: 1

    You need to teach them flowcharts. Teach them a little about sorting algorithms. With respect to databases, they should at least know what the acronym CRUD stands for. At least introduce them to the name "Don Knuth" if not pull some simple examples from his books. They really need to know about common bugs like off by one errors, etc. Have at least a short discussion about each line of:

    http://en.wikipedia.org/wiki/Software_bug#Common_types_of_computer_bugs

    The folks telling you to teach then the vi editor or python or javascript whatever are confusing the trees with the forest. Learning to program by memorizing Stroustrup is like learning to drive by memorizing the Chilton technical manual, interesting, but a complete waste of time. On the other hand, a kid with a plan will succeed even if all they can write in is BASIC. A kid who knows Shakespeare can write something interesting with a crayon, at least compared to an idiot in front of the worlds most powerful word processor.

    The kids also need to learn the patterns and anti-patterns, for obvious reasons.

    http://en.wikipedia.org/wiki/Anti-pattern

    http://en.wikipedia.org/wiki/Design_pattern_(computer_science)

    --
    "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
  113. Re:My $0.02 by Anonymous Coward · · Score: 0

    C falls apart as soon as you need datastructures; there's almost nothing in the standard library.
    C++ is much better in this regards; it and Java are the most popular languages for these contents AFAIK, along with Pascal in some areas.
    I'd still rather use Python if I knew the time limits weren't going to be too strict, though.

    I've coded algorithm-centric code in PHP, and it's awful. It's clearly a template language, and not a very well-designed one at that. Neither the standard data structures nor the standard library is up to the task.

  114. Slower yes, yet fast enough. by ThePhilips · · Score: 2, Interesting

    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.

    --
    All hope abandon ye who enter here.
  115. For the love of god, don't teack them c++ or VB!!! by Youngbull · · Score: 1

    It most probably won't work, because, face it, they are kids, you will spend most of your time trying to get them to understand quirkiness. The thing is that what they won't solve in time, they probably won't solve at all, and unless you are doing difficult stuff or you are squeezing c++ (wich you probably won't get kids to do right), python is comparable to c++ (maybe between 4 and 5 times slower), and when it comes to VB, it will just mess with their minds...

  116. Tutoring by Anonymous Coward · · Score: 0

    IMO, teach the kids anything they're liable to retain. Python's a nice choice for clarity mixed with power. Yes it would be nice if the kids really did well but even if they don't, having them walk away truly enjoying their experience programming seems far more a beneficial end than being frustrated with complicated syntax.
    I'm not suggesting dumbing it down; just suggesting that this tutoring goes beyond the contest.

  117. Put it to a vote by Anonymous Coward · · Score: 0

    Ask the ones you plan to tutor what they wish to learn.

  118. Re:My $0.02 by Dorkmaster+Flek · · Score: 1

    I'd have to agree with that, and I say that as a developer for a company which uses Python for 95% of the code we write. I actually stuck out as a candidate simply because I'd done a couple courses in school that used Python, not as the focus of the course itself, but simply as a choice of language to implement the stuff we were learning. Python is without a doubt my favourite language to write in as of right now. It's easy to quickly get working code going, it has nice debugging features, and it's actually even fun (at least for me).

    --
    I like to think of online DRM as something akin to a college -- you pay for lessons until you learn something.
  119. For the love of the bunny: Pascal. by jotaeleemeese · · Score: 1

    Please, use the right tool for the task, Pascal is compiled and has clean simple syntax which is easy to catch.

    All the other languages are more complex, and whatever people say, interpreted languages still lag behind in general terms when it comes to speed.

    --
    IANAL but write like a drunk one.
  120. Reading comprehension problems? by jotaeleemeese · · Score: 1

    They have to *implement* something.

    What are they going to do with their cards then?

    Honestly chaps, some of you are snobbish and insufferable.

    --
    IANAL but write like a drunk one.
  121. Perl is far too lose. by jotaeleemeese · · Score: 1

    You know it. It is the worse language to teach good programming practices.

    --
    IANAL but write like a drunk one.
  122. Re:My $0.02 by wvmarle · · Score: 1

    I'd go with PHP because it's much more useful for getting jobs, etc., after the competition.

    Depends on whether the job you're after is asking you whether you can program, or whether you know a specific programming language. I'd go after the first type of jobs. For anyone who knows programming, learning a new language should be matter of hours for the basic syntax and maybe a few weeks of actually working with it to become familiar with it.

  123. Java is the best by melaraj · · Score: 1

    A well designed java app would probably run very close to C++. Depending on what they do, using easy caching, streaming and string manipulation techniques by using StringBuffer when possible can make all of the difference in the speed. I would pick java because is a powerful language with very strong rules and without the pitfalls of writing code in C/C++. I have 20 years experience working with C/C++, Java, Pascal. I only ever venture in C/C++ just to write low level hardware dependent stuff. VB is a joke. My choice would be Java.

  124. Individualize if possible by magus_melchior · · Score: 1

    Here's a simplistic logic flow*; use and modify as desired.

    If the student is a complete beginner || lousy coder, or knows programming in a language other than the contest requirements, or he/she knows Visual Basic, start with a mature, stable language that has reasonably consistent syntax. Among the choices available, there's simply no contest-- pick Python**.

    Else, if the student is reasonably versed in one of the languages (other than VB), tutor the student in various algorithms and data structures using that language. Observe the code he/she writes and try to identify bad habits and suggest workarounds, etc.

    Else (meaning you don't have the time to do the above, which is understandable), give them all a crash course in Python and drill them regularly.

    * NOT pseudocode. Don't even try to compile this. I can see the programming professors cringing at the first conditional clause already.
    ** I'm a Ruby coder myself, so if I had my druthers, I'd pick Ruby. But rules are rules...

    --
    "We are Microsoft. You shall be assimilated. Competition is futile."
  125. What language? by Anonymous Coward · · Score: 0

    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.

    "immature ... like Python" and then "mature ... good compilers" What languages would you be talking about exactly?

  126. Use CodeChef by cylcyl · · Score: 1

    If you have not done so already, I would recommend using http://www.codechef.com/ as a source of practice tests for your students, it has tests in various degrees of difficulty and CPU limit. As many may have mentioned, programming competitions tend to have different CPU seconds for compiled lang like C/C++ and interpreted lang (Python, Java). Codechef does something similar, though you may want to check if the difference is reasonable for the competition you're preparing for.

    Also, the site has a lot of foreign participants and daily ranking for benchmark tests, this way your students can see where they rank and you can help them improve.

    As for language choice, I'd choose Java if you wish to orient your students to a more collaborative projects, or Python for more solo projects. Most other languages on your list have various problems listed above by others and won't get the students as far as these two would.

  127. First step... by Mister+Gribbley · · Score: 1

    ...implement LISP interpreter in your chosen language.

  128. Lego NXT by peterofoz · · Score: 1

    I'd use the Lego Mindstorms robotics set, with an NXT processor. That way, the programming results are more tangible and you can solve just about any problem likely to come up in a programming contest with it. For some fun, check out the First Lego League challenges. http://www.firstlegoleague.org/

  129. Re:Psyco -- PyPy as well by Anonymous Coward · · Score: 0

    PyPy has recently released their Python 2.5 - compatible version of Python with a GIT.

  130. Slow languages are usually better first languages by OrangeTide · · Score: 1

    How many of us ran BASIC or Logo on a home computer that struggled to keep up with our more complex programs? It is OK to learn a first language and grow out of it to the point that you never use it again. The important thing is that you learn from it.

    It seems to me that your worry is misplaced by being concerned about CPU time when a new C programmer is going to sink a tremendous amount of time debugging compared to a new python/php/javascript/whatever programmer.

    Java isn't really any easier than C, although I like both languages I've been doing this for a while. When I first started I messed around in BASIC for a decade before learning C, Pascal and asm in the same year.

    --
    “Common sense is not so common.” — Voltaire
  131. Which Pascal? by Anonymous Coward · · Score: 0

    If it is "Standard Pascal", I would vote against it, but if it is something more recent, e.g. Delphi or Free Pascal / Lazarus, I think that's the ideal choice.

  132. Heed these words of wisdom... by Anonymous Coward · · Score: 0
  133. Re:My $0.02 by DrGamez · · Score: 1

    Speaking of copy-paste, you'd better have a VERY GOOD code editor if you want to be sure that indenting is still correct.

    You can develop code outside of vim??

  134. Re:My $0.02 by Unequivocal · · Score: 1

    This is an honest question: I have tried to use Python a few times but the significant white space drives me off. Can you explain how you solve this issue (in psuedo code):

    Function here()
        line 1 does some stuff
        line 2 if statement
              inside the if
    print debug info to console // remember to remove
        line 3 more stuff

    I put those print statements in all over the place when writing code -- and yes I *also* write tests using TDD. But getting a quick print helps a lot. But if I tab the print, it's easier to miss it later. I know some other programmers who do the same thing.

    Do you just suck it up and tab that line in to it's proper place? Any other thoughts?

    It kind of bugs me that I can't have the code look on the screen how I want it to look, rather than how the complier/interpreter wants it to look. Like I said, I'm not hating - I'm asking. Python seems like a nice language barring this mental barrier for me.

  135. Python by thetoadwarrior · · Score: 1

    I do like Java a lot but Python will force them to make nice neat code, it's easy to learn, has awesome features / support and it's fast enough.

    Plus you can just have them open it on the command line and type stuff in and get instance feedback from their work. They won't write a huge program this way but at least while starting out at first it doesn't require either compiling things on your own or learning an IDE at the same time.

  136. Go for python by roguegramma · · Score: 1

    Go for python, that will prepare them to code in: http://en.wikipedia.org/wiki/Whitespace_(programming_language)

    No seriously .. take this with a grain of salt, because this is written by someone who has so far managed to avoid learning python, but knows the other languages: Python syntax is unique, and it will not prepare you for the goodness of the many curly-braces languages.

    In my initial sifting, I would not rule out php as programming language if the programming exercise benefits from graphics, which most likely it doesn't in such a contest though.

    I think Java will do fine because it has easy looking string operations, and not too many weird standard invocations, like in C "#include <stdio.h>".
    I would consider C++ first if not for its weirdness of having the same operator code for bit-shifting as for simple input and output.

    In fact, if the problem involves file handling, I think C appears to be more easy to handle this, at least on first sight to the student(which I think is important - don't scare them stiff on first sight of a language). I mean the java way is easy too in practice, but you have to string two objects together to handle file reading or writing in a standard invocation.

    I look forward to many python counter examples to my concerns, as /. seems to champion python.

    --
    Hey don't blame me, IANAB
  137. Re:My $0.02 by styrotech · · Score: 1

    Here's what I do:

    I use an editor that can understand Python indentation. This is easier than you think, as the editors not capable of this are too limited to do much coding in anyway.

    Then all you do is go to the end of the line before where you want to insert your new line, create a new line and hey presto the next line starts off correctly indented.

    Any decent coder is going to configure their editor to automatically indent anyway no matter what language they use, so it isn't really any extra work. Except for trivial edits, I find I need the same kind of indenting features when coding in PHP too.

  138. Re:My $0.02 by SausageOfDoom · · Score: 1

    That's not what he's asking - he likes to put his debug print statements at the start of a line to make it obvious where to pull them out when debugging later. Automatic indentation is not a solution to his problem.

    @Unequivocal: Exactly, it sucks. I do exactly the same thing in other languages, but you can't do it in Python. I resort to dropping a debug() function into my code, and then:

    Function here()
            line 1 does some stuff
            line 2 if statement
                    inside the if
                    debug(debug info to console)
            line 3 more stuff

    It's not ideal, but at least that way you can search for it afterwards. It does have the added bonus feature of being able to change debug() to return without doing anything when you make your code live, just in case you left a debug statement somewhere.

  139. So they dont put everything in 1 line by Anonymous Coward · · Score: 0

    I would say python cause it also teaches them good coding style

  140. The Rules and advice *for the question asked* by jamie(really) · · Score: 1

    It would appear that most people have responded with knee jerk "my language is better than yours" without actually reading the question, or the referenced material. Well done, all of you have just failed your job/contractors interview.

    Short answer: Use C. Teach them it well. Teach them about data. Teach them about "restrict". Challenge them to win.

    Long answer:

    First observation: This is not a "programming" competition. Its a mathematical computing competition.

    Second: There are winners and losers. Therefor not everyone gets 100%. Either contestants write code that fails to do the job, or contestants write code that doesn't do it fast enough. Finally, in the event of a tie, the judges may select winners based on other criteria (than just pass or fail) and therefor they could conceivable use execution time as a decided. Do you know if they have done so?

    Much of the judges’ input data will be far more taxing than the sample input given in the
    question statements, and may push your program over the time limit. In this way, efficient
    programs will be rewarded.

    But:

    Programs written in Visual Basic, Java, PHP or Python may run slower due to the overhead
    of the associated interpreters and/or virtual machines. The judges may at their discretion
    increase the time limits for these languages accordingly. Contestants should note that this
    will not give these languages an advantage.

    Well, that sounds completely and utterly arbitrary. When dealing with C-like java, which is what you will use for the problems you'll face in the competition, java is not much slower than C if its compiled, but it may not be. And VB.NET (NOT VB6) can be as fast as C. Python is always interpreted.

    How will the judges increase the limits?

    Its likely that the judges will they will benchmark their ideal solutions against each other. If the java version of the same solution in C takes 20% extra, then that is the extra time they allow. So it should be safe to write in java or python if you want to.

    But why?

    I assume from your choice of competition that you are teaching students to go on to mathematical and scientific endeavours, not programming. This is an important difference. For example, until "recently", you were better of programming large data sets in FORTRAN, because C was unable to optimize properly thanks to pointer aliasing. However, the GNU C++ compiler that they are using will support the restrict keyword, so it can handle large data sets. Java, python, etc are languages for the web, not for scientists. (Ok, unless you are using java as a scripting language to drive something like Mathematica, but this is NOT what we are discussing here).

    Teach them C. The competition specifies GCC/C++ 3.4.4 or later, which means you can use the __restrict__ keyword also, if they get the hang of writing algorithms.

    Here are some more of the rules, for my peers whose internet connections cannot reach Australia.

    Program Restrictions
    Students should write a computer program to solve each problem.
    Programs should read input only from the input file(s) specified in the question statements,
    and should send output only to the output file(s) specified in the question statements. The
    input and output files should be assumed to be in the current directory. Any output to
    the screen will be ignored, and no input from the keyboard will be supplied.
    The format of the input file will be specified in each problem statement.
    The desired format of the output file will also be specified in each problem statement. If
    you do not adhere to this output format, you may lose marks for your solution. The only
    exception to this will be that judges will ignore any spaces at the beginning and end of each
    output line.
    Each solution should be a single source file, written in one of the following languages:
    – C
    – C+

  141. Whoah by Anonymous Coward · · Score: 0

    I think many many people here are going overboard? Has anyone actually been to the website to have a look at the sample challenges?

    From what it looks like, the contest is more about coming up with an appropriate ALGORITHM - that chain of simple logical actions required to solve the problem - and then implementing it in the language of your choice. Further, the challenges and solutions are really really easy if you can see them. The execution time limits are there to discourage brute-force algorithms that cycle through every possible solution to see if it works because they're not as elegant and they're just not needed. At the end of the day I don't think it matters what language you choose, as long as the algorithm is right and it's well written. I'm going to defend BASIC and say that it's still an easy to learn and useful language - but I'm not going to defend VB as I think it blows, Turbo BASIC was the shiznitz back in the day!

    Example: That bacteria samples problem. An experiment involving bacteria - which doubles in number every day - has been ruined. All you know is how many bacteria you had at the end, and that the start number was odd. You want to know how many days the experiment ran for and what the start number was.

    Solution: Take the end-bacteria number, and keep dividing it by 2 until you have an odd-number. The number of times you divide equals the number of days.

    After initialisation and clean-up, you would only need a few lines to implement this algorithm.

  142. Python by JMatopos · · Score: 1

    Go for ease of use over speed.

    If the contest allows entries in Python, then you would expect that python code is capable of running fast enough to win the contest.

  143. Teaching by iwebbs · · Score: 1

    Teaching programming is good. It has lots of up scope. Recently I found a training center in Toronto which teaches software programming starting at the age 7. It is really cool. Kids at the young age itself well trained to do stuff of their own. The way I foresee is , programming will become a regular job for many people life just as watching TV.

  144. And by mahadiga · · Score: 1

    Why not Perl?

    --
    I'd like to buy homeland for our 10 million people. http://twitter.com/mahadiga
  145. Use a teaching language by krischik · · Score: 1

    Indeed. Pascal was designed as a teaching language. There is much to be said about using the right tool for the right problem. If teaching programming is the problem then you should indeed us a language which is designed for precisely that problem.

    BTW: the other well known teaching language is BASIC but I would go for Pascal.

  146. variant arrays by krischik · · Score: 1

    I think variant array have not made it into C++ yet so there is C code which won't run in C++. And there where some more features of the current ISO C which did not make it into the current ISO C++.

    Martin

  147. Re:My $0.02 by Joce640k · · Score: 1

    >"Eve online has stacks of code written in python. If that isn't "published" enough for you, then Civ4 runs a stack of python code as well. "

    I don't mean that kind of "published". I mean getting Joe Sixpack to install a Python app on his machine.

    If I Google for "Python deployment" the first hit is this: "One of the most-frequently asked questions of all time is this: "I have a Python application I've developed; how do I deliver it to my customer/friend/...?" "

    If the 'typical answer' is this: "tar up the source and send it. It's reasonable to expect that the end-user's host will have Python installed." then I'm not so sure Python is ready for the big time.

    --
    No sig today...
  148. Depends on your primary objective by ThornTech · · Score: 1

    If you want the kids to win the competition, then Python would be your best choice because they can provide more features with less code. If you want the kids to learn the most about programming, then definitely choose C. It is the foundation of all the other programming languages. If you start with C, they will have the background to learn any of the other languages.

  149. These languages are not replaceable by smartson · · Score: 1

    It is hard to choose the best one since they are not replaceable. What about introduction to programming without specific languages? What if you ask kids about their preference? Also look at Programming Language Comparison

  150. CPU Limit Ridiculous by flymolo · · Score: 1

    The CPU Limit is there mainly so they can abort programs rather than wait for potential infinite loops. Or at least that is what it was for in the programming competitions I participated in. Get some example problems before making a decision, but I'd definitely lean toward a scripting language, and something with a robust set of shipped libraries.

    --
    "Sometimes it's hard to tell the dancer from the dance." --Corwin Of Amber in CoC
  151. irrelevant by unity100 · · Score: 1

    php has infinite number of functions because there are infinite number of modules and extensions that can be put in to perform functions ranging from encoding operations, graphic operations to roasting your bread in the morning. of course there is going to be many functions.

    1. Re:irrelevant by Just+Some+Guy · · Score: 1

      of course there is going to be many functions.

      That's ludicrous. C is the only other language I know of that injects so many functions and variables into the main namespace. If you run a Python script with 50 imports, then you have exactly 50 extra names to contend with, not 50 * the average number of definitions in each module.

      --
      Dewey, what part of this looks like authorities should be involved?
    2. Re:irrelevant by unity100 · · Score: 1

      and just fill me in on how function naming is supposed to happen when a language has millions of modules doing millions of other functions.

  152. Re:My $0.02 by mini+me · · Score: 1

    I mean getting Joe Sixpack to install a Python app on his machine.

    A popular tax preparation program, installable on Windows systems, is written largely in Python. It is definitely designed for the Joe Sixpack market.

  153. Re:My $0.02 by Richard_at_work · · Score: 1

    Dropbox is mainly written in Python, and that just has a standard Windows installer. There is no indication that Python is in anyway related to it when you install it, but its there.

  154. Python sucks ass by Anonymous Coward · · Score: 0

    Irrespective of cpu time constraints my experience with python is that by dumbing down it discourages the programer from organization of there code resulting in horible messes. Wheras with c++ or C (especially C oh beautiful C) the code is nice and I don't have to fuck around with pretending that memory that holds an int is different from memory that holds a char etc. The hand holding sucks when you know you just want to flip a single bit in a register somewhere instead of including 2 different libs and messing around.

  155. I'd go Java *ducks* by Endophage · · Score: 1

    Referencing a post here on /. a while ago, benchmarks across most of the available languages show java running with the server VM (selected by passing the -server option on the command line) is faster than all languages other than C and Clean. Given that your students will probably be able to solve any problems set using only single class of completely static java so you don't necessarily have to teach them OO programming I think Java will provide them with much more power for much less pain than C or C++, is just better than VB full stop and is significantly faster than Python or PHP (which is incidentally the slowest language of those benchmarked).

    I'd also point out that Java has some of the best editors (Eclipse, Netbeans), that take the pain out of debugging.

  156. In my opinion... by Norailyain · · Score: 1
    --
    "I may never prove what I know to be true, but I know that I'll still have to try" Dream Theater "The Spirit Carries on
  157. ...and as a side-effect... by beh · · Score: 1

    I don't know about non-German speaking countries - we just have this expression (usually uttered by teachers in the face of completely unmotivated kids):

        You're learning for your life, not for the school!
        (Nicht für die Schule - für das Leben lernen wir.)

    Teaching kids Pascal is teaching them something they won't really use outside of school. Ever.

    Furthermore, you're not teaching them functional or OO development, both of which are probably closer to 'life' outside of school.

    So, if you want to show kids relatively easy development, stick with Logo (doesn't get much simpler, and you can teach kids enough in a day for them to program some relatively simple graphics excercises - like drawing polygons, ...

    I don't think anyone ever coded commercially in logo, but for that it's simple, it's functional, ...

    Otherwise, if you have more time, I guess C or Java are likely to have some more relevance to what's happening in the outside world, and if you stay with simpler, pure command line style programs, there won't be much bloat to learn either.

    Still, without a proper grounding in development (i.e. not language specifics, but rather going into algorithms, being able to estimate on whether an algorithm is good or not), I'd rather people leave it, instead of making kids believe that this is kind of 'all it takes'.

  158. Been there, done that by ljuwaidah · · Score: 0

    I've been to many programming competitions like that (and always came 2nd.. Damn it!)

    The contests I've been to (local versions of ACM ICPC) that allowed Java and C/C++.

    I've also tried TopCoder's contests and Facebook's.

    In the ACM contests the algorithms aren't really time-consuming so Java's slowness doesn't really matter, however, because the input and output are in files, Java's approach to dealing with files is very annoying.

    In TopCoder there are many options (VB (not .NET), C/C++, Java, Python, and I think Perl), again, time isn't of essence here.

    In Facebook's algorithm contests however, the algorithms are pretty complicated and need to be damn efficient, I did have a hard time with Perl because it's slow, however, they claim that all the algorithms can be run in the allowed time limit.

    I guess it's pretty clear that time isn't a big issue in these contests (well, except Facebook's but that's because if you solve the problems you can apply to work there!).

    --
    Laith Juwaidah http://www.ljuwaidah.org
  159. I agree totally. by snuki · · Score: 1

    the perfect is the enemy of the good; It's more important to have something running now and to iterate on that, than to have something that will work better if we can get it to run at all. Only if it proves that it's too slow should you worry about optimizing. And at least then you can look at it run, find the bottle neck and fix that, instead of wasting your time, from the beginning, in a much more difficult, but faster language.

  160. Python is more complicated than C by phorgan1 · · Score: 1

    I've programmed in both for years, and the syntax of python is much more complicated than C.