Trial & Error Programming

by Ger Cloudt, author of “What is Software Quality?”

credit: www.geek-and-poke.com, CC by 3.0

When browsing the internet I came across above cartoon of “geek & poke”. It reminded me of interviews with job applicants in which I noticed that they do not know what they’re doing. “Good coders know what they’re doing…..”, then why is it so hard to find good coders?

It is one of my biggest disappointments that it seems that many people who claim to be a software engineer do not understand coding anymore. Presenting a basic piece of code with some basic pointer algorithm in C is not understood by job applicants who claim to be knowledgeable and experienced in C-programming. Asking them to solve a simple programming assignment brings many of them to despair……..

Wondering whether I would be the only hiring manager in embedded software stumbling across this problem I started some searching on the internet and encountered “why programmers can’t program” from which I learned I am not the only one encountering this problem. Reading blogs on experiences of recruiting and interviewing SW engineers it seems they have the same problems as I have.

Punch Cards

Having some thoughts about how I learned programming myself in the late 70’s and early 80’s reminds me of the “good old days” in which we did not have an editor. No, when I learned programming we had to use punch cards. You had to type your code using a punching machine producing punch cards. Each line-of-code was captured on one punch card, resulting in a pile of punch cards to be delivered to the computer facility and the day after you could examine your results.

Because you needed to wait for 1 day before the results of your program were available there was quite a threshold in getting these results. Because of this threshold you made sure that you did review your code, together with your colleagues, over and over again to be sure you understood your code such your run would be successful. If not you would have lost at least a complete day.

Press F5

What a contrast to nowadays tooling! In modern IDE’s (Integrated Development Environment) you can type and modify your code and pressing e.g. “F5” will compile-build and execute your program instantly.
In case of any syntax errors you will get feedback in less than seconds and if the build succeeded you can execute your program and tests immediately with fast results. You do not need to wait anymore for any results, results are available instantly. Why worry reviewing your code? Why worry understanding your code? The tooling and test cases will immediately inform you about your success or failure. There is no threshold anymore in the possibility to try changes and see whether they bring the wanted result.

Trying to make it as easy and fast as possible to code and check your results is an invitation to “trial & error” and programmers will start rely on the tooling available.

Automated testing

Next to the modern IDE’s, which help us in coding, we usually automate everything we can automate, enabling a sweet execution of test cases detecting regressions as early as possible. A good practice because when a regression is detected early, it is easier (and cheaper) to correct.
Secondly when changes are made to your code or code is refactored your automated test suite also is used to see whether unwanted side-affects or regressions are introduced.
However the problem, again, is that programmers start to rely on this automated test execution, even if you do not completely understand your code and the tests are passed successfully your program is considered to be ok.

The problem lies in the fact that your test suite can never reach a coverage of 100%. Running all possible execution paths through your code is impossible and there will be always happy-, alternative- or sad-flows which are not executed during your automated tests.

That’s why it is important not fully to rely on your tooling and automated tests but still understand your code and know what you ae doing!

Whiteboard programming

And then we ask the job applicant to produce a piece of code performing a simple basic task on the white board. No IDE, no build, no test cases. Explaining and discussing the code produced with the white board marker. To be honest….., a great way in learning to understand coding. Once, one job applicant who failed the exercise, thanked us afterwards expressing he never learned as much in one hour then during the interview.
Therefore, to become a “good coder who knows what he/she is doing”, do not use the IDE, build and test cases for proving your solution right­ but instead review, discuss and understand your code before pressing “F5”.

Compiler Warnings?

by Ger Cloudt, author of “What is Software Quality?”

Recently at a conference I had a discussion with a quality manager about enforcing quality rules like solving all compiler warnings. No doubt, compiler warnings need to be solved. Period! However my position in this discussion was that it should not be necessary to enforce such a rule. Each software professional or software craftsman does not need such enforcement, they make sure no code is committed still containing any compiler warning. “Then…., how come we are releasing software with hundreds of compiler warnings?” was the reply…….

Good question….., how come in our industry still software releases are made containing many compiler warnings? Actually, after some further discussion in which legacy code, 3rd party code, open source code was addressed, we came to the conclusion that we cannot hide from our own responsibilities as software professionals by blaming legacy code or 3rd party code. Still our own new developed and altered code might contain compiler warnings. But if actual software professionals do not commit code with compiler warnings……., does that imply that not all of us are actual software professionals?

Low threshold to become a software engineer

Let’s have a closer look at becoming a software engineer. If there is a lack of professionals in a certain profession people will jump on it. Jobs all over the place. Combine this with the very low threshold to produce any software and it will be very easy to jump on the possibilities we have due to lack of software engineers.

How easy is it to download a compiler and write and execute your first program? How easy is it to search the internet for any piece of code and copy it into your program to get a result?. How easy is it to learn Python and start programming? Programming is easy! Isn’t it?

Let’s go back to the compiler warnings. Some of those compiler warnings are not so easy to solve. You need to understand what is meant by the compiler warning, why is this warning produced and what is the risk if not solved? You need to understand how the compiler is compiling certain constructions into machine code dependent of the selected optimization. You need to understand stack mechanisms and how memory is handled. You need to understand the underlying CPU architecture and how types are implemented in this CPU architecture. And even then it is not always trivial what’s meant by this specific compiler warning. When solving a compiler warning you need to understand why this specific compiler warning is a warning and what needs to be done to solve it in a proper way. Programming is difficult! Isn’t it?

Shortage of IT-people?

Recently an article was published on a respected Dutch news site with the title “Shortage of IT-people? An archeologist is also a fine programmer.”. The article was addressing the problem of finding good IT-people and provided the solution in recruiting people with completely different education and provide them a retraining process in IT of 3 months. From this article you can only draw one conclusion. Programming is easy! Isn’t it?

Then……. I wonder….., Technical Universities are offering complete Bachelor and Master programs fully dedicated to Software Science. Programs of several years of studying software in which subjects as discrete structures, operating systems, software engineering, algorithms, design patterns, computer architectures, design methodologies, data modelling and databases, distributed architectures, computer networks and security, imperative programming, declarative programming and so on are addressed. If an extended education like this seems to be needed to become a good software engineer you can only draw one conclusion. Programming is difficult! Isn’t it?

Software runs the world

Let’s stop the discussion whether programming is easy or difficult, let’s consider the importance of software in our daily lives to determine whether we should take software seriously.
Software is everywhere. Can you imagine how much of your life is running by software? Software runs your car, software runs your TV, software runs your vacuum cleaner, software runs your smartphone, software runs your heating system., software runs your banking system, software runs the public transportation system, software runs the airport control,……….. Software runs the world.

Software runs the world, it is applied everywhere and it is not bug-free. Therefore a bug in software might have small consequences but it might also might have catastrophic consequences like severe injury or even death. Because software is so determinative in our daily lives its quality needs to be at a high level for which we need highly educated professionals. Software failures can have catastrophic consequences…….., let’s take software seriously, let’s ensure we have highly educated programmers, let’s solve all those compiler warnings!