Live data from Hacker News

"Should I still learn Java?" Answered: Yes.

beginwithjava.blogspot.com

31–40 of 108 posts

Re: "Should I still learn Java?" Answered: Yes.

#31
While I agree with the authors summation, Java will be here forever and a day, the real question one has to ask one's self is will Java continue to receive the developer mind-share in the future? this generally translates to all the cool problems are being worked in the mind-share language.

The second question is will Oracle further drive away developer mind-share?

I think the answer to both of those are self-evident and when analyzed in that light learning Java looks a lot like learning COBOL around the time Java hit 1.2. The cool stuff was happening over in Java which was now stable enough to take off.

I would say the big difference at this juncture is there is no clearly evident replacement at this point. As their was with Java and COBOL, but I do believe the mind-share shift has happened and we are all looking for the next king amount the court.

Re: "Should I still learn Java?" Answered: Yes.

#32
post #27

Earlier quoted context omitted.

I'd like to know as well. IMO, one of the few things Java is actually good for is to learn object oriented programming. - It has a pretty simple syntax, as it doesn't have too many strange or unintuitive language constructs. - Its verboseness forces the learner to understand what is going on and be thankful for the magic that more dynamic languages provide. - It's statically typed so it forces the learner to think ab…

- It is just barely object oriented (and Alan Kay agrees with me on this). Checkout CLOS and the MOP or Smalltalk sometime for a good object system. - No. Java has a complex syntax. Take a look at the grammar sometime. It's 10s of times longer than Scheme's (see: http://java.sun.com/docs/books/jls/second_edition/html/synta... ). You just like it because it's almost, kind of, a little, like C and C++. - It is, in larg…

Comparing the languages that use S-expressions to the languages that actually have syntax is a bit unfair, I think.

Re: "Should I still learn Java?" Answered: Yes.

#33
post #27

Earlier quoted context omitted.

I'd like to know as well. IMO, one of the few things Java is actually good for is to learn object oriented programming. - It has a pretty simple syntax, as it doesn't have too many strange or unintuitive language constructs. - Its verboseness forces the learner to understand what is going on and be thankful for the magic that more dynamic languages provide. - It's statically typed so it forces the learner to think ab…

- It is just barely object oriented (and Alan Kay agrees with me on this). Checkout CLOS and the MOP or Smalltalk sometime for a good object system. - No. Java has a complex syntax. Take a look at the grammar sometime. It's 10s of times longer than Scheme's (see: http://java.sun.com/docs/books/jls/second_edition/html/synta... ). You just like it because it's almost, kind of, a little, like C and C++. - It is, in larg…

- True; I was just considering the mainstream languages. Yes, if you include Smalltalk, LISP, I'm sure there are better alternatives to learn specific concepts. But Java is used a lot in practice, and looks a lot like other languages used in practice (C++, ObjC, C#, and friends), which in my experience makes students more enthusiastic.

- I agree the "generics" are complex and overly verbose. They almost look like the C++ templated types, which I would go around with a 10 foot pole if I wanted to learn someone programming... IMO, pre-1.5 Java was best for learning.

- Yes, a lot of the verbosity is pointless, I think it helps for learning to specifically mention everything and be a bit repetitive. Other languages luckily allow leaving the obvious stuff out.

Re: "Should I still learn Java?" Answered: Yes.

#34
Learning Java the language is not a big problem. Preventing a young Java programmer from becoming an architecture astronaut is. Most Java frameworks I have played with seem made by and for them (it's like they have been playing design-pattern bingo) and exposing young programmers to architecture astronautics may damage them irreversibly. By the time they start talking about real-life stuff like they are method invocations, they are lost.

Re: "Should I still learn Java?" Answered: Yes.

#36
post #15
post #9

Earlier quoted context omitted.

My kids, like their dad, won't have the patience to create a singleton main object, with a print method, just to run "print 'hello world'".

public static void main(String[] a) { System.out.println("Hello world");} Yeah you're right. That's an insane amount of typing which would take any kid hours. I had to muster up all of my patience just to type all that code out. You're right! Java is so verbose! Your "argument" if you can call it that, is like people saying lisp is crap because it uses too many brackets.

You forgot the

    class foo { ... }
And that it has to be in a name called foo.java. And that you have to compile it and run it with

    java foo 
instead of simply

    ./foo
And that startup time of JVM is orders of magnitude worse than pretty much anything else.

Re: "Should I still learn Java?" Answered: Yes.

#37
post #18
post #13

Earlier quoted context omitted.

My kids will get the full C drill. Basically the same way I learned programming. Training wheels are only necessary if you could hurt yourself by practicing. Where there is no such a danger there is no reason not to start with the "hard" stuff. It's like learning guitar or piano - you don't have a practicing instrument with only two strings/5 keys that always sounds good and forgives errors.

I'd skip C and learn assembly personally.

For which architechture?

Re: "Should I still learn Java?" Answered: Yes.

#38
post #15
post #9

Earlier quoted context omitted.

My kids, like their dad, won't have the patience to create a singleton main object, with a print method, just to run "print 'hello world'".

public static void main(String[] a) { System.out.println("Hello world");} Yeah you're right. That's an insane amount of typing which would take any kid hours. I had to muster up all of my patience just to type all that code out. You're right! Java is so verbose! Your "argument" if you can call it that, is like people saying lisp is crap because it uses too many brackets.

Your example illustrates one of the main problems with verbose languages. Imagine showing this line of code to a child! I think anyone new to programming would be completely baffled. Before they could understand even the "simplest" Java program they have to know what is meant by public, static, void, main, String, arrays and more...

Re: "Should I still learn Java?" Answered: Yes.

#39
post #20

Earlier quoted context omitted.

As someone who programs Java a fair bit, what bad habits do you believe it teaches?

I'd like to know as well. IMO, one of the few things Java is actually good for is to learn object oriented programming. - It has a pretty simple syntax, as it doesn't have too many strange or unintuitive language constructs. - Its verboseness forces the learner to understand what is going on and be thankful for the magic that more dynamic languages provide. - It's statically typed so it forces the learner to think ab…

IMO, one of the few things Java is actually good for is to learn object oriented programming.

You'd do better in an environment where everything is an Object. (No "primitives" to get in the way.)

It has a pretty simple syntax, as it doesn't have too many strange or unintuitive language constructs.

Confusing language syntax and semantics? Java's syntax is pretty large and complex by any number of objective measures.

Is this an instance of the "start a language war" game?

Re: "Should I still learn Java?" Answered: Yes.

#40
post #27

Earlier quoted context omitted.

I'd like to know as well. IMO, one of the few things Java is actually good for is to learn object oriented programming. - It has a pretty simple syntax, as it doesn't have too many strange or unintuitive language constructs. - Its verboseness forces the learner to understand what is going on and be thankful for the magic that more dynamic languages provide. - It's statically typed so it forces the learner to think ab…

- It is just barely object oriented (and Alan Kay agrees with me on this). Checkout CLOS and the MOP or Smalltalk sometime for a good object system. - No. Java has a complex syntax. Take a look at the grammar sometime. It's 10s of times longer than Scheme's (see: http://java.sun.com/docs/books/jls/second_edition/html/synta... ). You just like it because it's almost, kind of, a little, like C and C++. - It is, in larg…

Explain to me how: Map>> data = new HashMap>>(); is useful.

Firstly, in Java 7 or in Java 6 in a modern IDE, you only have to type:

  Map>> data = new HashMap();
So let's break this down: if I was using another language, I could just do:

  var data = {};
But consider what you've now lost:

1. If your code was just a simple associative array, not much. But if you have a complex nested data structure, you need to now put a comment somewhere so you don't forget what you're storing there. You can get into serious problems when multiple programmers are working on the same project if you don't clearly describe your data structures, and so you're not really saving on typing by writing Map>> because you'd have to document that in a comment instead. Since people are lazy when it comes to commenting code, Java therefore forces a degree of self documentation into data structures.

2. I notice that you're storing a Set of Strings (Set). As I'm sure you know, this means you can throw a bunch of strings into the set without worrying about duplicates. In Javascript, this would be messy. Since there is no 'Set' data type in Javascript you'd have to have an associative array where you store the string as the key and 'undefined' as the value.

3. HashMap isn't the only kind of map. In Java, you could use a TreeMap so that content is sorted in key order. This saves you code later by not having to take the associative array, converting it into a list, and then sorting the list.

4. In addition to TreeMap, another extremely useful kind of map is the ConcurrentHashMap, which allows you to manipulate the Map simultaneously from multiple threads (e.g. multiple simultaneous web request threads) without getting concurrent access problems or having to write your own synchronization code.

5. Tons of other really cool data Java datastructures available to you in the Java libs. E.g. WeakHashMap which won't prevent referenced objects from being garbage collected if they are dereferenced elsewhere, and LinkedHashMap which is useful for guaranteeing the order of stored objects even if they are removed and reinserted.

So although I agree that var data = {} can be more convenient in simple cases, that's not to say Java's approach has no upside.

Post reply on HN