Adam Bien's Weblog
Validate Your Patterns ...With Aliens
Developer developer = me;
Alien alien = new UnbiasedAlien();
alien.setContext("Java EE 6"); //or something else
alien.setRequirements("24/7 eCommerce application");
List designIdeas = new ArrayList(){{
add(new Approach("Service s = new ServiceImpl()"));
add(new Approach("Empty Delegate"));
add(new Approach("DAO per entity"));
add(new Approach("Extensive Layering"));
add(new Approach("Code Coverage Driven Design"));
add(new Approach("External libraries and frameworks"));
//...and whatever is suspicious
}};
for(Approach approach: designIdeas){
Explanation e = developer.getExplanationFor(approach);
if(!alien.isExplanationReasonable(e)){
try{
developer.pleaseDeleteCodeFor(approach);
}catch(DeveloperReligiousException e){
developer.goToVacations();
alien.deleteCodeFor(e);
}
}
}
It is a healthy exercise to iterate over your design ideas / code and try to explain it to someone who is smart but unbiased. Aliens are perfect for that. Do not throw DeveloperReligiousExceptions--in longer term your superfluous code gets removed anyway :-).
Posted at 06:23PM Oct 07, 2011 by Adam Bien in Real World Java EE Patterns - Rethinking Best Practices | Comments[4] | Views/Hits: 4390
*NEW* Workshop: "Effective Java EE 6/7", July 10th, Airport Munich Tweet Follow @AdamBien



incompatible types required Approach found Object, e is already defined - compilation failed.
Developer dev = WorldsBestDeveloper.getInstance();
Alien alien = new UnbiasedAlien();
try {
dev.tryDoSomethingWith(alien)
} catch (UselessException ex) {
dev.ignore(alien);
alien.goHome(HomeType.UNKNOWN);
} finally {
dev.developsInPeace();
}
mfg :)
Posted by DevInstance on October 14, 2011 at 08:01 PM CEST #
Don't forget:
if (alien instanceof Women)
throw new KernelPanicException();
;-)
I'm just kidding you, Adam!
Best to you,
TC
Posted by TC on November 09, 2011 at 10:58 AM CET #
@Tascha,
I only approved your comment after extensive research - you (http://https://twitter.com/#!/Imifos) look like a Java Girl - so it is o.k. :-)
Thanks!
adam
Posted by Adam Bien on November 10, 2011 at 09:26 AM CET #
senior.say("bla");
aien.say("bla");
projectManager.say("well done");
while(true) {
developer.beginWork();
projectManager.say("bla");
senior.say("bla");
boss.say("bla");
support.say("bla");
tester.say("bla");
ceo.say("bla");
master.say("bla");
obama.say("bla");
// long list of other useless ppl say bla
// not allowed to finish
// developer.endWork();
}
Posted by Horst Mahler on November 26, 2011 at 10:51 PM CET #