IT Modernization < V. Hanniet

software model driven approaches

Business logic’s paradox: the barber’s story

Inspired by Model practice’s last posts I will try to illustrate a business logic’s paradox on the barber’s paradox taken as a business rule 😉

The barber’s paradox: “The barber shaves only those men in town who do not shave themselves! Who shaves the barber?”.

The first sentence is the business rule: “the barber shaves only men who do not shave themselves”. The second sentence is not a business rule but a comment. A lot of misinterpretations when coding or modeling business rules come from comments turned into rules: “Hum… As I understand the rule there is a problem: who shaves the barber?”. From that point one can:

  • Send the rule back to business guys any telling them the rule is not good (not the worst option ;))
  • Imagine some ways to avoid the apparent paradox, among worst bypasses is designing an exception for the barber taken as a kind of man, and either proposing the solution to business guys (good option) or keeping it at technical level (business guys won’t understand and we need to code that rule…)

Both cases cost time, at least, or lead to inaccurate behaviours and maintenance costs, at worst. The rule in itself is clear and non ambiguous if seen in a real world context (which should always be the viewpoint to adopt when dealing about building applications intended to be used by real people with a real business!):

  • There is a town, with men who need to be shaved. They can choose to shave themselves or go to the barber to get shaved.
  • The barber offer a service: shaving. We can’t say for sure here that there is only one barber in town. And we don’t know the ratio men who shave themselves/number of men in town so we don’t know exactly if barber is a profitable activity or a business promise to growth. By the way, nobody tell us that “the barber” is a man and that he is alone: it can be a shop with employees, it can be a human being… A woman 😉
  • Is there a problem if the barber is a single man who so need to be shaved? Not at all. The barber, as a man, is able to  shave so he probably shaves himself. He may also ask for someone else to do it: nobody tell that only the barber has the right to shave. He may also go to the barber: himself as a barber will shave himself as a man.
  • In fact, “barber” is an ability or a job, and may so be taken as a role not a person.

So. I tell there is no problem. However, how can I be sure that my (sensible) interpretation is the good one compared to what business guys had in mind when they wrote the rule? By asking them! And, as a communication support, a model would be a great help to describe this lack of complexity which is a kind of business logic complexity 😉

Featured image taken from http://bollywood-sapna.over-blog.com/article-23221027.html

2 comments on “Business logic’s paradox: the barber’s story

  1. modelpractice
    29/12/2011

    From own experience I may say that by taking the input from the business side literally (or just seriously enough) one could drive every logician to despair.

    Imho the one responsible for logical quality of requirements is the Analyst, since being precise with language or managing dependencies btw different perspectives (models) requires dedicated attention.

    Have fun
    |=

  2. vhanniet
    30/12/2011

    @modelpractice
    You’re right: requirements analysis is made by analysts. But even if we consider analysts as the first people to model something in the SW life-cycle, the requirement source is still business guys. And the business logic is not always compliant to mathematics logic. For at least one good reason: the real world is not fair and does not always follow its self-rules. And another (less good) one: every program contains bugs… And the same for models! (regarding to the ad hoc definition for bug)

    So the idea is to be pragmatic, often a synonym with business oriented, rather than purely logical.

    Don’t forget: http://vhanniet.com/2011/06/17/only-4-of-it-projects-teams-benefit-from-a-double-dream-team-effect/ 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on 28/12/2011 by in Modeling and tagged , .

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 188 other followers

Creative Commons License
IT Modernization < V. Hanniet by Vincent Hanniet is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.