ConstructiCat Logo
CodeBust.
Browse section ▾

Incomplete Library Class.

Sooner or later, libraries stop meeting user needs. The only solution to the problem—changing the library—is often impossible since the library is read-only.

##Signs and Symptoms

Sooner or later, libraries stop meeting user needs. The only solution to the problem—changing the library—is often impossible since the library is read-only.

String label(Date date) {
  Calendar c = Calendar.getInstance();
  c.setTime(date); // Date has no week helper, so every caller repeats this
  return c.get(Calendar.WEEK_OF_YEAR) + "/" + c.get(Calendar.YEAR);
}

##Reasons for the Problem

The author of the library hasn’t provided the features you need or has refused to implement them.

##Treatment

##Payoff

  • Reduces code duplication (instead of creating your own library from scratch, you can still piggy-back off an existing one).