Daily DRY Tip

May 11, 2008 at 10:50 am Leave a comment

DRY stands for Don’t Repeat Yourself. A paradigm that is indispensible in software engineering.
Since I enjoy writing concisely more than going extra-elaborate, I will keep this post as concise as possible.

Example of code that is has not DRY’ed out completely :

class Classy
    static Classy Schmassy() ;


int main()
  Classy  obj = Classy::Schmassy() ;

  return 0 ;

What could be the darned problem with such a tiny crumble of code? The un-DRY’ness of this code can be found in the body of the main() function.

If we let some sun shine on it, it DRY’s out completely.

int main()
  Classy  obj = obj.Schmassy() ;

  return 0 ;

There you go, just one reference to the concrete type.


Entry filed under: Command Line.

Mom, look at this Daily DRY Tip

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Recent Posts


%d bloggers like this: