about me about me
photography photography
software projects software projects
contact me contact me
25
Nov

Java impressions

posted 2006 // code, java // 0

This was meant to be a lengthy comparison of the stumbling blocks I found learning Java having come from PHP. However learning Java is currently on the back burner so I thought I’d post what I have anyway.

Back in September I purchased Head First Java (I had to see what all the fuss was about with the Head First series). This book has a prerequisite of previous programming experience which I don’t think is necessary, the first few chapters cover very basic of programming concepts.

I’d recommend this book to other PHP developers looking to branch into OO, I think OO concepts are better learnt from the Java community than PHP at present.

Behaviour that stood out compared to PHP:

  1. Java is strong typed but you can do this:

    boolean a = true;
    boolean b = a;
    System.out.println("If a is true, b is " + b);

    Output: If a is true, b is true

    I thought being a strong typed language b would have to be cast as a string or explicitly have its type changed but this appears to be automatic. My initial thinking was __toString() was being called on these variables but in hindsight these are primitives and not objects.

  2. Java is not a web oriented technology, consequently there’s additional complexity to deal with the peripheral elements of it that aren’t of use to web programming.
  3. Java feels like it’s more complicated than it needs to be, the core language is fine (POJOs etc) but getting things like JSPs working on Tomcat was a headache.
  4. The deal breaker: learning Java isn’t as fun Ruby.

comments

No comments for this post.