Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 4
    BrokenBusinessRule in the original posting is not different from your BusinessRule class in your answer (though I think the name BusinessRule makes more sense). What bothers me more is your suggestion to create a subclass for each rule - for such simple rules, I have the strong feeling that this will overcomplicate a simple situation, and increases the "noise/signal" ratio, which does not increase maintainability. Commented Aug 29, 2013 at 14:29
  • @DocBrown An anonymous inner class to do the actual checking would be one way avoid subclassing (as would doing this in a language with proper support for closures, such as Scala or groovy). The book example has some rules dumping whole sets of extra broken rules into the main set, with no proper way after the event to identify those as a distinct group. How is polluting the data like that decreasing the signal to noise ratio? The example as given is completely impractical as anything other than a (bad) demo. Commented Aug 29, 2013 at 15:30
  • yes, I suppose this is another way to do the same validation, much cleaner than the original. +1 Commented Aug 30, 2013 at 4:48