ULSAC
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 cl-ss 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
Read Also:
- ultimate celebration
a c-cktail comprised of 5 hour energy and bottom shelf champagne. proportions are typically one bottle of 5 hour energy to one bottle of champagne. more aggressive partiers may consider a 1 part each mixture for maximum celebration. the playa is going to be amazing tonight. can you pour me some ultimate celebration?
- ultimate champion
the champion of everything that is ultimate. not hte champion of stuff that isn’t ultimate like a regular champion. lindsey isn’t hte ruler over me becuause hes an ultimate champion and im a regular champion
- ultimate cheese curl
the ultimate cheese curl occurs when a male leaves himself open from the rear…. the curler grasps the curly’s scrotal area in between the testies with two to five fingers….. the curler then wraps the scr-t-m under the taint, and then penetrates the -n-s with the scr-t-m by pushing upwards with his fingers….. the utter […]
- Ultimate cheese rag
where on takes a slice of cheese, jerks off and -j-c-l-t-s on the cheese, and slaps a girl on the face. hey man! i did a ultimate cheese rag to my girlfriend last night
- ultimate chick song
total eclipse of the heart, by bonnie tyler. it is incontestibly the girliest, queerest dance song ever made. however, despite that it is an irresistible and catchy tune. “dammit…they’re playing that total eclipse song again…my girlfriend’s gonna want to slow dance with me now, f-ck!”