Registered: Sep, 2005
Re: Tangosol's Cameron Purdy on the Importance of Design
Posted: May 21, 2007 9:35 AM
> I'm a novice programmer, and I may be repeating the
> obvious here, but I quite often hash out implementation
> before I really get into the design. I work with the bash
> scripting language to get simple (and sometimes complex
> too) jobs done, so for me at least, the line count isn't
> all that high. I can generally see the design and hold
> most of the important facets in my head because of this
> To code for a specific small job is easy. You code, and
> the design comes from that one taskset. However, when
> you're trying to make the code more generic, to do design
> when you don't understand really what it is you're trying
> to do (my normal target) is downright awkward, as I tend
> to <i>think</i> in code and specific tasks anyhow, rather
> than in concepts. That's just my twist on it.
Designing before coding is something that is very difficult at first. You need to not only be able to imagine what the implementation will do but how it might do it. With experience, this becomes much easier. It's kind of like learning to drive. At first, you need to think consciously about where your feet are, how far to turn the wheel when you are steering. After a while, you internalize this knowledge. It becomes natural.
Having said that, it's not a bad idea to write a proof-of-concept before/when doing design. If I can't think of how I will solve a problem clearly, I find brainstorming in code to be an effective approach. Once I figure out what it is I'm trying to accomplish, I go back and write a clean design. The more experience I gain the less time I spend doing stuff like this. The key is to just cowboy-code the crap out of it. Don't spend a lot of time making it clean and pretty. You don't even need to complete it. Once the lightbulb goes on, you can stop. Save it for reference but it's basically garbage. You'll probably realize most of it's overdone or pointless. If you work under and idiot, don't let them know you did it. They may want you to use your proof-of-concept code in your final version instead of rewriting it.