Monday, November 15, 2010

Re-using Java

The first programming language I worked with as a professional was Java. It seems to me as an excellent language to start learning real software development (as oppose to learn how to program, for which c is my language of choice).
It teaches you to think also on the architecture of the software (as it is reflected in the package structure). It forces you to understand various design patterns (some of which comes along with the language). It introduces you to the need of working with frameworks (the large set of Java packages, as well as external libraries), and on top that, the rigid typing with the tough compiler are just like two good parents that show you the where are the limits and does not allow you to cross them. I've worked with Java for about 6 years, and learned a lot from it.

Time had passed and I started another project, in which I had to develop in JavaScript. At first, I just wrote Java code in JavaScript (the fact that I worked with the Dojo toolkit made it really easy). Then, I started to learn the difference between the languages, I started to see the power that JavaScript gives you, was overwhelmed by the breaking of almost any limit that Java had taught me. I got to a point where I write JavaScript code in JavaScript,  use its flexibility and its dynamic nature, as well as the various brilliant programming concepts within it.
I crossed the limits that Java taught me, and allowed myself to do so based on the belief that I'll know when to stop and what lines not to cross.
It is so much easier to write software in JavaScript if you know what you are doing (especially how does your code is really read by the machine).
It is much easier to make a big mess too, this must alway be in mind - no parents, you can run freely, nobody will prevent you from failing and falling.

A short while ago I had some free time on my hands, and wanted to learn something new, so I developed a small android application.
In Java.
Initially I thought that it would be just like riding a bicycle, but it turned out to be more like riding a rusty old bicycle, where you cannot almost turn the wheel, all that with one hand tied behind the back.
The package structure is still there, as well as the rich set of libraries and Java packages. BUT, the rigid type system and the compiler are not a directing parents any more, they are more like a bureaucratic figure that forces you to do what you don't want (in order for him to approve your request).
The no dynamic nature make no sense now, sometimes I wanted to polity ask the compiler to move aside and just trust me - I know what I am doing.
It is so burdensome to write software in Java.

Java is great to start with, but it takes you just up to a certain point. And from there, if you do want to expand your abilities, by not just learn new syntax, but rather learn another way of thinking, go with JavaScript, you'll never want to go back.

2 comments:

Unknown said...

Java and to some degree .Net are the main choices because they have been consistently pegged as the “safe” choice to go with for mid-level project managers in the corporate world. No one was ever fired for choosing Java or Microsoft.

However, there are many large distributed applications these days that run primarily with technologies like Python, PHP, et al. Even companies like Google and Yahoo are heavily invested in these technologies. Java may be the main choice for enterprise development now, but it’s days are numbered as the only stalwart option to go with.

Let’s face it, many of these so called “enterprise applications” could easily have been written much faster and with less overhead using technologies like Python, PHP, et al.





OpenCL Training

Yoav Rubin said...

That's right. It is alway better to think what is the right technology to use, and not rush into Java or .net.

I myself prefer to have a clean cut technology-wise between client-side and server side, so I an no PHP fan. Having Ruby / groovy / Python on the backend and Ajax technologies on the frontend is my preferred way of thinking.

Having said that, I think that novice developers should learn how to build large applications using Java, and once they got the idea of what is right and wrong there, push the limits with other, more flexible technologies.