Wednesday, December 20, 2006

To compile or not to compile?

That is the question... I had a conversation with a few guys from our local Java Users Group about PHP, Ruby, (scripting languages in general) vs. compiled languages. I have a background in both so I had some strong opinions and thought I'd jot some of them down.

First off, I am of the opinion that scripting (dynamic) languages and compiled languages have their own respective places in programming. There are good and bad languages out there and whether or not they are compiled doesn't enter that argument. People calling scripting language users "hacks" is ridiculous. This is most likely coming from someone having done compiled language development all their career. The one time they tried scripting something, they got bit by the loss of type safety or could not "refactor" or something along those lines. We mock that which we don't understand...

The fact is, scripting languages give you more flexibility, but with that comes responsibility. I worked in a group that did scripting for Web stuff and we had TONS of code, no IDE (just vi) and had successful "deployments" all the time. You have to know what you are doing when you start messing with a scripting language code base. Now if you start mucking with some code written in Java, you can use an IDE to help you along the way. I think it much easier to get your feet wet in Java once you understand OO due to the great IDE's out there that will help you. But once you get going with PHP or Ruby... you can fly, and your development becomes more agile due to the flexibility an interpreted language gives you.

I write code in a few languages, compiled and dynamic... and the bottom line is: the code you write is really just a dumbed down human version of instructions, it's documentation. A compiler (at some point) interprets your mess and sometimes through more conversions finally makes something the computer can understand. You can't argue which is better unless you are talking about a specific problem domain with all else equal.

Happy coding!

No comments: