Should You Encapsulate Knowledge in Modeling Real-World Things?
|In this one-per-month special 'notepad' series, I am taking a quick look at important issues facing practitioners who are seeking to understand and apply the business rule approach for capturing business requirements and developing business systems.|
Last month's column on encapsulation of knowledge in real-world things (objects)  produced some noteworthy feedback from readers. In particular, one reader pointed out that 'encapsulate' and 'hide' are not exactly synonymous.
Encapsulate: to surround, encase or protect in or as if in a capsule. 
Hide: 1a. to deposit in a place of concealment; put out of sight. 1b. to conceal for shelter or protection. 2. to withhold from someone or from public knowledge; keep secret. 
At issue in that column was my dog, and the irritation his barking potentially produces for my neighbors. The feedback pointed out that my dog's bark is shared by everyone in earshot (a point I sadly concede). Nonetheless, the bark belongs to the dog itself; it is the dog's bark. The feedback continued, "It is common to specify that certain features [of objects] are public and other are private, while acknowledging that all are encapsulated."
Although the point about the difference between 'encapsulate' and 'hide' is well taken, how do you encapsulate something and also make it public? Transparent capsules? Then what's the point of the capsule? In a model of real-world things, each primitive element -- including knowledge (terms, facts, and rules) -- should be separated from other primitives. I can see absolutely no reason to encapsulate (shared) knowledge in such a model.
With regard to my barking dog, for example, knowledge shared by the neighbors and me (and perhaps the city) includes the following:
Dog belongs to owner (me).
Barking dogs must be made to stop by the dog's owner.
Such shared knowledge should certainly not be hidden -- and why should it even be encapsulated? And in what?! Consider the dogs-must-not-bark-to-the-point-of being-a-nuisance rule. Into which real-world thing (object) should it be encapsulated? ...dog? owner? neighbor? policeperson? judge?
Processes, on the other hand, are often different. I concede I don't know how my dog barks. That knowledge is encapsulated -- that is, hidden. Air goes in, noise comes out. I have no idea how my dog determines when he reaches a state of needing more air, or of being satiated with barking. Nor do I really care much about such private knowledge -- especially when the neighbors come fuming to my door!
 Ronald G. Ross, "Business vs. Environment in Business Models," Business Rules Journal, Vol. 4, No. 9 (Sept. 2003), URL: http://www.BRCommunity.com/a2003/b145.html
# # #