Tuesday, March 3, 2009

KISBNS

Keep It Simple, But Not Stupid!

The idioms KISS (Keep It Simple, Stupid!) and KISSALAP (Keep It Simple, Stupid, As Long As Possible) are great methods to get your code up fast and keep it stable. Surely writing code for something you'll probably never use can only make thing unnecessary complicated and therefore unstable and unmaintainable.

BUT:
I often see pieces of code where people tried to keep those principles, but forgot to refactor in time until it's too late. What I mean is, people tend to start copying pieces of code, thinking 'making this piece of code more generic while I would only use it twice is not simple enough.' Maybe that's true. But then they copy it a third time, or code it again because they forgot it allready existed somewhere.
In these cases making a generic method, class or whatever the first time would have been a better idea.

So as soon as a piece of code is obvious to reoccur several times, extract it immediately before it's too late!

0 reactions:

Post a Comment