7 ms·
I have to say that Java is the absolute worst language for pedagogy. Before people can write "Hello world", they're told they have to write "public static void
by michaelochurch 13y ago
I have to say that Java is the absolute worst language for pedagogy. Before people can write "Hello world", they're told they have to write "public static void main(String[] args)", which are presented as magic incantations, "don't worry about those yet". Thus begins the corporate-style coding culture of bashing stuff without understanding it.
The stated reason for starting in Java is so that students can get coding jobs based on one or two CS classes, but two issues come to mind there. First, I generally wouldn't hire someone (in a technology company) who took one CS class and didn't continue-- but at least if she passed an SICP-style course, I'd know that she learned how to think about computational problems. Second, you don't "know Java" when you come out of school. Java is actually highly complicated (in good ways and bad) and the average college student hasn't been exposed to all the mess of it (and that's probably good, because, while OOP means about 20 different things to different people, business-style OOP is cataclysmic).
- yarou 13y agoNo more magic than: int main(int argc, char **argv) There is always a level of hand waving that will go on in any introductory course, for a lot of reasons. You have to keep in mind that the majority of students come from highly different backgrounds.
- CJefferson 13y agoWhile I personally agree with teaching something other than Java, there is one big advantage of Java you have overlooked-- as the core language is so simple, bugs caused by incorrect use of the language tend to be "shallow" (bugs caused by algorithmic mistakes can still be very complex of course). An easy example of this is compile-time errors -- the most complex compile time error you can get of Java tends to be nothing more than "mismatched bracket" or "incorrect function call", whereas even fairly simple Haskell code can produce very complex error messages, and ghci (for example) tends to make things worse rather than better. Java isn't perfect and has been getting more complicated, boxing & generics for example, but still is not close to the pain one can create in a handfu of characters in Haskell (of course, C++ has the same problem, for different reasons). Personally, I see Haskell as the C++ of functional language, and therefore would prefer not to teach either Haskell or C++ as a first language.
- Typhon 13y agoIf Haskell is the C++ of functional languages, what, in your opinion, is the C of functional languages ?
- scott_s 13y agoScheme.
- raverbashing 13y agoI want the Python of functional languages
- danieldk 13y agoExcept that Scala already is ;). Haskell pretty much sticks to functional programming and resisted adopting other paradigms (e.g. OO via O'Haskell). Scala, on the other hand seems to adopt as many paradigms as C++.
- michaelochurch 13y agoThe C of statically typed functional languages is OCaml.
- asdasf 13y ago
- mavroprovato 13y agoJust because you should not explain to students what "public static void main(String[] args)" is the first day does not mean that you can never teach them. Actually, if your students cannot understand what this line is after one full class of Java, then the problem is with the teacher, not the students.
- steveklabnik 13y agoThe important part is not the 'never.' The important part is that the _very first thing_ you tell new programmers is "Don't worry about this, it's magic, just ignore it." This sets a certain kind of tone and expectation about programming that's quite poor.
- mavroprovato 13y agoOr you can say: "Don't worry about this now, we will explain it later" :-)
- steveklabnik 13y ago... which still gives the same impression: code is magic.
- rmrfrmrf 13y agoCompare to this: #include <stdio.h> int main() { printf("Hello world!\n"); return 0; } Woo! Your first program and I count, at most, 2 things that could be described as "magic" for someone who's never seen C before (the stdio library and double quotes being syntactic sugar for an array of chars). Even then, those two things are deterministic, so they won't remain magical for long.
- yongjik 13y ago"But what does 'return 0' do?" "It returns the value zero to the calling process." "Calling what?" "The process. Usually it will be the shell." "Wait, you just said process, what is this 'shell'?"
- dded 13y ago> Before people can write "Hello world", they're told they have to write "public static void main(String[] args)" Bootstrapping is hard. My introduction was in Fortran, and I had written a couple of sort implementations before I ever learned to enter an array by any means other than hard-coding it into the program. Kernighan and Ritchie did an excellent job with bootstrapping programming concepts in their book on C. And, somewhat off-topic, but since you mentioned Hello World and I mentioned K&R, it's worth noting that K&R's meaning when they said that Hello World was the first program you should write in any language was that you need to be able to run something. You have to be able to enter the program, compile it, link it, run it. Today a book can offer an example for Linux, one for Windows, and one for Mac and cover nearly everyone. Not so simple in 1978, when K&R first came out, so they basically tell you to get Hello World running with the help of a local expert (perhaps a teacher), and then come back to the book and start learning.
- DZittersteyn 13y agoA lot of the arguments against Java seem to focus on "Time-to-Hello-World". While I agree that the first time you execute a program and see those magic words appear on your terminal, I don't think we should judge a language on that. Visual basic has a very short TTHW (esp. if you take into account the time spent on learning about terminal emulators for most languages), that doesn't make it a good language. If you take an OO programming language as your teaching language, you need to introduce a number of concepts first. Hr 1: Talk about classes and objects. Introduce the Car and Bike object, that both have the method 'steer()', the attribute 'wheels' and only the car has the property 'hood'. Introduce return types here, as well as arrays. Hr 2: Then explain how the 'color' on Car is public, while you'd like the accelerate() method to be private. Hr 3: Explain how some methods and attributes are static. what is a property of the concept 'Car' and what is an attribute of an instance? In Hr 4 you introduce them to the classes String and System. Your students will now know: -class -public -static -void -String[] You can now tell them about the 'magic' that makes things start, the 'main' method. Class MyFirstProgram { public static void main(String[] args) { System.out.println("Hello World"); } } No magic, and a nice start to becoming a proper OO-programmer. If you want too teach them FP, Haskell is not a bad way to go. If you want to teach them OO, Java isn't as crappy as people say it is.