Jump to content

BLaBZ Blog

  • entries
    18
  • comments
    59
  • views
    22,030

Coding: DRY


BLaBZ

1,088 views

 Share

I have a bunch of books on coding that I like to approach slowly. Everyday I read a section or two from a book and let the idea's resonate so I can really understand them and see where they're applicable in my own work.

 

The latest book I'm reading is "The Pragmatic Programmer" by Andrew Hunt and David Thomas. It's a book full of concepts and ideas to make you a better programmer. One of the things they discuss is a principle called "Don't Repeat Yourself" or DRY.

 

When I initially read this chapter I thought "Hey! Of course! That makes sense, I'm sure this concept will be quite applicable." What I didn't realize was that as I continued to code, more and more of that code could be reused if I made it possible to change just a couple variables.

 

So to make that code reusable, I simply put it in a function/method in the parent class.

 

It sounds simple right?! Maybe for the more experienced programmer. I've found noticing you're repeating yourself isn't always evident because you may not be repeating yourself EXACTLY.

 

It seems like the better I get at coding the funner it is. I love finding new ways to make programming complex tasks simple.

 Share

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...