Agile, test-driven development

Moose – Found Without Searching

The CPAN Test::Class::Moose module is still in beta; I only learned of its existence at the Perl YAPC conference [3] in early June in Austin, Texas – just a few hours before deadline for this issue. My first impression is that it is very stable; however, if you find any bugs, the author welcomes reports or patches for the module.

The advantage of test-driven development is undoubtedly the ever-growing test suite, which – if the developer works to plan – provides virtually 100 percent code coverage. If the customer suddenly springs change requests on you in the course of the project, TDD enthusiasts can adopt them without any worries, as the test suite guarantees that their adoption won't introduce fatal errors to previously working parts of the code.

Agile developers also need not worry too much about the most elegant way to implement a specific feature. A straightforward approach is good enough for the time being, and once the test suite shows green, they can move on to the next feature.

After spending a certain time in rapid development, you will naturally come across ugly pieces of code that need to be fixed every few iterations to make the software maintainable: If you find a duplicated piece of code, it can usually be swapped out into a function, and if parts of the system turn out to be known software patterns, you will want to convert them to their reference implementations.

This refactoring is a natural part of the process and does not usually cause any problems – again, thanks to the existing test suite and its extensive code coverage. If the test suite shows you a green light, your spring cleaning was successful.

The Author

Mike Schilli works as a software engineer with Yahoo! in Sunnyvale, California. He can be contacted at mailto:mschilli@perlmeister.com. Mike's homepage can be found at http://perlmeister.com.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Perl: Regression Tests

    With a test suite, you can fix bugs and add new features without ruining the existing codebase.

  • Perl: Web Regression Test

    Testing complex web applications does not necessarily mean investing in expensive, proprietary tools such as Test Director or Silk Performer. Selenium is for free; it can remotely control any major browser, and it is programmable in Perl.

  • Perl: Cucumber

    The Cucumber test framework helps developers and product departments jointly formulate test cases, not as program code, but in plain English. The initially skeptical Perlmeister has acquired a taste for this.

  • Calculating Probability

    To tackle mathematical problems with conditional probabilities, math buffs rely on Bayes' formula or discrete distributions, generated by short Perl scripts.

  • Perl – Distro Update Analysis

    A Perl script calls various plugins that sniff around on FTP and HTTP servers run by the major Linux distributions to discover when Fedora, Debian, and other distros update their packages.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News