Friday, 5 March 2010

In the age of DRYness, how dry are you?

In the age of DRYness, how dry are you. Here are 7 things to measure your DRY level.

  1. If you are using Code generators to generate CRUD functions for each of your entity controllers
    a.k.a DAOs or Entity facades each of which defines the same CRUD code with the Entity bean
    names changed, you are the Least DRY. Consider Generics and Delegation

  2. If you are using EJB 2.1 on Java 1.4, you can NEVER be DRY as there is just too much artifacts
    that are completely not reusable, ejb-jar.xml, CMP mappings, remote and local interfaces that
    don’t do anything etc. Another reason is because that platform promotes tight-coupling more
    than Channel4 promotes Big Brother!

  3. If you use Strings and scriptlets to generate your HTML ouput, your chances of being unDRY are
    above 80%

  4. If you are using the Command Controller pattern for your EJBs Session Bean or Front Contrliler
    Filter for your Views and using if clauses to select your handlers, you are 90% unDRY

  5. If all your JSP’s have the same top and bottom or if you use scriptlets to pull in the top and
    bottom such that for every JSP, there is an ‘include’ with a filename in String at the top, you are
    unDRY. Consider Templating

  6. If there is a lot of casting going on in your code, you are probably not DRY. Too much generic
    stuff that are not type safe!

  7. If you use Strings to construct your SQL statements, no matter what you do, you are unDRY even
    if you define them as global static final String!

No comments: