A Model-Driven Approach to Analysis and Design

Steven Zeil

Last modified: Aug 9, 2019
Contents:

Abstract: This lecture addresses the overall strategic plan for moving from a vague understanding of what kind of software system we want to the design of the software components within it.

The focus will be on a series of models, each adding more detail to our understanding of the system structure.

1 Intro: Taking the Strategic View

A software development process is a structured series of activities that comprise the way in which an organization develops software projects.

 

You should already be familiar with the classic Waterfall model from the prerequisite course CS250 or 333.

Waterfall is hardly the only development process employed in software development, but the range of common process models is outside the scope of this course.

In this lecture, we are going to look at a broader strategy that can be fitted into a number of development processes and that supports the OOA&D paradigm.

1.1 General OO Analysis & Design

1.1.1 Analysis

Analysis is concerned with what the system should do. This is not so terribly different from the waterfall’s “Requirements Analysis”. But while traditional Requirements Analysis focuses on writing requirements to be fulfilled by the software system, OOA focuses on producing an understandable model of what that system should do.

In OOA we consider the process of analysis to be a model-building activity. The first model produced is a domain model, a model of the world (or, at least, the part of the world relevant to the anticipated system) as it is now, before we introduce our new system to it.

The next model to be developed, and the primary output of the analysis phase, is the analysis model. This is a model of how the world will interact with the software system that we envision. As such, it is our statement of just what the system will do when it is working.

In OOA, both of these models will be expressed as a collection of related, interacting classes of objects.

If we believe the OO philosophy, we expect that the objects and interactions in the analysis model will be similar to those in the domain model. Our software structure should simulate the structure of the real world.

1.1.2 Design

Design is concerned with how we can get the system to do the things the analysis model says it should do.

Designs are expressed via a design model, which, like the earlier models, also is based upon the idea of related, interacting objects.

Again, if we believe in the OO philosophy, we would expect the objects and interactions in the design model to bear a close resemblance to those from the domain and analysis models. Hence we typically do not start building the design model from scratch so much as we evolve the analysis model into the design by adding detail, resolving conflicts, etc.

That doesn’t mean that there won’t be changes. The design model will typically need to

  1. add details to existing classes that weren’t important in the more abstract view of the analysis mode but that are mportant to make the software actually work;

  2. add new classes to represent underlying data structures that allow us to actually implement the desired behaviors of the simulated real-world classes;

  3. resolve conflicts between the abstract view of how we would like things to work and the limitations of what we can actually accomplish via programming.

2 Building Models

OOA&D is largely viewed as a model-building activity. The primary models that we find are

and OOA&D emphasizes a smooth evolution from one to the other.

2.1 Domain Models

 

A domain model is a model of the application domain as it currently exists, before we began our new development project. The point of the domain model is to be sure the development team understands the world that the system will work in.

(Fortunately, most companies work in a small number of application domains. If they hired you last month to develop software for analyzing seismic data for petroleum engineering, they are unlikely to ask you to develop a compiler or a word processor next month.)

Even if a document describing the domain model is desired, domain models tend to be highly reusable since the world around our software systems usually changes fairly slowly.

2.2 Analysis Models

An analysis model is a model of how the world will interact with the software system that we envision. As such, it is our statement of just what the system will do when it is working.

 

There is a real temptation to simply assume that the automated system will simply squat in the middle of the world, interacting with all the real world objects, sort of like this:

Or if you prefer,…


It’s Magic!

 

Poof! We have an analysis model!

Not wrong, per se, but it’s certainly not helpful.

Such an approach is fundamentally at odds with the OO philosophy

In essence we have not done any analysis at all here. This “model” isn’t wrong, per se, but it’s certainly not helpful. We’ve basically thrown away everything we’ve learned in the domain model about how objects really interact. We’re treating the new program as a simple box, with no knowledge of its internal structure, Essentially, we’ve just deferred all the hard questions to the upcoming design.

2.2.1 Evolving the Analysis Model

What we really hope for is an evolution from our domain model to our analysis model. The OO philosophy tells us that the classes and interactions of our domain model …

 
… should carry over into our analysis.

In essence, we hope to retain these classes, add more detail to our understanding of them, and to establish a boundary that tells us which of these classes and behaviors will be automated, which will remain entirely unautomated, and which will have some portion automated while other parts remain external.


The Boundary

 
… establish a boundary that tells us which of these classes and behaviors will

The system, then, remains a collection of interacting objects rather than an unstructured black box.

There’s a definite overlap in the purpose of a requirements document and of an analysis model. Some will regard the analysis model as a kind of requirements specification. In some projects, though, a requirements document will still be required as something for customers or management to sign off on. But the analysis model is the basis from which the eventual requirements document is derived.

2.3 Design Models

Design is concerned with how we can get the system to do the things the analysis model says it should do.

Designs are expressed via a design model,

which, like the earlier models, also is based upon the idea of interacting objects. If we believe in the OO philosophy, we would expect the objects and messages in the design model to bear a close resemblance to those from the analysis model. Hence we typically do not start building the design model from scratch so much as we evolve the analysis model into the design by adding detail, resolving conflicts, etc.


Design Model: Agents

 
A common step in OOD is to separate the classes that, in the analysis model, are partially implemented and partially external, into an purely external class representing the original, real-world objects, and an agent class that implements the automatable functions that will now be performed by the new system.


Design Model: Agents (2)

 
Here we have created an agent for AccountHolders


Design Model: Interfaces

 
Then we can look closely at the lines (interactions) that cross the border from the outside world into the automated system.

What do we call an interaction between an external entity and an internal automated entity?


Design Model: Interfaces

That’s the definition of an “interface”, and so

2.3.1 MVC

A common organizing principle for such interfaces is to distinguish between


MVC Example

 
We then wind up with classes specifically devoted to managing the interface between the internal and external worlds.


Model-View-Controller

The MVC pattern establishes specific requirements so that GUI changes have minmal impact on the rest of the system.

2.3.2 Adding Detail

The pictures I have shown emphasize our overall view of the system.

But it is important to remember that, as we make these transitions, we are, almost continuously, adding details to our model of the individual classes,