A well known fact: the first love cannot be forgotten. Whatever that love was 🙂 a girlfriend, the first car, the first hand-made computer you put together from cheap pieces, years back in college. I think we all agree that this is only about sentimentalism, little practical advantages you can get going back to the first love.

And yet I discovered the exception, at least in my case. To make the long story short, I am now building some extensions and plugins for WordPress and, of course, that’s all about PHP and Javascript (under its many existing forms). You know, those nice programming languages which allow you advanced OOP but you can also use a lot of globals whenever you want or load a script in the browser and use it anytime while the session is open. And also you don’t have to clean the mess behind you, there are good tools doing that for you. Ok, that’s normal nowadays, we want to deploy everything as faster as possible.

Anyway, at a certain moment during the process I needed a kind of external small tool to help me test my big work. Working fast, safe and I wouldn’t mind to be client-side and having an oldie but goldie CLI interface, basically nothing fancy, you know, sysadmin style of app. You know sysadmins, those weird guys typing strange words on a black console screen full of letters.

However, I was looking for a couple of days to find a solution to build it faster and, almost out of the nowhere, the solution came in the form of my first love … I mean the first programming love, the old (and forever young) C++ . Pure C++ , for Unix (and for Mac), no fancy stuff such as Windows or something else. Yep, C++ , the root of most of the modern goodies, still present in the core of the modern mobile operating systems but also forgotten by most of the professional programmers.

After one week of writing again in C++ (following a 20 years break, while I was doing a lot of other things – some would say that those were much more important, after all I was CxO, wasn’t I? 😊) I realise that this is the exception that I was mentioning earlier. I was always a pretty conservative programmer with a kind of obsession for order … you know, declarations and defines on one side, implementation on other side or using always tabs and not spaces to have nice looking code or always putting braces and brackets in the same place. Even when I write PHP+Javascript+HTML although I am aware that it is not needed and I can blend and mix everything in one place. I also tried to learn from others by reviewing some of their code. Well, I think that it was like I was reading a story written in many languages within same covers but, as some says, coding is poetry 😊 … sometimes too much poetry can burn your brain out.

I was aware that I don’t have to be so strict and, although I did not give up on some of the basic principles of order, I started to behave a little as a much younger programmer, declaring variables when needed and using it without initialisation, relying on automatic casts and conversions, being careless about memory allocation or de-allocation. Of course these habits were expressed also when started again with C++.

So, what do you think? Do you think that my first love let me do what I wanted? No way!!! No appreciation whatsoever although I was coming back after 20 years. After 2 days I was about to throw my Mac on the window … nothing was working, I mean not like the app was behaving weird but not even being able to compile it … by the way, that was the moment when I also remembered that compiling, building and linking are different processes 😊 and each of it can generate weird errors.

So I took it step by step and remember how it is to take care of declarations and defines, how wrong is to compare a string object with a string referred by a pointer. Although both are strings, nobody but you is taking care about casts and conversions and things will not fly if you don’t care. I re-discovered what happen if you do not specifically allocate memory for some variables and you don’t care to free it when not needed anymore. But this is not the main point!!!

The most important thing that I re-discovered was rigorous and structured programming, not because I wanted but because is the only way to build in C++ something that actually works. Now we are friends again, I cannot say that we are in love although we spent a couple of nights together since I went back.

I am pretty sure that I will put in practice for other projects (non C++ ) what I re-discovered these days and this will increase the quality of my code. In fact I think that I also can give a piece of advice to the software project managers or team leaders … when you feel that the governance rules for development doesn’t produce the expected results and the code produced by the team looks like a weird story written on different paper, different fonts, languages or colours … take a break for several days and give to your team an assignment to write a simple C++ app. Nothing fancy … pure OOP, command line interface, cross-platform. That will bring some order in the galaxy … 😊

Leave a Comment

Your email address will not be published. Required fields are marked *