Code Never Starts “Perfect”
Instead, it starts with rough ideas and hard edges that give you an idea of the shape to come. “Perfect” comes later, as the system is refined and re-drawn, dozens or hundreds of times.
A friend of mine recently posted a link to this amazing video on YouTube. I sat there for 12 minutes, in awe of the skill and mastery of the artist as he drew this life-like portrait of a woman with nothing more than pencils, erasers and smudging tools. It is absolutely astounding to watch.
Even if you’re not an art fan or don’t care about pencil drawings, it is worth watching the first few minutes of this video because there’s something that we can learn from this visual medium of pencil drawings.
At the beginning of the video, the canvas is blank. The artist is studying the subject and begins to place very rough sketch lines on the canvas. These lines are not particularly telling of what’s the come, at first. They are dark, with hard edges and sparsely populated on the page. The artist continues to eye in measurements by examining the subject with their pencil as a guide. Quickly, the image becomes recognizable as a human form.
Over time, additional rough lines are added to the sketch and you start to see a nose, shapes of eyes, and other details emerging. The drawing is still very rough, but it is gaining more and more detail as time goes on. Then the artist begins to remove the graphite from the places that are wrong – the rough edges that were their previously are being smudged away in to soft shadows. The extra lines that were there to give dimension and a place for actual detail to live, are removed.
The Refinement Process
What really strikes me about the process of drawing is how the artist is not afraid of 2 things: making mistakes, leaving detail for later.
In the process of sketching, lines are showing the general idea but are not really correct. There are very few hard lines in the end result, but the process of drawing and refining involves hard lines nearly every step of the way. These hard lines are initially “good enough” design. Eventually they become an eye-sore and a potential mistake that needs to be corrected. The artist refines the rough lines by erasing them, smudging them, redrawing them and manipulating them until they match the level of detail that he is looking for at the moment.
The refinement process also illustrates something important: that the level of detail needed is fluid. As the artist is improving the portrait, he continues to add detail where needed in order to bring the entire drawing to same level of detail. He doesn’t leave hard sketch lines of the mouth, chin and nose while perfecting the eyes. Instead, he smudges, smooths and erases the hard lines of all these features to keep them all in sync while he improves the details of the over-all picture.
Software Development Is A Lot Like Pencil Drawing
It occurred to me, as I watched the master artist at work, that software development is a lot like the art of pencil drawing.
When we start building a new project, we should not try to begin with the end result in our code. This is foolish. It leads toward bad design that doesn’t fit the actual needs of the system. Instead, we should start with rough sketches of what the system will look like. Over time, then, we refine those edges. We smooth them away, re-draw them and refine the over-all picture of the system.
I’ve spent the last 2 months doing exactly this for my current client project.
The project started with rough sketches of code – very simple objects that were hard coded to a very specific scenario. I wanted to get one “happy-path” of completing the process in place, quickly. I wanted to prove to myself and to my client that the idea was valid and show them that the process could be moved from start to end.
Over time, I began to smooth away the rough edges. I added new detail in order to handle more of the needs that the system had. I added new lines – new units of code and architecture that met additional requirements. I smudged and erased line – moved code from one module to another and erased some of the mistakes that I made along the way. I refined the drawing of the system – I step back, look at the architecture, work flow and data flow, and I refine the code to ensure that the needs of the system are captured in the right places at the right time. I don’t try to perfect any given part of the system at one time. Rather, I ensure that the quality and structure of every module in the system is at roughly the same level of detail and completion. I never let any one part of the code become “done” while the rest of the code continues to be refined.
The End Result
I wish I could tell you that I now have a perfect, fluid and shaded work of art on my hands. But I don’t… not yet, at least.
What I have is equivalent to what the artist has at around halfway through the video. I have what some may consider a work of art, with enough detail to see the end result. I can see that this is the right shape, has the right outlines for shadows, has code removed where highlights were meant to be. But I still have rough lines in a few places – small as they may be. I still have detail that needs to be added.
I have not yet drawn the final hair lines or should lines of the subject. I have not yet perfected the light reflections in the eyes of the subject. These are features that my software needs at some point, but I am waiting until the rest of the system is refined enough to warrant this detail.
I don’t want any given part of the system to move to far ahead. I want balance throughout the system. I want to know that I can still correct the big picture and refine the details later, rather than forcing myself in to a “final” version of anything early, only to later realize that it is wrong and cannot be easily corrected.
The system I am designing and coding did not start with perfect code. It was rough, ugly and full of mistakes. The system I currently have still has rough edges and I am still re-shaping it as features demand. But I can very clearly see the subject matter in my art and I know I am heading in the right direction.