DRY II

11/24/07

Permalink 08:18:33 pm, by truewill Email , 131 words, 168 views   English (US)
Categories: C#, Quality, .NET, Tools

DRY II

One of the OOP guidelines is DRY - Don’t Repeat Yourself. Good programmers avoid duplicate code. However, there are times when you need to implement the same pattern or template on a regular basis. You may have to repeat the pattern, but why repeat the development?

Techniques to re-implement simple patterns include:

  • Use Generics whenever possible.
  • Create Code Snippets.
  • Use a code generator such as CodeSmith (there is a free version, as well as open source alternatives). Code generators work particularly well for data access objects.

The key is to get it right the first time, and then to always implement it in a consistent manner.

Also, don’t reinvent the wheel. Other people have already developed templates for common patterns. Some examples:

Comments, Pingbacks:

No Comments/Pingbacks for this post yet...

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))
The name truewill is composed of two other words. What is the SECOND word?

Development Central

Development Central is the blog of Bill Sorensen, a professional software developer. Much of this will relate to C#, .NET, and OOP in general.

Disclaimer
These postings are provided "AS IS" with no warranties and confer no rights.

Search

Categories

Linkblog

b2evolution

contributors

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 1

powered by b2evolution free blog software