Skip to content

Java must be stopped

by Jason on August 20th, 2010

Java has past its expiry date. It is no longer the only cross platform, fast language available. There are few examples of widely used Java applications. The few popular ones there are are noticeably slower and more resource intensive than native apps. And as a developer, I waste far too much time worrying about types in Java and generally writing out a lot of boiler plate code. Here are some examples of Java compared to Python (a more modern language):

converting an integer to a string in Java:

String aString = Integer.toString(aInt);

converting an integer to a string in python:

aString = str(aInt)

consider using a dictionary, or hash map in Java:

Map<String, Object> env = new HashMap<String, Object>();

in python:

env = {}

Notice how much cleaner the python implementation is? I don’t even need to care about types, actually, I don’t even need to worry about using semi colons. Python enforces nice looking code by forcing the developer to indent properly. How cool is that?

As a C++ programmer, getting past the concept of a dynamic typing language as easy to work with as Python was tough. But the reward so sweet. Using duck typing, I can make a function that takes in any sort of argument and all I need to ensure is that the argument has a certain interface.

For example, if i want to write a simple function that outputs a string or integer in Python, I could write the following:

def outputVariable( arg ):
    print str(arg)

To do the same in java, I would need a class and two functions (one for a string, one for an integer):

class Outputter {
    public void output(String arg) {
        System.out.println( arg );
    }	

    public void output(int arg) {
        System.out.println( Integer.toString(arg) );
    }
}

It seems to me that since punch cards computer languages have been evolving to be more easily read and less verbose. With each new generation of languages allowing developers to write one line of code that would be the equivalent of 10 lines of code had he used an older language.

There are two main reasons why Java and C/C++ are still the defacto standard languages: there is an existing large Java and C/C++ code base to maintain, and to replace it all would be a very expensive undertaking. And also, there are many Java and C/C++ programmers. Many of whom aren’t even aware that there are easier ways to write software.

There is an argument for learning Java: it’s more likely you will find work with Java. But if you are interested in just writing solid software quickly, you should consider using a language that is more congruent with “quickly” and “easy” than Java.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • RSS
  • StumbleUpon
  • Twitter

From → Uncategorized

3 Comments
  1. Dan D permalink

    Although, isn’t it the case of Java and C++ in large projects, being simply faster at executing than Python, as Python is simply an interrupted language vs a compiled one like java of C?

  2. I agree with Dan. Python seems to be less scalable for really complex systems. Something like jboss or eclipse would grid to a halt (speculation) if it where written completely in Python.

    That’s not to say dynamic language like Python or Ruby can’t be used for complex system, they are simply extended in such cases with some parts implemented in C and exposed as a module.

    It sounds like what it comes down to is static vs dynamic languages and which is more expressive. I would tend to agree that dynamic languages are much friendlier on the eyes.

    NSString *str = [[NSNumber numberWithInt: 10] stringValue];

    yuck!

  3. Jason Spitkoski permalink

    When it comes to speed, there are many examples of python performing just as fast if not faster than java or C/C++. The problem with saying “Java / C is faster” is that you assume programmers know how to truly use Java or C to be fast. When using Java, things slow because developers use many libraries and frameworks. These need to be loaded and initialized, which takes time.

    Funny how only a few years ago the argument was “C++ is faster than Java because it is compiled and Java is interpreted”. There are many examples of Java performing just as fast as C++ or even faster.

    Most developers don’t care that much about speed cause most apps they make don’t need to be especially fast. I would say that most Java dev’s I know like using libs and frameworks. Libs and frameworks both make your life as a programmer easier but comes at the cost of more app bloat.

    If you want your development to be easier, use an easy-to-use language and stop trying to put lipstick on a pig. My two cents

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS