Eliot’s Tips and Tricks

Other languages

I could say my principle language is C++ which I have a love-hate relationship with it. I love how you can write very efficient code with C++. I dislike it’s complexity. It’s an easy language to shoot yourself in foot with. You really have to work hard to stop your team from using every feature in the language. Template meta programming is a great way to transform time and money into nothing. I tend to advocate what I call C+ programming which is cutting things down to a very limited subset of the language. That tends to grate with experienced C++ programmers who tend to love to show their mastery of every part of the language.

Sadly I would say C++ is not suited for most commercial development. It’s good in that it’s an open standard language and supported in many environments.

I’ve done a lot of Delphi development since the entire Chameleon GUI was written in it. It’s a pain though that it’s now stuck in 32 bit form of a declining platform, WIN32. For its time Delphi was impressive. It’s still one of the fastest strongly typed language compilers I know of. Its biggest drawback is it’s owned by one company.

I’ve done a smattering of C# and Java since we needed to implement stub code support for them from Chameleon.

Done a fair bit of Python but it’s not a language I ever had much love for. I picked it back in 1998 for Chameleon. Seems to be popular for many people. I always saw it as a means to an end. Compared to other dynamic languages like Javascript and Lua to me it seems rather hairy with too many unnecessary features.

Javascript (ECMA) is an important language for since it’s the language of the web. There you really have no choice unless you want to go and use that funny thing that google has GWT. I’ve never used it myself but I know people that swear by it. For us though the Translator is built on a lot of Javascript with the data most served up from the backend using JSON.

Lua is obviously another language that I have had a lot of experience with. It’s my favourite dynamic language. Lua had a lot more time to be ‘fully baked’ compared to Javascript. I would agree with Douglas Crockford’s statement about Javascript that : “It never got a trial period in which it could be corrected and polished based on actual use. The language is powerful and flawed.”

Lua on the hand has had a long time to be carefully honed and refined over time. It’s surprisingly widely used in applications where performance and having a small memory footprint is important. Lua is about the most simple a dynamic language could be without losing it’s power. I’ll have more to say about it later.

In general at this point in my career I think you could program ‘good’ code in just about anything. For me good code is about keeping things simple, modular and decoupled. I try to use as few features of the language as I need to. The most challenging part of programming is always to get a good understanding of the domain problem.

I had a programmer called Randy that I think put it very well. (he was complaining about some awful code we had in Chameleon back in 2007). The way he put it:

In the early part of my career I wrote simple code because that was all I knew how to write. When I got more experienced I wrote complex code. Then I went back to writing simple code not because I didn’t know how to write complicated code but for the reason it is much easier to maintain and use.

Although I didn’t appreciate the message at the time (it was the code I earned my living from) he was absolutely right. It makes total sense to avoid getting fancy with code more than you need to and keep things simple and dumb. That way you can debug it more easily, other people can understand it and you yourself can understand it when you come back to it in six months time.

It’s actually A-okay to write a few more lines of simple linear code than to try and it it using more clever code. It’s just a matter of giving yourself permission to do so.

Tagged: