unclebob/fitnesse — pull request #299 by beskow (2013-08-07 12:53:52+00:00)
Title: Simplify localized specializations of ScriptTable

In order to use domain-specific vocabulary for our tests, since our domain is expressed in Swedish, we want our tests to resemble "plain Swedish" rather than plain English. This is a non-issue for most table styles. Script tables are an exception, though, since they use English "keywords" (e.g. "check", "ensure", "reject" etc.) for specific "actions".

Using the TablePlugin, we have successfully added a custom Script table specialization, which uses Swedish keywords instead. Because of the way ScriptTable is written, it however leads to lots of Code duplication. The usage of English keywords is hardcoded in private methods, which in essence forces me to duplicate (or reinvent) the ScriptTable implementation in order to specialize it with localized action keywords.

This pull request simplifies localized specializations of ScriptTable by introducing template methods for the relevant action keywords. That way, a specialization can provide localized definitions of the action keywords. This change I believe adheres to the Open/Closed principle, since it opens up the ScriptTable for extension while still keeping it closed for modifications. It makes our Swedish localization extension extremely simple and straight-forward.