creadur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Burrell Donkin <robertburrelldon...@blueyonder.co.uk>
Subject [GSOC] DefaultAnalyser
Date Mon, 08 Jul 2013 20:35:33 GMT
DefaultAnalyserFactory is a good example of why static methods introduce 
unnecessary coupling and make systems hard to test:

https://gist.github.com/RobertBurrellDonkin/5952112

Both guessers have (immutable) state, which could have been injected 
through constructors. Then instances could have been injected into 
DefaultAnalyser. By factoring out an interface for guessers, would have 
allowed the interface (rather than the implementation) to be injected. 
Then DefaultAnalyser could have been tested using mocking and stubbing 
techniques as well as being easier to understand and extend.

This might be a good opportunity to try out some BDD as well as other 
refactoring techniques. Potentially challenging (especially as it's more 
difficult for me to explain than to do) but sometimes that's a good way 
to learn ;-)

See, for example,

http://dannorth.net/introducing-bdd/
http://martinfowler.com/articles/mocksArentStubs.html
http://www.refactoring.com/catalog/index.html

Hopefully people will jump in with other ideas, help and suggestions

Robert


Mime
View raw message