The Source for Java Technology Collaboration
User: Password:



Tom White's Blog

May 2006 Archives


More Literate Programming with jMock: Anaphora

Posted by tomwhite on May 14, 2006 at 02:30 AM | Permalink | Comments (5)

According to the dictionary, an anaphor is a word used to avoid repetition. It refers back to something in the conversation. The word "it" in the previous sentence refers back to the word "anaphor" in the first sentence, so "it" is an anaphor for "anaphor". Natural language is often ambiguous, and one reason for this is that it may not be clear which word an anaphor such as "it" is referring to.

But ambiguity and programming languages don't go very well together - so why would anyone want to mix the two? Actually, there are circumstances in programming languages where there is no real ambiguity, and an anaphor can have a use in eliminating repetition. Think of it as applying the DRY (Don't Repeat Yourself) principle at the syntax level.

Continue Reading...



Literate Programming with jMock

Posted by tomwhite on May 11, 2006 at 11:10 AM | Permalink | Comments (7)

We've been using jMock at our company for some time now. We've found it great for test driven development and isolating our unit tests from the rest of the system more effectively. One aspect of jMock that stands out for me is its idea of constraints. In fact, we've found this idea so useful that we always use the org.jmock.MockObjectTestCase base class rather than junit.framework.TestCase, even when we aren't mocking anything out. This seems to have registered with the jMock development team, as they are planning to extract the constraints into a separate project, codenamed Hamcrest (it's an anagram of "matchers").

Continue Reading...





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds