Thursday, July 9, 2009

Use the same environment for dev and production

One nice thing about Java is that it is portable. You can compile an application on Windows and run it under Linux, or whatever OS Java has been ported on.

While it is pretty nice, it is sometimes misused: people develop on one OS an application that is only going to run on another one in production.

And while it works, there is still big differences in both OSes, and to do some things, you then have to know how to do them properly in both OSes.

The thing is, if you are a baby Java developer that has only ever developed under Windows, are you going to be aware of the specifics of Linux enough to write production code?

Answers itself pretty easily doesn't it?

You have to have a deep understanding of the target platform you are coding for, we will all agree on that. And the only solution for this is for you to code under the same OS your code will run in production.

Let's be more extreme: my friend Amaury makes his team use Ubuntu Desktop for coding, and uses Ubuntu server for production. And I think it is the way to go: I'm sure by now his team knows the distibution inside out.

It enables them to write more maintainable code (ever tried maintaining a config file for Windows and one for Linux? A nightmare), as well as better code because they are proficient at using their production platform's OS.

Working all day long under your target OS is the best way to learn about it, and certainly the fastest.

The most annoying thing is that sometimes the dev have to stay under Windows because of some kind of dumb reason such as the mail server of the company being Exchange. In that case they are solutions. VMWare for example, or simply Evolution.

For the sake of clarity, let me take an unrelated example.

What is the fastest way to learn a language? You got it: living in the country. And you'll end up speaking like a native.

That's what I want.

1 comment:

Amaury said...

Thanks for citing me as an example. :-)

It's true. Using the same OS on development workstations and on servers avoid a lot of problems. I never heard a developer saying "I don't understand, it works on my computer" for an architecture reason.
More, we update all the machines at the same time. Thus, we are sure to have the same version of all packages (Apache, MySQL, PHP, ...) everywhere.

One day, we found that MySQL didn't manage correctly a tough request. We just had to update to the next version of Ubuntu to correct it. It would have been difficult to identify the problem - and to find a global solution - if we had an heterogenous computer park.

But having the same OS on every computers is not enough. Development is done under very specific conditions; on a developer's computer, there is a lot of projects and libraries which are "in progress" state.
So it's very important to have a pre-production platform, miming the production state. It's the only mean to test a new development in real conditions (well, as close as possible to the production conditions).

Post a Comment

Please leave your comment

Search Results