Re: [UML Forum] Modeling data changes within a structure

11 views
Skip to first unread message

H. S. Lahman

unread,
May 25, 2013, 3:17:23 PM5/25/13
to umlf...@googlegroups.com
Responding to Sanders...


I would like to ask for your views on, or how you would go about, modeling data changes within a data structure as a consequence of a user event. Modeling as in UML modeling of course, but simply anything more visually appealing or clue-providing is allowed as well.:-)

The context: assume a data structure which in itself is not overly complex, just a bunch of integers, doubles and strings with straightforward relations, amendable by the user via UI; what IS complex about it, however, is the set of business rules being imposed upon it. This is a legacy code, the takeover has not been a friendly one (you can't simply go and ask the authors what they'd put inside) and the only way to check if it adheres to those rules is to perform actions in the ui and then see what changes are being made in the underlying db tables. And these are the changes that I would like to have captured, in a visually 'attractive' manner perhaps.

I'm not sure exactly what your are trying to model, probably because I am making some assumptions. So let's see if I understand the problem...

You have a blob of legacy code with a UI that writes to the DB. The inputs to the legacy code are in the form of events, either literally from a UI subsystem or as abstractions of user actions (i.e., use case actor activities). There are no models or documentation for the legacy code. You are looking for a mapping between the UI and DB so that you can verify that the legacy code did the right thing.

What I don't understand is the nature of that mapping. Superficially, it sounds like a job for reverse engineering of the original legacy code. Since there are a number of tools that will produce <really crappy> UML models from various 3GL languages, I am guessing that is not what you want because that only tells you <at best> what the legacy code is actually doing, as opposed to what it should be doing.

However, such models might be useful in determining whether seems to be implementing the rules and policies correctly (i.e., a code inspection at a higher level of abstraction to make it easier).

Another possibility is that you want to model a direct mapping of user events to what the DB results should be without explicitly dealing with the rules and policies (i.e., the Jean Luc Picard "Make it so" view). I am guessing that this is kind of what you are looking for -- a simple mapping that says you get That result in the DB if This event is issued in the UI. IOW, somebody manually resolves the requirements on a case-by-case basis and writes it down so people can check test results later.

Alternatively, you might want models that actually resolve the legacy code rules and policies, either to generate test cases for automated testing, or to replace the legacy code.

Or you have something else in mind. B-)

Let's assume I am correct and you want a simple event/DB mapping. If so, one way of thinking about it might be a Facade pattern. You have events come into the Facade interface and they are rerouted, possibly being split into multiple events, and sent to objects that are surrogates for DB entities (Tables, Rows, Fields) as a simple attribute update. In effect, each event would have its own unique set of connections to the DB surrogates as it distributes event data packet values to various DB fields. (In that sense it looks kind of like a function library.)

The problem with this is that the modeling of the mapping may be simple, but resolving what that mapping should be is a major pain because you have to figure out what the rules and policies should do for each event, which is essentially doing what the legacy code is going.

-- 
Life is the only flaw in an otherwise perfect nonexistence
   -- Schopenhauer

Imagine how much more difficult physics would be if electrons had feelings
   -- Richard Feynman

Rene Descartes went into a bar. The bartender asked if he would like a drink. Descartes said, "I think not," and disappeared.

H. S. Lahman
H.la...@verizon.net
software blog: http://pathfinderpeople.blogs.com/hslahman/index.html
software book: Model Based Development, Addison-Wesley, 2011
geology book: The Evolution and Utilization of Marine Resources, MIT Press, 1972

sa...@centrum.cz

unread,
May 26, 2013, 3:08:51 AM5/26/13
to UML Forum
H.S., thank you for your reasoning, yet I think I should clarify the
motivation behind my quest: the purpose of the attempted model is not
to find the best representation of a discovered behaviour, rather I
would like to capture that behaviour in a visually comprehensible way;
comprehensible as in open to the largest possible group of people,
inlcuding those with little knowledge about of UML (who would not feel
overly satisfied with a sophisticated state transition model). So that
is why I stated (and apparently not too cleverly so) that I am keen to
find various views of one situation, even avant-garde ones ... :-)
> mapping that says you get /That /result in the DB if /This /event is
> H.lah...@verizon.net

Thomas Mercer-Hursh, Ph.D.

unread,
May 26, 2013, 11:20:53 AM5/26/13
to umlf...@googlegroups.com
On 5/26/2013 2:08 AM, sa...@centrum.cz wrote:
> I would like to capture that behaviour in a visually comprehensible
> way; comprehensible as in open to the largest possible group of
> people,

Have you considered capturing the rules in a BRM tool ... perhaps
ultimately implementing that tool to replace the code? See, for example
http://www.progress.com/en/corticon/index.html

Reply all
Reply to author
Forward
0 new messages