Thursday, December 25, 2008
More on one test class per class
Sunday, December 21, 2008
Unit test the class
I agree.
In fact, I would go a bit further: tests should be an integral part of a class. While this helps avoid negative outcomes such as parallel class hierarchies or having code and tests diverge, it more importantly simplifies the test/code relationship and drives home the point that code is incomplete without its tests.
While I was working with JUnit on a reasonably large Java system, both finding a good place for a particular test and finding the tests for a specific class became quite burdensome after a while.
For this reason MPWTest simply asks classes to test themselves. Furthermore, only frameworks are tested, so the test tool simply loads each framework to test, enumerates the classes within that particular framework and then runs the tests it finds. TestCases and TestSuites are implicitly created from this structure, removing most of the administrative burdens of unit testing, and also any explicit dependence of the tests on the testing framework.
Having no dependencies on the testing framework makes it easier to ship tests in production code without having to also ship the testing framework. While this may sound odd at first, it avoids potential issues with code compiled for testing being different than code destined to be shipped, and further reinforces the idea that tests are an integral part of each class, rather than an optional add-on.
Sunday, October 12, 2008
Binary XML
Sean McGrath claims that Binary XML solves the wrong problem.
Yes and no: it doesn't help much with existing structures and parsing methods, but with the right methods, it can be extremely helpful!
Also: "...how weird is it that we have not moved on from the DOM and SAX in terms of "standard" APIs for XML processing?"
Sunday, August 10, 2008
Code is not an asset
Michael Feathers wonders how to go beyond technical debt. I have been wondering about this for some time, and I think the answer is to account for code as a liability, not an asset.
The functionality that the code has, the value it delivers is an asset, but the code itself is a liability. This easily explains how refactoring and removing code add value, as long as functionality is preserved.
Sunday, April 20, 2008
Higher Order Messaging backgrounded
It is, however, encouraging to see initiatives like Rspec which, through judicious use of higher order messages enables a much more fluent environment for writing tests:I think that's the first time I've seen HOM used to explain something else, rather than being the object of attention itself. So HOM is starting to be seen as simply a part of the computing landscape, at least by some. Cool. HOM was never conceived of as an interesting thing by itself but rather as a (meta-)building block for building more expressive computational forms. RSpec looks exactly like one of those cool things HOM enables that I would never have come up with myself. I look forward to seeing more.
Not just high performance Objective-C
%!
usertime
1000 0 1 10000000 { pop 0.0001 sub } bind for
exch usertime exch sub dup ==
20 20 moveto /Times-Roman 24 selectfont
100 string cvs show ( ms) show ( error: ) show
1000.0 div 100.0 mul abs 100 string cvs show ( %) show
showpage
Thursday, November 29, 2007
Better HOM selects
My initial implementation actually had arbitrary nesting, but as he discusses with collect, that requires a trigger message to start, as there is no way of knowing at runtime when the expression terminates. It never occurred to me that this limitation did not apply to select, which can look at the return type of the messages sent and stop when it reaches a BOOL (char).
Nice.
p.s.: the arbitrary nesting is still in the implementation, with each of the collection processing HOMs actually running an enumerator and those enumerators stackable, and this is two of the reasons the implementation is so gnarly: (1) there is extra generality that is not needed and (2) making that more general mechanism run fast was really, really tricky.
p.p.s: He actually discussed it almost a year ago, but I just saw it now.
