Christian Scholz
2008-07-23 10:46:59 UTC
Hi!
Just as a followup to my email from last night: I think it makes sense
to nevertheless define interfaces for MsgData etc. because they also can
serve as documentation and help thinking about how you structure your code.
So my usual process is:
- Write an example doctest and refactor/change it until it makes sense
- From the result I might have identified some components. I write
interfaces for them which I use in the doctest
- I start implementing these interfaces while running the test regularly
to see where work is needed
- I revisit my code and add additional tests where I might have missed
edge cases etc. (this actually still needs to be done for the components
we have right now, esp. the error conditions which are hopefully all
defined).
And even if I don't plan to exchange my component I add interfaces as
IMHO this makes the intention clearer and adds some contract on how to
use the component.
I also sometimes factor components out in utilities or adapters if the
class grows to big and a tightly scoped functionality can be better
tested in a separate component.
-- Christian
Just as a followup to my email from last night: I think it makes sense
to nevertheless define interfaces for MsgData etc. because they also can
serve as documentation and help thinking about how you structure your code.
So my usual process is:
- Write an example doctest and refactor/change it until it makes sense
- From the result I might have identified some components. I write
interfaces for them which I use in the doctest
- I start implementing these interfaces while running the test regularly
to see where work is needed
- I revisit my code and add additional tests where I might have missed
edge cases etc. (this actually still needs to be done for the components
we have right now, esp. the error conditions which are hopefully all
defined).
And even if I don't plan to exchange my component I add interfaces as
IMHO this makes the intention clearer and adds some contract on how to
use the component.
I also sometimes factor components out in utilities or adapters if the
class grows to big and a tightly scoped functionality can be better
tested in a separate component.
-- Christian
--
Christian Scholz video blog: http://comlounge.tv
COM.lounge blog: http://mrtopf.de/blog
Luetticher Strasse 10 Skype: HerrTopf
52064 Aachen Homepage: http://comlounge.net
Tel: +49 241 400 730 0 E-Mail ***@comlounge.net
Fax: +49 241 979 00 850 IRC: MrTopf, Tao_T
neue Show: TOPFt?glich (http://mrtopf.de/blog/category/topf-taglich/)
Christian Scholz video blog: http://comlounge.tv
COM.lounge blog: http://mrtopf.de/blog
Luetticher Strasse 10 Skype: HerrTopf
52064 Aachen Homepage: http://comlounge.net
Tel: +49 241 400 730 0 E-Mail ***@comlounge.net
Fax: +49 241 979 00 850 IRC: MrTopf, Tao_T
neue Show: TOPFt?glich (http://mrtopf.de/blog/category/topf-taglich/)