The Fear of an Empty Source File
The Fear of an Empty Source File
Even coders have to face the fear of the blank page. Take a look at how this developer approaches the first few keystrokes.
Join the DZone community and get the full member experience.Join For Free
I have been writing software at this point for over twenty years, and I want to believe that I have learned a few things during that timeframe.
And yet, probably the hardest thing for me is to start writing from scratch. If there is no code already there, it is all too easy to get lost in the details and not actually be able to get anywhere.
An empty source file is full of so many options, and any decision that I’ll make is going to have a very long-lasting impact. Sometimes I look at the keyboard and just freeze, unable to proceed because I know, with a 100% certainty, that whatever I’ll produce isn’t going to be up to my own standards. In fact, it is going to suck, for sure.
I think that about 90% of the things I have written so far are stuff that I couldn’t write today. Not because I lack the knowledge, but because I have a far greater understanding of the problem space and I know that trying to solve it all is such a big task that it is not possible for me to do so. What I need reminding, sometimes, is that I have written those things, and eventually, those things were able to accomplish all that was required of them.
A painter doesn’t just start by throwing paint on canvas, and a building doesn’t grow up by people putting bricks where they feel like. In pretty much any profession, you need to iterate several times to get things actually done. With painters, you’ll typically do a drawing before actually putting paint on canvas. With architects will build a small-scale model, etc.
For me, the hardest thing to do when I’m building something new is to actually allow myself to write it out as is. That means, lay out the general structure of the code, and ignore all the other stuff that you must have in order to get to real production worthy code. This means flat our ignoring:
- Error handling
- Control of allocations and memory used
- Select the underlying data structures and algorithms
- Yes, that means that O(N^2) is just fine for now
- Logging, monitoring, and visibility
- Commenting and refactoring the code for maintainability over time
All of these are important, but I literally can’t pay these taxes and build something new at the same time.
I like to think about the way I work as old style rendering passes. When I’m done with the overall structure, I’ll go back and add these details. Sometimes that can be a lot of work, but at that point, I actually have something to help me. At a minimum, I have tests that verify that things still work and now I have a good understanding of the problem (and my solution) so I can approach things without having so many unknowns to deal with.
A large part of that is that the fact that I didn’t pay any of the taxes for development. This usually means that the new thing is basically a ball of mud, but it is a small ball of mud, which means that if I need to change things around, I have to touch fewer moving parts. A lot fewer, actually. That allowed me to explore, figure out what works and doesn’t.
It is also going directly against all of my instincts and can be really annoying. I really want to do a certain piece of code properly, but focusing on perfecting a single doorknob means that the whole structure will never see the light of day.
Published at DZone with permission of Oren Eini , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.