Ulsac

What is Ulsac?


1.

By trying to make a API method more generalized- you make it too generalized.

Anti-Pattern Name:

ULSAC Anti Pattern

Aliases:

Failed Façade Command Pattern Problem

Context

By trying to make a API method more generalized- you make it too generalized

Forces

- Trying to prevent code change

- Failing to program to interface, in the sense if the implemented class changes it should signal failures else where in the code base.

Solution

Create well defined methods (and names) that explain the exact nature of the method.

Consequences and Resulting Context

- The complexity of the call gets embedded with in a parameter.

- API can’t be readily understood.

- Functionally Overloaded method

- Hard to change.

- Difficult API to use.

What's Wrong with the Solution

Consider the following API which contains self describing methods that can be readily understood and used.

void getCustomerNumber(…);

void getCustomerAddress(…);

void getCustomerTelephone(…);

If a scenario arises in which a developer tries to prevent the API exposed to change by creating an overly generalized method

void getX(…., String actionDesc)

in which the actionDesc contains some sort of internal pseudo language which determines the correct data to return. i.e.

call getCustomerNumber(…) gets replaced with call getX(….,”CustomerNumber”);

call getCustomerNumber(…)+ call getCustomerAddress(…) gets replaced with call getX(….,”CustomerNumber,CustomerAddress”);

Lesson's Learned

Try not to make a single method be all things to everyone. Rely on programming to interface and contractible programming it allows.

Correct Patterns

Author(s):

John Wilson

Date:

01/01/2009

References

Keywords:

Example

See it, gof, development, poor


0

Random Words:

1. GAGR is an acronym which stands for Gaz and Gir romance. Not as common as other romances of Invader Zim such as ZADR. The idea for GAGR ..
1. A gender confused boy 1.) has more girl friends then guys( and not because he is big pimping 2.) does not understand what there penis..
1. 1. The single worst thing to happen to music. 2. "teen pop," as sung by either 12 year olds who think they're 16. Rad..
Book Banner