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.
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.
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 … 😊