On a clear day I can see forever.

Clarity is good. When I look at my code, the bit I am writing right now, if it is clear, I can understand what it does, why and how. If I look around at the other pieces of code I am using and they are clear I can understand what they are doing and why, and no doubt if I care to look inside them I can discover how, though because they are clear I do not need to do that. It doesn’t matter if I wrote them, or someone else did, because their intention is clear.

If my project manager looks at my software and all is clear, then even though he doesn’t understand what I have been doing, certainly not in any detail, he can still understand what it does and why.

If my users look at my software and all is clear, then even though they have never seen the source code, nor programmed a line of code in their life, and even if they have, it doesn’t matter because the intention is clear and they understand how the software works and why. They can see how to do what they want to do, without needless detail nor resorting to manuals or forums or google.

If everything is clear, everything is good. And if everything is not good, I can fix it, because its clear what is not good and why and how.

So when I name my variables and functions and classes I think for a moment, so I can be clear about what I want this thing to do. And if I change my mind, because something has become clear to me, then I change the name of the variable or method or class so it is clear for everyone. Sometimes a class or function or variable is not used clearly and is confused, so I change it, split it up, merge it together, rewrite it until it is clear or as clear as I can make it right now. But I come back to it.

You might think, um, doesn’t this take time, well yes it does, but you have to speculate to accumulate and I do and so I do. So when the software is complete and everyone can see it is complete, it took less time and works better. Though that is not always obvious to everyone.

And it is good and I know it is good, because it is clear, at least to me.

There have been studies made, many, many studies and it turns out almost all programming is thinking, of the order of 80% (Glass, Robert L. Facts and Fallacies of Software Engineering – Fact 22 – I implore you to read this book, if you havn’t already, it contains what appear to be actual facts), in fact almost all software development regardless of the activity is thinking, of the order of 70% (Fred Brookes via Allen Holub here). So if it is clear, I can get to understanding more quickly and from there I can get to the right answer, but if it is not clear, then I will make mistakes and invalid assumptions and do the wrong thing. Then I have two problems, the original problem and the mistakes I have made.

In fact if everything is clear, the odds are good that I will ‘see’ a problem just by reading through the code, while I am working on it. Or maybe the code will tell me I have got it wrong, because of instrumentation I have put in it.

So I try and make everything clear, because clear begets elegance, which is better even than cuspy.

Add Bookmark:

























Share this: Twitter

Facebook

Like this: Like Loading...

Posted in Goodness, Software, Work