[cgiapp] Re: CGI::Application Testing Methodologies

Aristotle Pagaltzis pagaltzis at gmx.de
Sat Feb 23 08:02:26 EST 2008


* 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.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>


More information about the cgiapp mailing list