2008-11-21

Homogeneous programming style

I am currently on the smooth move from Visual Basic 5 to Java (for new projects). Although I did also some PHP and ASP my focus was on Visual Basic and VB Script for the last about 12 or 13 years. VB was a very good choice for my Windows focused development because the dialect for VBScript, Microsoft Office Macros and ASP was all the same and every COM-component developed with VB could be reused in Scripts, Office Macros as well as ASP web applications.

So whereever there was something to develop I could do it most efficiently using VB and reusing components or single methods I already developed. I also have some little experience with "language hopping" by using a little Python here and more PHP over there.

The experience tells me that every language has its own pitfalls and while hopping from one to the other you either trap in the beginners problems like missing a semicolon here or mixing up indentation there. If you can focus on one language which can be used to do everything then you should prefer that - you are simply more efficient in programming.

The two major benefits of focusing on one language:
  • Easier reusability of components and libraries you already created.
  • Better knowledge of the language and the pitfalls because you have more experience on the particular language.
And that was one reason (but far not the only) I have choosen Java. And although JavaScript is not the same as Java, it has at least same basic syntax.

Related post: The programming language.

2 comments:

Alexander Zagniotov said...

Hi Martin,
Do you really think that language is what important? I think if you understand the concepts, then you can easily learn the syntax and APIs of any language.

Martin Wildam said...

I think it is a big mistake to believe that language is only a little bit of syntax. To get used with the basic syntax in java took me about 3 days. But to understand generics here, delegates there is already more difficult. Not that these things can't be learned either but just think of Joshua Bloch's "Effective Java" book - there are so many best practice rules that are Java specific and similar applies to PHP and other languages.

Then we have to go on with packaging and deployment. .NET packaging and deployment is completely different than in Java or PHP. Think of the different dependencies of runtimes, libraries and that stuff.

Only after a longer while you know by heart the libraries - in Java for instance you will know which classes are synchronized and which are not and how critical the effects on the performance are.

This is also in the area of the second benefit I mentioned - better knowledge of the language and the pitfalls.

Then also we have the IDE - not all IDEs can be used for all languages and there are also language specific bugs in an IDE (bugs of the IDE).

I think to know well the libraries (APIs) of a language is the most work learning a new language!

And somehow particular things you have to re-implement every time you are switching to a new language. E.g. there is now one-liner to copy a file in Java or to add a tree node item to a JTree (you have to frickle around with the Model). Similar applies to .NET - there I neither have a ready-made method to split a string using more than one character because the split method does only accept a single char - at least I didn't find an easy method to split using a string with multiple characters. - Just to mention a few annoying things.