Posts tagged ‘Languages’

Know What to Expect from your Programming Language

I often see people asking how to do things with a given programming language that it was not intended to do. Recently I read a post from someone who wanted to know how to take a java program and compile it to a .exe. For anyone who is not aware, Java programs are not compiled in the same way a C++ program is compiled. The java source code is first compiled to bytecode. That bytecode is then interpreted by the java virtual machine. The writer was intending to get a performance boost by having the code compiled rather than interpreted.

While it is true that a compiled language can be faster than a interpreted language, it is not the case that every compiler can out perform every interpreter. This is especially true if you are compiling code that was intended to be interpreted. There are Java compilers out there, but the Java interpreter is much more mature than any of them. In addition to the non-existent performance increase, by compiling this code you eliminate one of Java’s key features: portability. If you bypass the JVM then you will have to worry about which systems your code will run on and which they will not.

Ultimately, if you need code that is very fast the answer is not to take code in one language and tweak it into something it was never meant to be. This echos another problem: language dependence. Too often I see people who learn everything there is to know about one programming language, and never bother to learn another. Being a programmer does not mean being a C++ programming, or a Java programmer, or a PHP programmer, it means understanding the concepts of programming and having that understanding transcend multiple languages. This will remain to be true until someone comes up with a catch-all language that is ideal in every case. Until then if you need really fast code think about C++, if you want safe portable code think about Java. You should also be aware that these trade-offs are not absolute. Not every Java program is slower than an equivalent C++ program, and a poorly written C++ program is certainly slower than a well written Java program.

The example I mentioned above is only one of many. I’ve seen people that want to write desktop applications in PHP, write .NET apps that work without the .NET framework, and use javascript in an offline application. Though someone might have hacked something together that facilitates this, be aware that in most cases these implementations are not ideal. If you need to do something that the language you are using was not intended to do then that is a sign you need to branch out and become a programmer.

Expanding My Horizons

The more I learn the more I realize there is so much more out there that I have yet to experience. With regard to programming, I’ve gotten to a point where I am no longer limited to any one language. I do feel, however, that I have yet to experience the huge variety of languages out there. When it comes to software engineering, object oriented programming is pervasive. This approach, has so far, dominated my experiences as a programmer.

Yet there are many more approaches. Here is a fairly comprehensive list of the various paradigms out there:

Each one of these paradigms has its own list of languages associated with it. Some of them you’ve heard of, some of them are more obscure. Some languages transcend multiple paradigms (C++, PHP, Oz) while others are pure forms of its associated paradigm (Java).

My Goal

I’m primarily a Java and PHP programmer. This means that I’ve really only experienced two paradigms: Object-Oriented and Imperative (I’ve dabbled in functional using LISP, but not enough). My goal is to either learn a language, or a new approach with a language that I already know, that falls under every one of the categories above.

To get started, I think I’m going to take a shot a parallel programming, either in join java or Oz. This is most likely going to be an ongoing project for quite a while as school is devouring all of my time (honestly I shouldn’t even be writing this right now).