A DRY philosophy

Don’t Repeat Yourself.

Sounds simple enough, right? Self explanatory? Excellent! Blog done.

Ok, ok, I’ll go into more detail.

DRY, as I pertained to above, is an acronym for Don’t Repeat Yourself. It is a way of thinking I came across within the coding community, a frame of mind that makes sure you think everything through, and question all your methods.

Say I’ve built a beautiful website. It’s smooth, it’s sleek, and there is little or no code bloat. But then, against all odds, the client changes their mind and requests a new feature or a change to an existing feature. I look at my setup and decide the fastest resolution is to copy a chunk of existing code and modify it to suit. Easy, quick, job done. But this creates a chain reaction, soon I’ve copied the same code 10 times to meet the clients requests. All of a sudden I have lines and lines of excess code, it’s become bloated, efficiency and speed has gone out the window. My site is no longer smooth, it jumps between content, it takes an extra second or 2 to load. It is now Frankenstein’s monster.

If only I had used the DRY concept! I would have never copied and pasted the code. From the very beginning of the project, I would have created reusable, modular code that made it easy to reapply over and over again without losing speed or efficiency. And it wouldn’t have been restricted to that project either! I could have created libraries I can use on future or past projects too.

But DRY isn’t just restricted to coding. It applies to all jobs, even personal lives. If we all start thinking how we can do tasks or chores in a manner where we no longer repeat what we have done then efficiency sky rockets. They become simpler to carry out, and faster.

Welcome to the DRY side.