Sunday, March 30, 2008

Things I Hate About JAVA

It's ranting time and I am officially enclosing this whole blog in a big fat rant tag:

<rant>

First off I'm not an über java programmer so coming from other languages I've picked up a thing or two about how I would expect languages to be programmed based on convenience and consistency. I'll keep this short and only hit my major gripes:

Why Java is EVIL:
  1. Bad plugin implementation - how many times has an applet crashed your browser or not work cross platform? Granted it has come a long way and it really depends on who programmed the applet, but in general you have to blame SUN for poor implementation. They should have fixed it way back in 1.0. If they did flash most likely would never have hit the market. Now I find client perception in Java to be slower than Flash (especially AS3).
  2. Programmatic Inconsistencies - why is it that to get a length of a string you use: string.length() and for an array: array.length; and for a vector: vector.size(). Who programmed this crappy language? Yes I understand that a string is an object and that length is a property of that object, but why not make a function? I understand the concepts however backwards they are.

    I have an idea: how about using a method for everything and calling it .length() ? Just make all arrays have a default method called length(). Same with vectors (why oh why did they choose size() ). Remember if you want people to pick up your language, make it easy for them to do so.
  3. Java Docs - OHHHH how evil these are. They are god awful in design and usage. Their initial examples suck (if they even have any). Why not have an example for everything in there (method specifically). If you have a method called length() give me an example. I don't care how simple, just an example. Don't make me search the web to find an example when you could easily make one. Remember if you want people to pick up your language, make it easy for them to do so.
  4. Last but not least I HATE - I repeat HATE "Null pointer exception" . I give this one big WTF Sun. Yes I get the premise behind it - I am using a variable that hasn't been initialized or something else along those lines. Don't just tell me "haha sucks for you, you have a null pointer exception" TELL me where it is. Where am I calling it, what is the name of the variable/object etc that is null? Lets take a look at a JSP example (since I happen to be working on this now):
    [31/Mar/2008:08:29:15] failure (15460): Internal error: servlet service function had thrown ServletException (uri=/cp/www/registration.jsp):$
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:453)
    at _jsps._www._registration_jsp._jspService(_registration_jsp.java:826)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:259)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6(JspServlet.java:249)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:530)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:599)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:943)
    at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1094)
    at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:1005)
    , root cause: java.lang.NullPointerException
    at _jsps._www._registration_jsp._jspService(_registration_jsp.java:620)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:259)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6(JspServlet.java:249)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:530)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:599)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:943)
    at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1094)
    at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:1005)


    Where is the line number in the JSP? What variable? What object? Throw me a bone here Sun! Now I have to use System.out.println to track down the freaking line that it is on. Yes I know you can go to the java file that is precompiled and try to find it in there. That sometimes works, however System.out.println 's are often just as fast.

    ALSO - I give kudos to Macrobe for making ColdFusion user friendly. ColdFusion is built on top of a Java runtime and when an error is throwing in CF it (usually) tells you the line number/variable etc etc. Good Job guys! I imagine your programmers went through hell to get that working.
Java how I hate thee...

</rant>

No comments: