Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Good Language Choice For School Programming Test?

timothy posted more than 4 years ago | from the 'strailian's-too-difficult dept.

Australia 407

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

Sorry! There are no comments related to the filter you selected.

Faster than you think (1, Informative)

Anonymous Coward | more than 4 years ago | (#31476654)

Python is faster than you think.

Re:Faster than you think (4, Informative)

WrongSizeGlass (838941) | more than 4 years ago | (#31476816)

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.

Re:Faster than you think (0)

Anonymous Coward | more than 4 years ago | (#31477018)

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.

Re:Faster than you think (-1, Flamebait)

Anonymous Coward | more than 4 years ago | (#31477228)

the only wadding was you masturbating into kleenex.

Re:Faster than you think (4, Insightful)

gd2shoe (747932) | more than 4 years ago | (#31477080)

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

surely not; Pascal was meant for this (5, Insightful)

r00t (33219) | more than 4 years ago | (#31477480)

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.

Re:Faster than you think (2, Informative)

rwa2 (4391) | more than 4 years ago | (#31477384)

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.

Re:Faster than you think (1)

webruss (704650) | more than 4 years ago | (#31477440)

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

Too easy... can't resist... (1, Funny)

Anonymous Coward | more than 4 years ago | (#31476656)

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

Re:Too easy... can't resist... (4, Funny)

WrongSizeGlass (838941) | more than 4 years ago | (#31476838)

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

Re:Too easy... can't resist... (1)

hedrick (701605) | more than 4 years ago | (#31476904)

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

Re:Too easy... can't resist... (1)

Schraegstrichpunkt (931443) | more than 4 years ago | (#31476942)

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

Re:Too easy... can't resist... (1)

binarylarry (1338699) | more than 4 years ago | (#31477202)

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

Re:Too easy... can't resist... (1, Troll)

Anpheus (908711) | more than 4 years ago | (#31477252)

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

Re:Too easy... can't resist... (1)

binarylarry (1338699) | more than 4 years ago | (#31477312)

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

Java would squarely be 2nd in that case.


Anonymous Coward | more than 4 years ago | (#31476664)

Master it and everything else seems easy.

Tough Decision (0)

Anonymous Coward | more than 4 years ago | (#31476666)

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.

Many good choices (4, Funny)

DoofusOfDeath (636671) | more than 4 years ago | (#31476670)

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.

Hello World (4, Funny)

gd2shoe (747932) | more than 4 years ago | (#31477116)

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

Re:Many good choices (0)

Anonymous Coward | more than 4 years ago | (#31477186)

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

There's C then there's C written by newbies (2, Informative)

squidgit (734454) | more than 4 years ago | (#31476682)

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

Re:There's C then there's C written by newbies (2, Interesting)

mdf356 (774923) | more than 4 years ago | (#31476730)

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.

Re:There's C then there's C written by newbies (4, Informative)

betterunixthanunix (980855) | more than 4 years ago | (#31476804)

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

Re:There's C then there's C written by newbies (1)

squidgit (734454) | more than 4 years ago | (#31477140)

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

Re:There's C then there's C written by newbies (0)

Anonymous Coward | more than 4 years ago | (#31477346)

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.

Re:There's C then there's C written by newbies (1)

mkiwi (585287) | more than 4 years ago | (#31477394)

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.

Re:There's C then there's C written by newbies (1)

oldhack (1037484) | more than 4 years ago | (#31477458)

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?

English, but seriously (2, Interesting)

davidwr (791652) | more than 4 years ago | (#31476684)

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.

Strange limitation (1, Insightful)

Anonymous Coward | more than 4 years ago | (#31476692)

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.

Re:Strange limitation (3, Insightful)

godrik (1287354) | more than 4 years ago | (#31477064)

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

Re:Strange limitation (1)

zappepcs (820751) | more than 4 years ago | (#31477416)

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.

Re:Strange limitation (1)

ottothecow (600101) | more than 4 years ago | (#31477444)

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.

Re:Strange limitation (4, Insightful)

Charan (563851) | more than 4 years ago | (#31477230)

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

I'm guessing the CPU limits are generous. (5, Insightful)

Jason Pollock (45537) | more than 4 years ago | (#31476694)

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.

Re:I'm guessing the CPU limits are generous. (2, Insightful)

Anonymous Coward | more than 4 years ago | (#31476744)

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.

Re:I'm guessing the CPU limits are generous. (4, Funny)

bill_mcgonigle (4333) | more than 4 years ago | (#31476916)

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

Re:I'm guessing the CPU limits are generous. (1)

Anne_Nonymous (313852) | more than 4 years ago | (#31477456)

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

Re:I'm guessing the CPU limits are generous. (2, Interesting)

zach_the_lizard (1317619) | more than 4 years ago | (#31477024)

Some algorithms are better suited for some languages or paradigms than others. Quicksort, for example, relies on mutability to be efficient. A language like Haskell, where the list to be sorted would be recreated a bunch of times, would not be well suited. Even with the same algorithm, it would run slower. Sometimes the language dictates the algorithm that would be best to use, or what data structures make sense. That said, I think I would have to recommend, of the languages listed, Python because of its general reputation for being easy to learn. Plus, it has decent support for several paradigms. Want to be OO? Cool. Want to functional? We can do that too. It opens the mind to more ways of thinking about a problem than more single paradigm languages, and that can be very useful in this sort of contest.

Stooge sort (1)

davidwr (791652) | more than 4 years ago | (#31477174)

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.

A wiseguy, eh? (0)

Anonymous Coward | more than 4 years ago | (#31477368)

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.

Psyco (3, Informative)

headkase (533448) | more than 4 years ago | (#31476696)

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.

Re:Psyco (1)

maxume (22995) | more than 4 years ago | (#31476800)

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.

Re:Psyco (1)

zippthorne (748122) | more than 4 years ago | (#31476944)

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

Re:Psyco (0)

Anonymous Coward | more than 4 years ago | (#31477168)

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

Re:Psyco (0)

Anonymous Coward | more than 4 years ago | (#31477260)

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


Re:Psyco (1)

EvanED (569694) | more than 4 years ago | (#31477310)

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.

Re:Psyco (1)

gd2shoe (747932) | more than 4 years ago | (#31477328)

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

anusscript (-1, Troll)

Anonymous Coward | more than 4 years ago | (#31476698)

2.0 or later

Re:anusscript (0)

Anonymous Coward | more than 4 years ago | (#31476724)

I heard it worked for the GPL!

Language shouldn't push you past the limit (5, Interesting)

EEBaum (520514) | more than 4 years ago | (#31476728)

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.

They won't hit the time limit (1)

JamesP (688957) | more than 4 years ago | (#31476758)


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.

Go with an Interpreted Language (0)

Anonymous Coward | more than 4 years ago | (#31476786)

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.


Re:Go with an Interpreted Language (2, Informative)

Nursie (632944) | more than 4 years ago | (#31477188)

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

Pascal (2, Interesting)

jadrian (1150317) | more than 4 years ago | (#31476802)

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

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

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

Re:Pascal (0)

Anonymous Coward | more than 4 years ago | (#31477134)

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

Re:Pascal (1)

slashqwerty (1099091) | more than 4 years ago | (#31477256)

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.

Re:Pascal (1)

buntsai (1195905) | more than 4 years ago | (#31477376)

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.

Go With Your Gut (5, Insightful)

Bob(TM) (104510) | more than 4 years ago | (#31476806)

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.

If Python is an allowed choice then... (3, Insightful)

Frequency Domain (601421) | more than 4 years ago | (#31476830)

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

No option of Fortran? (1)

zebadee (551743) | more than 4 years ago | (#31476840)

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

Re:No option of Fortran? (1)

zippthorne (748122) | more than 4 years ago | (#31476964)

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

Re:No option of Fortran? (2, Funny)

Stephen Tennant (936097) | more than 4 years ago | (#31476974)

But then he must add a module for maintaining neckbeard

Re:No option of Fortran? (1)

colinrichardday (768814) | more than 4 years ago | (#31477254)

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

Python will give you th least problems (4, Insightful)

gweihir (88907) | more than 4 years ago | (#31476854)

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.

Re:Python will give you th least problems (2, Insightful)

Samah (729132) | more than 4 years ago | (#31477432)

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

Performance isn't the most important issue (1)

urusan (1755332) | more than 4 years ago | (#31476878)

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.

Programming time is more important than CPU time (1)

UTF-8 (680134) | more than 4 years ago | (#31476892)

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.

Pthon, definitely (1)

cheese1756 (1479931) | more than 4 years ago | (#31476894)

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

Ask them (2, Interesting)

igotmybfg (525391) | more than 4 years ago | (#31476908)

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

Stick with Python or Java (1)

offrdbandit (1331649) | more than 4 years ago | (#31476914)

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.

Python+shedskin (1)

correnos (1727834) | more than 4 years ago | (#31476922)

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

Think long term (1)

sictransitgloriacfa (1739280) | more than 4 years ago | (#31476928)

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.

Do some testing (1)

boxie (199960) | more than 4 years ago | (#31476988)

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)

Python would be my choice (2, Informative)

collywally (1223456) | more than 4 years ago | (#31477012)

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.

c0m (-1, Redundant)

Anonymous Coward | more than 4 years ago | (#31477026)

But s0ffice it , a proud member Wash oof hands

Probably Java (Bleh) (2, Interesting)

pookemon (909195) | more than 4 years ago | (#31477038)

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

No Perl ? (2, Insightful)

Anonymous Coward | more than 4 years ago | (#31477062)

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

How about the simplest of languages?... (2)

javabandit (464204) | more than 4 years ago | (#31477068)


Looking Beyond AOI (1)

carlzum (832868) | more than 4 years ago | (#31477102)

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.

Perl !! (3, Insightful)

QX-Mat (460729) | more than 4 years ago | (#31477114)

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

Forget the higher level languages (1)

dynchaw (1188279) | more than 4 years ago | (#31477150)

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.

Re:Forget the higher level languages (1)

binarylarry (1338699) | more than 4 years ago | (#31477276)

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.

Re:Forget the higher level languages (1)

anonymousbob22 (1320281) | more than 4 years ago | (#31477474)

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

It's Java all the way down?

Re:Forget the higher level languages (0)

Anonymous Coward | more than 4 years ago | (#31477402)

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

Langage for Programming Competition by Students (0)

Anonymous Coward | more than 4 years ago | (#31477156)

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.

Python or Java (3, Insightful)

M. Baranczak (726671) | more than 4 years ago | (#31477170)

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.

Re:Python or Java (1)

FyRE666 (263011) | more than 4 years ago | (#31477338)

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.

assembler (1)

swigabyte (1392247) | more than 4 years ago | (#31477208)

Go with assembler.

Re:assembler (1)

binarylarry (1338699) | more than 4 years ago | (#31477250)

I think you mean "assembly." ;)

javascript - jsdb (0)

Anonymous Coward | more than 4 years ago | (#31477238)

Just my opinion. (1)

TaggartAleslayer (840739) | more than 4 years ago | (#31477240)

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.

Be aware of prohibited stuff (1)

azh (1717056) | more than 4 years ago | (#31477268)

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.

Just pick whatever you want (0)

Anonymous Coward | more than 4 years ago | (#31477286)

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.

Boy you're going to get lots of replies (1, Interesting)

v1 (525388) | more than 4 years ago | (#31477314)

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.

Multiple modern ones... (0)

Anonymous Coward | more than 4 years ago | (#31477316)

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

Good Language Choice? (0)

martas (1439879) | more than 4 years ago | (#31477362)

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

Re:Good Language Choice? (0)

Anonymous Coward | more than 4 years ago | (#31477450)

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

Logo (0)

Anonymous Coward | more than 4 years ago | (#31477418)

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.

almost had it (1)

NEDHead (1651195) | more than 4 years ago | (#31477422)

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.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?