James Maguire’s article raises some interesting questions as to why teaching Java to first year CS / IT students is a bad idea. The article mentions both Ada and Pascal – neither of which really “took off” outside of the States, with the former being used mainly by contractors of the US Dept. of Defense.
This is my own, personal, extension to the article – which I agree with – and why first year students should be taught C in first year. I’m biased though, I learned C as my first language and extensively use C or C++ in projects.
Java is a very high level language that has interesting features that make it easier for programmers. The two main points, that I like about Java, are libraries (although libraries exist for C / C++ ) and memory management.
Libraries are fantastic. They offer an API and abstract a metric fuck tonne of work that a programmer doesn’t care about. I don’t care how the library works inside, just that I have a way of putting in input and getting expected output (see my post on abstraction). I’ve extensively used libraries, even this week, for audio codec decoding. Libraries mean not reinventing the wheel and reusing code (something students are discouraged from doing, as it’s plagiarism, yet in the real world you are rewarded). Again, starting with C means that you appreciate the libraries more.
Managing your programs memory manually is a pain in the hole. We all know this after spending countless hours finding memory leaks in our programs. Java’s inbuilt memory management tool is great – it saves me from having to do it. However, if I had have learned Java first, I would assume (for a short amount of time) that all languages managed memory for you or that all languages were shite compared to Java because they don’t manage memory for you. Going from a “lesser” language like C to Java makes you appreciate the memory manager
What’s so great about C?
In the context of a first language to teach students, C is perfect. C is
- Relatively simple
- Lacks OOP features, which confuse freshers
- Low level
- Weakly typed
- Easy to get bugs
Java is a complex language that will spoil a first year student. However, as noted, CS / IT courses need to keep student retention rates high. As an example, my first year class was about 60 people, final year was 8. There are ways to keep students, possibly with other, easier, languages in the second semester of first year – so that students don’t hate the subject when choosing the next years subject post exams.
Conversely, I could say that you should teach Java in first year and expand on more difficult languages like C or assembler (which should be taught side by side, in my mind) later down the line – keeping retention high in the initial years, and drilling down with each successive semester to more systems level programming.
There’s a time and place for Java, which I believe is third year or final year. This will keep Java fresh in the students mind while they are going job hunting after leaving the bosom of academia. This will give them a good head start, as most companies are Java houses in Ireland.