adam bien's blog

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 :-).