on the Curl Web Content Markup Language

on the Curl Web Content Markup and Programming Language from www.curl.com and www.curlap.com

Friday, July 29, 2011

TDD with the Curl web content language

 
I had started a series introducing Test-driven development over at the former Curl developer blogs. I may revive those posts at lcurlr.tiddlyspace.com.

One thing that may not find a place in those posts is avoiding tight-coupling of tests to class hierarchy.  Curl is a multi-inheritance language with Traits or mixins (abstract classes with some generic methods implemented.)   In the later stages of development, refactoring in the source code should have minimal impact on tests.  That goal will only be achieved if user-defined subclasses are not needlessly referenced in tests.  Behavior, not deep hierarchies, is to be our guide in development – but even such a shallow user-defined hierarchy should be loosely-coupled to our test cases.

The standard way to avoid this in single inheritance languages is to use factory methods in the tests: Curl comes with native factory constructor types. But in Curl there will also be other options particular to multiple-inheritance, parameterized classes and mixins. And with Curl macros, even more inventiveness is possible.

Tests need to wrap complexity - not expose complexity - as much as any other code that we write. Tests must both cast an wide net and yet be loosely-coupled, stable, readable, documented and maintainable.

Professional Curl installations also come with code coverage tools, whose use as can be seen in the new GUI testing framework in the Curl External Library at sourceforge.net . Coverage tools were introduced in the "classic" Curl desktop IDE and are now part of the Curl Eclipse plugin or CDE.

No comments:

Post a Comment