Defining code quality
It is tough to define the meaning of quality when it comes to program code. The reason is that all developers will have their own opinion of what it means. One developer can argue that we should focus on writing readable code as it will be easier to understand and maintain and, by that, reduce the chance of us inserting any bugs into the code. Another developer could argue that we shall focus on writing compact code; that is, as few code lines as possible. Even if the code is harder to read, less code will give us fewer chances to introduce bugs in the code.
Here, the two developers would argue for the same thing – fewer bugs in the code – with two contradictory positions.
Let's look at a small example using Python as our language. We want to create a list that holds all possible combinations we can get by rolling two dice.
The first one will use more code, but it will be easier to understand:
two_dice = [] for d1 in range(1, 7)...