[cgiapp] Re: CGI::Application Testing Methodologies

Peter Karman peter at peknet.com
Mon Feb 25 15:05:45 EST 2008



Aristotle Pagaltzis wrote on 2/23/08 7:02 AM:
> * Mark Knoop <mark at rawcane.net> [2008-02-21 08:20]:
>> I have also taken note of the point about creating testable
>> classes. As an OO newbie much of my time recently has been
>> spent deliberating over how to design my classes, what to
>> encapsulate where, what return values to use for methods etc.
>> and I suspect that developing with testing in mind will
>> actually help rationalize these matters.
> 
> Very helpful in this regard is doing test-first development. It
> takes a bit of time to get the hang of it, because it requires
> some imagination: you don’t normally think in terms of how a
> non-existent API would look like.
> 
> The benefit is that it forces you to write code that *uses* an
> interface before you write the code that *implements* it; this
> way, it drives you toward designing your interfaces from the
> perspective of a user rather than from the perspective of the
> implementer. As a result, they’ll tend to be much more usable,
> regardless of how deeply you understand what makes an interface
> better and how much of a conscious effort you make to apply your
> understanding.
> 

very good advice. I've been trying to practice that approach the last few years. 
I actually start with the POD first, since that forces me to think entirely from 
the user's perspective, and then make my SYNOSIS my first test.

-- 
Peter Karman  .  http://peknet.com/  .  peter at peknet.com


More information about the cgiapp mailing list