|
Post by Z on Mar 14, 2008 21:27:07 GMT -5
I've noticed that several people here are studying computer programming using the Java language. Java sucks, and you should not use it when you have a choice.
The fundamental problem with Java is that it's designed around the false assumption that code can be made easier to read by forcing "good" object-oriented style on the programmer. This becomes a problem when the problem domain of the program being written doesn't match up with Java's idea of good style. Since Java lacks abstractions like multiple dispatch and first-class functions, code to solve ill-fitting problems becomes bulky and convoluted as the programmer has to act as a human compiler for some higher-level language existing only in his head. I could elaborate on this a great deal, and probably will if anybody wants to debate this issue.
So if Java sucks, what should you use? It depends on what you're writing. OS kernel or driver? It's hard to beat good old C. User application? Common Lisp and Scheme are both nice for this. Web application? Common Lisp, Python and Ruby work great. Short script? Ruby, Python and Perl were made for this. Cluster-based app? Erlang was made for it. Something that needs to be provably correct? It's hard to beat Haskell.
|
|
|
Post by Furtive}Nachos{ on Mar 15, 2008 9:28:07 GMT -5
Ok, well i am a new programmer but i think Java is a decent language to begin with. I dont know that much about many other languages but i know that once i took Java I, visual basic was a breeze. I cought on to Java rather quickly and within 9 weeks i had a nice amount of it understood. I think in a way it is the base of all programs. I mean most programs relate or have come from Java. If you look at coding in IRC, Visual Basic, or Javascript. The coding looks similar to plain old Java. So this is how i feel of why Java is a good language to start on. Now debating about if java in general sucks or not... My answer.... No comment.... ~Phil
|
|
|
Post by Z on Mar 15, 2008 13:34:58 GMT -5
Java as a teaching language is, perhaps easier to attack than Java as a professional language. Java requires learning a whole bunch about Java just to get it to accept your programs, which takes time and mental effort away from learning how to write programs. To give a simple example, here's "Hello World" in Java: public class HelloWorld { public static void main (String[] args) { System.out.println("Hello, world!\n"); } } Here, we have 13 tokens (a token being a keyword, the name of something or a literal value, but not punctuation like semicolons and braces) just to print a string to the console. By way of comparison, here's "Hello World" in Ruby, Python, Perl, TCL, Lua, several variants of BASIC and a bunch more that I'm not going to list: print "Hello, world!"
Two tokens. That's it - no boilerplate between the concept in your head (print this phrase to the screen) and what you have to tell the computer. You should not have to learn about classes, type declarations, return values and arguments before you can display a string on the screen. These are all important concepts for a programmer to know about, but they get in the way of the problem being solved at this point. Here's a more in-depth example. Write a function that takes an array (or other appropriate sequence type in the language you're using) of strings and a separator, and returns a single string containing all the strings in order, separated by the supplied separator. Here it is in Java without any class boilerplate (you would have to stick it in a class to use it): public static String join(Object[] array, char separator) { String result = ""; for (Object object : array) { result = result + separator + object; } return result.substring(1); } 27 tokens. Here it is in Arc: (def my-join (seq sep) (reduce (fn (str1 str2) (+ str1 sep str2)) seq)) 16 tokens. Ruby: def join(seq, sep) seq.inject do |str1, str2| str1 + sep + str2 end end Also 16. It will be similarly short for any language having first-class functions or blocks (in the Ruby sense of the word). The Java version might be shorter and easier to follow if one could implement reduce in Java, but it's not possible because Java lacks any reasonable way to pass functions as arguments to other functions. The object of any introductory programming class should be to teach fundamental concepts of programming, not a specific language. The language used for this purpose should stay out of the way. Ruby, Python and Scheme do this. Java does not.
|
|
|
Post by TheElite1]>USK<[ on Mar 15, 2008 14:12:06 GMT -5
I've always wondered why the high school im going to doesnt teach C or C++, all they have is visual basic and java...
|
|
|
Post by Furtive}Nachos{ on Mar 15, 2008 15:05:05 GMT -5
If you compare the languages they are very similar, it is like saying this....
You can take 5 years to learn 5 dif languages. Or.... in 2 years you can Learn Java, and in the next 3 years learn those other 5 languages.
Java seems like a base language for programming. Yes it is WAY more complicated than many languages but it the connection bridge between the mass of the languages.
You can compare visual basic to Java and laugh. There was a kid in a VB class that said it was a little dificult, and next semester he was taking Java. Well you would figure if the languages were similar he would do better in the second one because he already knows something about programming. NOT! He failed out of Java because it is alot more complicated and it is a NECESSITY to have your capitals in the right spot and your punctuation perfect.
It is a more hard language to learn but it is more beneficial in the long run.
Here is a great example. You have a child, and you can teach him any language out there. What few languages would you teach him first? To mee you are saying things like.... spanish, or an easier language to learn. But i am saying English because it comes from many different languages, is used globally, and is more complex than many other languages.
~Phil
|
|
|
Post by Z on Mar 15, 2008 16:32:12 GMT -5
Java as a "base language"? I assume you mean to say that Java somehow comes before several different languages on their evolutionary path. If the languages you're talking about are VB.NET and C#, you may have a point. Otherwise, I don't know what you're talking about, but please feel free to explain. Java is in the C family as far as syntax goes. The basic design process seems to have been to start with C++, remove the features that might be confusing, make class/encapsulation based object-orientation mandatory and run it on a bytecode virtual machine. Despite the name, Javascript is only superficially related.
Learning a new programming language doesn't take very long if you're already familiar with all its concepts. A good Java programmer can learn C# (the language, not the .NET library) in a day or two, but learning Haskell or Scheme might take the same person weeks or months even though those languages are actually simpler. The Java programmer could sit down and start writing Java-like code in Scheme after a day, but reading idiomatic Scheme code would take time because Java lacks concepts like macros and first-class functions that are used constantly in Scheme.
I'm trying to make two points. That Java is hard is not one of them. They are:
* Java gets in the way of teaching programming because it requires that too much time be spent on the limitations of Java instead of general programming concepts * Java is a bad language for learning programming because it is too limited, making it harder to learn more advanced languages later
|
|
|
Post by TheElite1]>USK<[ on Mar 15, 2008 20:52:22 GMT -5
I'm trying to make two points. That Java is hard is not one of them. They are: * Java gets in the way of teaching programming because it requires that too much time be spent on the limitations of Java instead of general programming concepts * Java is a bad language for learning programming because it is too limited, making it harder to learn more advanced languages later which makes me wonder why they teach it everywhere
|
|
|
Post by Z on Mar 15, 2008 21:02:22 GMT -5
That's easy to answer. They teach it everywhere because it's popular in industry. Why it's popular in industry is a bit harder to answer. The short answer is that C++ and COBOL were the default languages for developing applications, and Java was better than both of them in most situations.
|
|
|
Post by ineedhelp}N{ on Mar 15, 2008 21:27:03 GMT -5
im with z on this one ive found java to actually be quite tempermental at times and just a downright pain on others where as say a visual basic/delphi/c++ and other sorts of applications you can do so much more to diagnose problems with it in my eyes
|
|
|
Post by Z on Mar 15, 2008 22:40:03 GMT -5
Well... VB, Delphi and C++ also suck, but that's another discussion.
|
|
|
Post by ineedhelp}N{ on Mar 15, 2008 23:56:29 GMT -5
well seeing as they were mentioned i compared them
|
|
Pi
Full Member
3.14159265358979323846...
Posts: 186
|
Post by Pi on Mar 16, 2008 11:55:06 GMT -5
so what doesn't suck and what would you use to teach kids functional OO programming?
|
|
|
Post by Z on Mar 16, 2008 13:46:56 GMT -5
I already covered what doesn't suck for writing software, but I forgot to cover what might be better for education. If I was teaching a beginning class, I'd use Scheme. Scheme supports any of several programming paradigms that might be useful to a student. It's possible to write purely functional programs, imperative programs, object-oriented programs and more. It also has one of the world's best introductory programming books: The Structure and Interpretation of Computer Programs, available online, free from MIT. If teaching OOP was a goal, I would have them analyze several of the object systems available for Scheme in class. There are Java-style single-inheritance, encapsulated, multiple-dispatch systems available. There's also at least one clone of CLOS, a multiple-inheritance, multiple-dispatch, generic, non-encapsulated system. The final project would probably be to have students design their own object systems and use them to write applications. Python, Ruby, Lua and Smalltalk are also good options for a beginning programming class. A full computer science degree should include concepts that are better taught using C or an assembly language, domain-specific languages like SQL and a purely functional language like Haskell. I'd probably include Java in a languages course, but not use it for teaching other concepts.
|
|
|
Post by Kethoth]>USK<[ on Mar 16, 2008 14:41:57 GMT -5
Hello, My name is Kethoth and java is worse than C#.
|
|
|
Post by TheElite1]>USK<[ on Mar 16, 2008 16:22:54 GMT -5
Hello, My name is Kethoth and java is worse than C#. lol
|
|