This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
A system is identified in terms of the single goal it is to achieve. A system name is a cognitive handle that allows the identification and communication of a particular coherent and purposeful set of activities. A system name is usually presented in the form of:
“A system to do/be/achieve X”
Example:
A system to generate birth certificates
A system to generate reusable components
A system to provide a uniform computing platform across government agencies
All these may actually refer to the same application software!
Structure modeling is modeling of things and their situational relationships. A photograph is a good structure model. It shows things that were there when the picture was taken and how they were situated with respect to one another.
We can similarly compose diagrams or other models of a problem situation in which we depict all the relevant things and relationships.
There are many ways to do this. We shall discuss the three most popular and prevalent of these. Namely:
Entity Relationship Modeling which is used mainly for database design
Formal Schemas and Formal Object Schemas (using Z and Object Z)
Class Diagrams (using UML) used mainly as part of object oriented modeling
This is an informal (or semi-formal) approach to structure modeling in which a situation is studied so that static and persistent elements in it are identified, along with their static relationships. A collection of like elements is called an entity. A mapping of elements of one entity onto another entity (or itself) is called a relationship.
Entities are defined in terms of a name and a set of attributes. Relationships are defined in terms of a verb phrase (e.g. works-for) that establishes the nature of the mapping between the entities.
The results of ER modeling are almost always shown using diagrams. There are many different conventions. In the absence of an industry standard, we use a popular one here of my preference.
This means that there are many elements belonging to the set Employee (i.e. many persons employed) each is mapped into (has a relationship with) only one element belonging to the entity Department (a specific department). The relationship is that this particular employee works for one specific department. For each employee we keep his or her name, social security number and current salary. For each department we keep the name of the department, its location and its budget.
You will learn (or may have already learned) a lot more about this modeling approach in your database course.
There are many different approaches to causal modeling. Whilst they all attempt to do the same thing, they are not all of the same level of capability, formality, ease of use or learnability. In this course we cover a number of popular approaches to causal modeling, including:
Entity Life Histories
The UML suite of dynamic modeling facilities, which include
These are diagrams that depict the various states of a class or type of object from inception to demise. Usually used in relation to persistent database “entities”, they can become overwhelmed if the states are too numerous or the object can possess concurrent states. They also do not necessarily depict the events that lead to state transitions.
Petri nets are a formal graphical approach to causal modeling. They improve on the capabilities of state diagrams by allowing for proper description of some major issues in concurrency such as synchronization, deadlocks and conflicts.
Petri nets are composed of two types of nodes and one type of arc. The two types of node are called places and transitions. The arc is called an event. A fourth artifact called a token, when located inside a place, marks it as enabled.
Flow charts depict the flow of control. They show how operations are performed and decisions made by depicting how the control in the program is exchanged from the beginning to the end of all paths of interest.
Flow charts show how the program works.
Flow charts are composed of a number of node types and one type of arc. The node types are:
Start/End node Transformation node Decision node Link node Special processing nodes Logic nodes
High level flow charts depict the flow of control at a high level of granularity, such as the organization or the entire system. Low level ones usually depict the flow of control in a specific program unit.
The difference between a high level and low level flow chart is that in a low level flow chart all transformational nodes contain transformations that can not be usefully broken down to simpler flowcharts themselves. By this we mean doing so would produce transformation at a lower level of granularity than that of the target programming language.
Special processing nodes: These are nodes that depict specific large scale processing or machine interaction. Useful in the early days when flowcharting was amongst the only modeling methods available, they are now largely disused.
Data Flow DiagramsData flow diagrams depict the flow of data. They show how data received as input is changed to outputs by the various operations performed.
Data flow diagrams show how the data changes.
Basic data flow diagrams are composed of a number of node types and one type of arch. The node types are:
External Entities (Sources and Sinks) Processing node
External entities (sources and Sinks): These are entities outside the scope of our focus that provide the inputs from the outside or receive the outputs generated. They are labeled by a noun or an object or class name.
Process nodes: These depict the processing that is done to the inputs into that process to form the output. Usually these nodes are labeled by a verb phrase representing the nature of the processing to be done and a number sequence depicting the process and its level
Data-stores: These are buffers where interim outputs generated are stored for future usage. Data-stores are usually named.Link nodes: They connect the various parts of the diagrams to yield a less cluttered result. They are usually numbered or carry a symbol.
Primary Buffer
The only arc is called a dataflow and it depicts the flow of data (as input into or output from) an external entity or process. They are usually named.
Data Flow diagrams may depict a situation at multiple levels of granularity. By that we mean a process in a data flow diagram may be decomposed into an entire new dataflow diagram at a lower level, and so on. At each lower level, there will be more detail of the model visible. Conversely, one can say that a higher level process can be described in terms of a dataflow diagram composed of simpler, lower level processes, data flows and data-stores. However this decomposition process must stop at some stage. At that stage we shall still have a dataflow diagram that only depicts the transformation of inputs to outputs of various processes. It however does not say HOW each leaf level process should achieve this. This may be obvious but is not defined.
Dataflow diagrams are more so a mechanism for abstraction than a transformational modeling technique. They must be accompanied by a complementary mechanism that defines the leaf level transformations. Something like a flowchart of each leaf process, a pseudo-code, mathematical equation, truth table or formal definition is needed.
• The name compartment contains the name of the class. Class names are centered, begin with a capital letter and are in boldface. Abstract class names are italicized.
• The name compartment contains the name of the object; if a name exists. The name structure, if there, must be underlined. If the name is not there, or for “un-named” objects, the colon must remain.
• The name may be followed by a colon ( : ) followed by a comma separated list of class to which the object belongs.
Attribute values and the attribute values compartment:
• It is optional and may not be present.
• If present, it contains the names of the relevant attributes of the class of which this object is an instance and the values relating to that attribute.
• Only attribute names and values of interest should be shown.
Each association has two roles, each role is a direction on the association. These roles can be explicitly named on the association with a label. If not explicitly labeled, then the role name is the same as the target class and may be omitted.
Collaboration diagrams also show the message exchange (collaboration) between several objects. They do so by depicting the message exchange between object icons through numbering the messages traveling between these objects.
State diagrams may be drawn from the perspective of the whole system as a single object, or from the perspective of any single object at any level of granularity.
State diagrams may show concurrency or may be nested
Usually it is best to draw the state diagram of only one object in the system at a time
A most important stage of the software process is that of the Specification process.
The specification process entails all those activities that relate to the identification and documentation of users’ needs. In itself, the Specification process has several elements or sub-components. These are:
Once software requirements are elicited, they must be captured and documented in a clear, unambiguous and accessible way. This is called Requirements Capture or Requirements Documentation.
Goal OrientationA system is identified in terms of the single goal it is to achieve. A system name is a cognitive handle that allows the identification and communication of a particular coherent and purposeful set of activities. A system name is usually presented in the form of:
“A system to do/be/achieve X”
Example:
A system to generate birth certificates
A system to generate reusable components
A system to provide a uniform computing platform across government agencies
All these may actually refer to the same application software!
Each system name implies a single goal that defines a certain boundary and a specific set of interactions which in turn define the context of the system.
If you cannot clearly name a system (identify a label that clearly indicates the goal to be attained), you are not yet ready to proceed with its analysis.
The system goal (name) implies a set of interactions between “the system” and the outside world (outside entities or stakeholders) and a set of transformations within the system that together achieve the purpose or goal implied. The border transcended by these interactions is called the boundary.
Whilst it is important to identify and consider the impact and interaction of each and every stakeholder/role player with the system and with each other to better understand the system, it is unnecessary to model each in detail. It is the system within the boundary that is to be defined and analyzed not what lies outside. It is therefore permissible to abstract outside entities (stakeholders) into one or a small number of abstract entities or concepts.
Transformations are a set of end-to-end activities that may be initiated by an interaction (a call) from the outside world but take place within the system in order to achieve the goal for which the system exists or is to be constructed. A set of transformations in a particular order describe how the system goal is achieved.
A transformation can be (often is) in itself considered the goal for a subsystem of the system at a lower level.
In order to construct a scenario, we first need to identify and express the goal for the system of which the scenario would describe the transformations. This can be in the form of a system name.
Having identified the goal, the main action implied by the system name would become the name or the focus of the scenario.
We then identify and name all the stakeholders of the system that are significant in achieving the goal at hand. Each stakeholder would lead us to specific activities that may not have been foreseen. For example by identifying a system administrator, we may become aware of the need for system administration activities.
We then capture the end to end activities that would achieve the goal and the order in which they need to be performed, if an order is extant or implied. Otherwise we decide on the order. This is a crucial step as sometimes an order is not apparent but is extant.
We then identify the initiating stakeholder that starts the scenario, and write down the first line of the scenario in the form of:
Stakeholder action verb
Example: customer places order
or preferably
Stakeholder action verb system or system component
Example: A scenario for establishing a modem connection
1. Identify and express the goal, state system name:A system to establish a modem connection between two modems.
It assumes that there are two modems, each on one side, connected to computing equipment (in this case two personal computers) and that the personal computers are ready and modems are installed and enabled properly and that the communication line is available (subscription exists).
2. In this exchange John and Mary are the two individuals involved who wish to establish a connection using their modems. John initiates the call.
3. John sends “wake” signal to modem 1 Modem 1 connects to line Dial tone begins Modem sends Acknowledge to John John sends number sequence 555-1212 Modem 1 “Acknowledge”s John Modem 1 dials 5 Dial tone ends Modem 1 dials 5 Modem 1dials 5 Modem 1 dials 1 ::::::: Mary’s modem receives call signal Call is routed
Ringing tone is heard by John Modem 2 connects to line Modem 2 stops ringing Modems are connected Modem 1 sends data stream Modem 2 sends reply data stream John sends disconnect signal Modem 1 sends disconnect signal Line disconnects John is notified of disconnection Mary is notified of disconnection
John sends “wake” signal to modem 1 Modem 1 connects to line Dial tone begins Modem sends Acknowledge to John John sends number sequence 5%5-1212 Modem 1 “Acknowledge”s John Modem 1 dials 5 Dial tone ends Modem 1 dials % Modem 1dials 5 Modem 1 dials 1 ::::::: Recording indicates invalid number John disconnects
Our example scenario indicated what actually happened between the stakeholders through a system. It says nothing about what specifically was asked of the system and what did the system specifically do or asked to be done.
Our example scenario was between John and Mary, does it matter if it is between these two or between Gunter and Gretchen?
Our example scenario had 28 lines. How many lines should there be in a scenario? Is there a minimum? A maximum? Does it matter?
Usecases are tools of requirements analysis and specification
They are a tool by which we analyze system interactions and what interactions are required and in what order and hierarchy for the goal to be achieved.
Usecases are abstract
They are depictions of the abstract (except for leaf level usecases) activities between an abstraction of the stakeholders and the system or its components, in terms of lower level transformations.
A system is described in terms of its goal, which implies a boundary, which in turn implies (by exclusion) stakeholders who are outside the system scope but interact with it.
As the artifact to be designed is “the system” and not its stakeholders, it is a good idea to concentrate on the system and its interactions with the outside world, which can be conveniently abstracted .
There are two levels of interactional abstraction:
Abstraction by elimination of intermediate elements
Each system name implies a single goal that defines a certain boundary and a specific set of interactions which in turn define the context of the system.
If you cannot clearly name a system (identify a label that clearly indicates the goal to be attained), you are not yet ready to proceed with its analysis.
The system goal (name) implies a set of interactions between “the system” and the outside world (outside entities or stakeholders) and a sequence of transformations within the system that achieves the purpose or goal implied. The border transcended by these interactions is called the boundary.
Whilst it is important to identify and consider the impact and interaction of each and every stakeholder/role player with the system and with each other to better understand the system, it is unnecessary to model each in detail. It is the system within the boundary that is to be defined and analyzed not what lies outside. It is therefore permissible to abstract outside entities (stakeholders) into one or a small number of abstract entities or concepts.
A Transformations is an element of a sequence of end-to-end activities that may be initiated by an interaction (a call) from the outside world but take place within the system in order to achieve the goal for which the system exists or is to be constructed. Therefore, a set of transformations in a particular order ( a sequence) describe how the system goal is achieved.
A transformation can be (often is) in itself considered the goal for a subsystem of the system at a lower level.
In order to construct a scenario, we first need to identify and express the goal for the system of which the scenario would describe the transformations. This can be in the form of a system name.
Having identified the goal, the main action implied by the system name would become the name or the focus of the scenario.
We then identify and name all the stakeholders of the system that are significant in achieving the goal at hand. Each stakeholder would lead us to specific activities that may not have been foreseen. For example by identifying a system administrator, we may become aware of the need for system administration activities.
We then capture the end to end activities that would achieve the goal and the order in which they need to be performed, if an order is extant or implied. Otherwise scenarios must be found that imply the sequence we seek.
We then identify the initiating stakeholder that starts the scenario, and write down the first line of the scenario in the form of:
Stakeholder action verb
Example: customer places order or preferably
Stakeholder action verb system or system component
Example: A scenario for establishing a modem connection
1. Identify and express the goal, state system name:A system to establish a modem connection between two modems.
It assumes that there are two modems, each on one side, connected to computing equipment (in this case two personal computers) and that the personal computers are ready and modems are installed and enabled properly and that the communication line is available (subscription exists).
2. In this exchange John and Mary are the two individuals involved who wish to establish a connection using their modems. John initiates the call.
3. John sends “wake” signal to modem 1 Modem 1 connects to line Dial tone begins Modem sends Acknowledge to John John sends number sequence 555-1212 Modem 1 “Acknowledge”s John Modem 1 dials 5 Dial tone ends Modem 1 dials 5 Modem 1dials 5 Modem 1 dials 1 ::::::: Mary’s modem receives call signal Call is routed
Ringing tone is heard by John Modem 2 connects to line Modem 2 stops ringing Modems are connected Modem 1 sends data stream Modem 2 sends reply data stream John sends disconnect signal Modem 1 sends disconnect signal Line disconnects John is notified of disconnection Mary is notified of disconnection
John sends “wake” signal to modem 1 Modem 1 connects to line Dial tone begins Modem sends Acknowledge to John John sends number sequence 5%5-1212 Modem 1 “Acknowledge”s John Modem 1 dials 5 Dial tone ends Modem 1 dials % Modem 1dials 5 Modem 1 dials 1 ::::::: Recording indicates invalid number John disconnects
Our example scenario indicated what actually happened between the stakeholders through a system. It says nothing about what specifically was asked of the system and what did the system specifically did or asked to be done.
Our example scenario was between John and Mary, does it matter if it is between these two or between Gunter and Gretchen?
Our example scenario had 28 lines. How many lines should there be in a scenario? Is there a minimum? A maximum? Does it matter?
Usecases are tools of requirements analysis and specification
They are a tool by which we analyze system interactions and what interactions are required and in what order and hierarchy for the goal to be achieved.
Usecases are abstract
They are depictions of the abstract (except for leaf level usecases) activities between an abstraction of the stakeholders and the system or its components, in terms of lower level transformations.
A system is described in terms of its goal, which implies a boundary, which in turn implies (by exclusion) stakeholders who are outside the system scope but interact with it.
As the artifact to be designed is “the system” and not its stakeholders, it is a good idea to concentrate on the system and its interactions with the outside world, which can be conveniently abstracted .
There are two levels of interactional abstraction:
Abstraction by elimination of intermediate elements
Abstraction by categorizationIn the case of John and Mary, John was the Caller, Mary was the Callee. Can we generalize the case by considering this more abstract case?
When does the abstraction end? A category is usually a sub-category of another? When do we stop?
Caller and Callee User, User Person, etc.
It is customary to be as general as possible without loss of meaning.
In addition to interactional abstraction (between stakeholders and systems) we can also have behavioral abstraction (within the system).
Behavioral abstraction is the activity of describing the system through a set of abstract behaviors, themselves being described by other sets of behaviors.
Behavioral abstraction allows us to concentrate on what is of import at any one time. It helps our brains to understand the situation more clearly and completely without being overwhelmed.
A transformation is a concise abstraction of a behavior. A transformation is also a mapping. It can be depicted as an end-to-end un-conditional path through a set of activities that achieves a certain end. A transformation is formally described in terms of its:
A transformation cannot commence unless all conditions necessary for it to commence have been already successfully conducted. For example a transformation (withdraw money form check account), cannot commence unless there is an account already opened (open_account( ) has succeeded), and there is a cash balance in the positive and equal or exceeding the amount to be withdrawn or there is an overdraft provision, etc. It is important to recognize that every transformation is a potential usecase and every usecase a transformation. So:
Each usecase and each transformation within a usecase has a set of pre-conditions that must be satisfied.
Each transformation implies a set of activities that have to take place in exactly the same way, every time. This implies that in a given usecase described by a set of transformations, all transformations must always be applied and in exactly the same fashion: no conditionals are allowed.
Conditionals imply other cases (similar to alternate scenarios) that we deal with separately.
Each transformation must when presented its pre-conditions, satisfy the goal for which it exists. Invariants imply that this goal should be unique and its accomplishment or otherwise clearly identifiable.
However, this does not imply that each transformation only has a single post-condition as in addition to what must change, there are numerous conditions that must-not. Post-conditions must also ensure that what must not change, has not changed.
For practical purposes, we only consider the positive post-conditions for usecases.
A transformation must be formally defined. It must clearly indicate its source, its target and the action to be performed. Therefore a transformation must always be defined as below:
Object A requests service S from Object B
Example:
UI requests service fetch(id) from Record
Where UI happens to be the User Interface Object (an external Actor) and Record is an internal object to the system that has capability fetch( ) that requires parameter id.
An object that is external to one context may be deemed internal to another even within a single usecase. This makes sense as each transformation line of a usecase is to be deemed as a system of an object (on the left-hand side) requesting a service from another object (on the right-hand side) which at the time is deemed to be THE system. On the following line the order of request is usually reversed, that is the object that was on the right-hand side is now the left-hand side (requester) object on the succeeding line. See next rule; rule of progression 1.
UI requests service fetch(id) from RecordRecord requests service Ack_valid( ) from UI
On the first line UI is the external object and the Record or the system that contains Record is the system of concern (Record is the internal object), On the second line Record is the external object requesting a service from a UI system.In other words, if we were to design a Records system, fetch(id) would be a part of it but Ack_valid( ) is not. When designing a UI system, the ability to acknowledge if a record displayed is valid (Ack-valid ( ) ) is part of the system.
The right-hand side object on the first line of a usecase must be an internal object (the “system” object or an object that is a component of the system) in our present context.
UI requests service fetch(id) from Record
Record is a component of the system being designed.
Given a non-simultaneous (single-thread) situation, if the right-hand side object on line n is an internal object, the left-hand side object on line n+1 must be the same object
UI requests service fetch(id) from RecordRecord requests service Ack_valid( ) from UI
Given a simultaneous (multi-thread) situation, if the right-hand side object on line n is an internal object, the left-hand side objects on the relevant multiple succeeding lines (each signifying a thread) must be the same object.
UI requests service fetch(id) from RecordRecord requests service validate( ) from UIRecord requests service lock(id) from Database-manager
Given a simultaneous (multi-thread) situation, each thread must follow rule of progression 2. If an order is implied in the threads, the order must be followed in an interleaved fashion.
Object A requests service S( ) from Object BObject B requests service T1( ) from Object AObject B requests service T2( ) from Object CObject A requests service T11( ) from Object DObject C requests service T12( ) from Object E
If the right-hand side object of a usecase line is an external object (actor), then the left-hand side object of the next line on that thread must also be an external object (not necessarily the same object).
Object A requests service S( ) from Object BObject B requests service T( ) from Object AObject D requests service M( ) from Object E
Any thread may cease upon task completion. The last thread(s) may only terminate when the goal is met.
Object A requests service S( ) from Object BObject A requests service R( ) from Object C Object B requests service P( ) from Object D terminatedObject C requests service M( ) from Object E terminatedObject C requests service N( ) from Object AObject A requests service …………………….
All threads must terminate, preferably on an external. That is the right-hand side object of any terminating thread (last line of a thread) should be (but does not have to be) an external object.
Object A requests service S( ) from Object BObject A requests service R( ) from Object C Object B requests service P( ) from Object D terminatedObject C requests service M( ) from Object E terminatedObject C requests service N( ) from Object AObject A requests service …………………….Object X requests service W( ) from Object F terminated
Caller req. ser. Wake from Modem 1 Modem 1 req. ser. Connect from Line Line req. ser. Sound_ dial_ tone from Modem 1 Modem 1 re. Ser. Acknowledge from Caller Caller req. ser. Accept_ dial_ seq. from Modem 1 Modem 1 req. ser. Dial from Line Line req. ser. Receive_ call_ signal from Modem2 Modem 2 req. ser. Routed from LineLine req. ser. Sound_ring_tone from Modem 1Line req. ser. Ring_phone from Modem 2 Modem 1 req. ser. Rec._ringing_tone from caller Modem 2 req. ser. Rec.phone_ringing from calleeModem 2 req. ser. Picked_up from LineLine req. ser. Stop_ring_tone from Modem 1Line req. ser. Stop_ringing from Modem 2Cont’d next column
Line req. ser. Connect from Modem 1Line req. ser. Connect from Modem 2Modem 1 req. ser. Connected from CallerModem 2 req. ser. Connected from CalleeCaller req. ser. Disconnect from Modem 1Modem 1 req. ser. Disconnect_signal from LineLine req. ser. Break_connect from Modem 1Line req. ser. Break_connect from Modem 2Line req. ser. Sound_dial_tone from Modem 1Line req. ser. Sound_dial_tone from Modem 2Modem 1 req. ser. Dial_tone from CallerModem 2 req. ser. Dial_tone from Callee
Pre-conditions: A set of conditions that must be true before the usecase can be initiated and the name of the usecase or usecases that operationalize them.
Transformations: List of end-to-end events that need to take place for the goal to be achieved.
Post-conditions: Given the pre-conditions, a set of conditions that must exist when the usecase ends.
Extension points: A list of points in the usecase where non-normal courses extend out.
Subordinates: List of usecases that are subordinate to the present usecase, that is, usecases that expend an individual transformation of this usecase.
Architectural Other – non-functional – requirements that Requirements: might impact the usecase
Status: Where in the project are we with this usecase
Features in: The list of usecase diagrams – if any – in which this usecase is depicted
Sequence diagram: The name or address of the document that contains the sequence diagram relating to this usecase
A vending machine is there to dispense food, drink or cancer in exchange for an exact price. The “normal course” usecase for a vending machine is therefore the one dealing with receiving the exact change and dispensing the item selected.
A non-normal course would be when the system asks for more money, not enough having been inserted in the first place, or making and giving change.
The process of identifying non-normal courses is very simple.
Begin with the normal course which has been identified and its pre-conditions and transformations have been enumerated.
Start with the pre-conditions. For each pre-condition ask if an alternate valid course would be possible if this pre-condition was not met. If so, name and develop it into a usecase.
Then proceed to the transformations section. Start with the first line. Ask if there could be any other way to proceed at that line, than the one suggested by the normal course. Each one is a potential non-normal usecase.
Beware of the menace of the combinatorial explosion.
Theoretically, there can be an infinite number of possibilities (non-normal courses) for each line of transformation. In a solution bound to a Von Neumann machine the number of possibilities are however always finite. This is not necessarily good news. Ten trillion possibilities is still unmanageable.
How do we battle this menace?
We use the two concepts of abstraction and contextualization.
Using abstraction to deal with combinatorial complexity:
The method to employ is very similar to the method of equivalence partitioning in testing. In fact in a way it is the same method. The idea is to select not every possibility individually as a separate course but to select a sample case with the assumption that it can stand as the equivalent for an entire class of potential courses.
For example we might consider one course of “more change needed” irrespective of whether the change needed is 3 cents or $1.05. No longer do we need to consider each individual needed change value. Of course this is a big assumption. Not all equivalences we assume are truly equivalent.
Using contextualization to deal with combinatorial complexity:
Given infinite time and resources, we can consider and implement every non-normal course. This is clearly impossible as for even a very simple system the time and resource requirements to do so would be astronomical. Like any other area of engineering, we therefore must compromise. The software engineer – may be in collaboration with the other stakeholders – should (must) decide on which non-normal courses to consider and which to ignore. A judgment must be made based on the impact the exclusion of a particular course might have on the system.
What would be the impact of excluding a normal course usecase or having an imperfect or incomplete one? What quality characteristic would suffer as a consequence?
What would be the impact of excluding a non-normal course usecase or having an imperfect or incomplete one? What quality characteristic would suffer as a consequence?
One can therefore measure functionality and reliability of a system through the use of usecases. We shall not deal with this issue here in detail.
Important note:
Identifying a non-normal course and developing one are two different things. I may recognize that a vending machine may need to deal with foreign currency but not do anything about it.
A transformation set, a usecase and a usecase folder:
These terms are often confused, sometimes even by experts.
A transformation set is the “transformation/behavior” section of a usecase. Admittedly, it is the most important part of a usecase but it is not THE usecase.
A usecase is the transformation set PLUS the other sections as described in the previous pages
A usecase folder is the set of all usecases that relate to each other at one level. For example a normal course and all its developed non-normal courses. Subordinate usecases have their own folders.
Often we find ourselves repeating the same sequence of activities over and over. If these activities define a concrete objective to be achieved, then they represent a bona fide usecase. We may develop this usecase once and use it several times in different – larger – contexts. In this sense this usecase is a component of the other.
Note: An arbitrary set of steps may not be simply bunched together and named a usecase to then be used as a component. For a component usecase to be a component usecase, it first has to be a usecase and that means supporting a concrete goal.
Each usecase has a set of transformations; one per line. Each transformation in itself implies a goal – a subordinate goal – to be achieved. The usecase describing the achieving of this subordinate goal is a subordinate usecase to the one above it.
Caller req. ser. Wake from Modem 1 Modem 1 req. ser. Connect from Line Line req. ser. Sound_ dial_ tone from Modem 1 Modem 1 re. Ser. Acknowledge from Caller Caller req. ser. Accept_ dial_ seq. from Modem 1 Modem 1 req. ser. Dial from Line Line req. ser. Receive_ call_ signal from Modem2 Modem 2 req. ser. Routed from LineLine req. ser. Sound_ring_tone from Modem 1Line req. ser. Ring_phone from Modem 2 Modem 1 req. ser. Rec._ringing_tone from caller Modem 2 req. ser. Rec.phone_ringing from calleeModem 2 req. ser. Picked_up from LineLine req. ser. Stop_ring_tone from Modem 1Line req. ser. Stop_ringing from Modem 2Cont’d next column
Line req. ser. Connect from Modem 1Line req. ser. Connect from Modem 2Modem 1 req. ser. Connected from CallerModem 2 req. ser. Connected from CalleeCaller req. ser. Disconnect from Modem 1Modem 1 req. ser. Disconnect_signal from LineLine req. ser. Break_connect from Modem 1Line req. ser. Break_connect from Modem 2Line req. ser. Sound_dial_tone from Modem 1Line req. ser. Sound_dial_tone from Modem 2Modem 1 req. ser. Dial_tone from CallerModem 2 req. ser. Dial_tone from Callee
Caller req. ser. Wake from Modem 1 Modem 1 req. ser. Connect from Line Line req. ser. Sound_ dial_ tone from Modem 1 Modem 1 re. Ser. Acknowledge from Caller Caller req. ser. Accept_ dial_ seq. from Modem 1 Modem 1 req. ser. Dial from Line Line req. ser. Receive_ call_ signal from Modem2 Modem 2 req. ser. Routed from LineLine req. ser. Sound_ring_tone from Modem 1Line req. ser. Ring_phone from Modem 2 Modem 1 req. ser. Rec._ringing_tone from caller Modem 2 req. ser. Rec.phone_ringing from calleeModem 2 req. ser. Picked_up from LineLine req. ser. Stop_ring_tone from Modem 1Line req. ser. Stop_ringing from Modem 2Cont’d next column
Line req. ser. Connect from Modem 1Line req. ser. Connect from Modem 2Modem 1 req. ser. Connected from CallerModem 2 req. ser. Connected from CalleeCaller req. ser. Disconnect from Modem 1Modem 1 req. ser. Disconnect_signal from LineLine req. ser. Break_connect from Modem 1Line req. ser. Break_connect from Modem 2Line req. ser. Sound_dial_tone from Modem 1Line req. ser. Sound_dial_tone from Modem 2Modem 1 req. ser. Dial_tone from CallerModem 2 req. ser. Dial_tone from Callee
We can first abstract by elimination of intermediate elements.
Modem 1 req. ser. Connect from Line Line req. ser. Sound_ dial_ tone from Modem 1 Modem 1 req. ser. Dial from Line Line req. ser. Receive_ call_ signal from Modem2 Modem 2 req. ser. Routed from LineLine req. ser. Sound_ring_tone from Modem 1Line req. ser. Ring_phone from Modem 2 Modem 2 req. ser. Picked_up from LineLine req. ser. Stop_ring_tone from Modem 1Line req. ser. Stop_ringing from Modem 2Line req. ser. Connect from Modem 1Line req. ser. Connect from Modem 2Modem 1 req. ser. Disconnect_signal from LineLine req. ser. Break_connect from Modem 1Line req. ser. Break_connect from Modem 2Line req. ser. Sound_dial_tone from Modem 1Line req. ser. Sound_dial_tone from Modem 2
0 Modem 1 req. ser. Connect from Line 0 Line req. ser. Sound_ dial_ tone from Modem 1 0 Modem 1 req. ser. Dial from Line 0 Line req. ser. Receive_ call_ signal from Modem 2 0 Modem 2 req. ser. Routed from Line00 Line req. ser. Sound_ring_tone from Modem 1T01 Line req. ser. Ring_phone from Modem 2 01 Modem 2 req. ser. Picked_up from Line011 Line req. ser. Stop_ring_tone from Modem 1012 Line req. ser. Stop_ringing from Modem 2T013 Line req. ser. Connect from Modem 1014 Line req. ser. Connect from Modem 2013 Modem 1 req. ser. Disconnect_signal from Line013 Line req. ser. Break_connect from Modem 1014 Line req. ser. Break_connect from Modem 2013 Line req. ser. Sound_dial_tone from Modem 1T014 Line req. ser. Sound_dial_tone from Modem 2T
We can now apply abstraction of categorization. We recognize that a modem is a type of Telephony Terminus Device (TTD). Others such as a hand-set or a fax machine also exist. This would allow for devices other than a modem to be included.
We are still dealing with 17 lines of transformations, significantly larger than the 7±2 suggested by the Miller’s rule.
Use Case: Communicate via Modem
Actors: TTD 1, TTD 2
Initiating Actor: TTD 1
Events:
0 TTD1 req. ser. Connect from Line 0 Line req. ser. Sound_ dial_ tone from TTD 1 0 TTD1 req. ser. Dial from Line 0 Line req. ser. Receive_ call_ signal from TTD2 0 TTD2 req. ser. Routed from Line00 Line req. ser. Sound_ring_tone from TTD1T01 Line req. ser. Ring_phone from TTD2 01 TTD2 req. ser. Picked_up from Line011 Line req. ser. Stop_ring_tone from TTD1T012 Line req. ser. Stop_ringing from TTD2T013 Line req. ser. Connect from TTD1014 Line req. ser. Connect from TTD2013 TTD1 req. ser. Disconnect_signal from Line013 Line req. ser. Break_connect from TTD1014 Line req. ser. Break_connect from TTD2013 Line req. ser. Sound_dial_tone from TTD1T014 Line req. ser. Sound_dial_tone from TTD2T
Pre-conditions and pre-condition operationalization
Usecases also have pre-conditions defined for them. Each usecase is in final analysis nothing but a transformation; and transformations have pre-conditions. But what is a pre-condition?
A pre-condition is simply a transformation that has to have occurred before the current transformation (this usecase) can occur. If so, then each pre-condition, being a transformation, implies a usecase. So each precondition must be related or recognized as an existing usecase, or if none exists, then it has to be defined.
Usecase place_order has a pre-condition user_is_logged_in. This implies that there has to be a usecase log_in somewhere in the system. Two possibilities exist:
1. There is a usecase at a higher level with a set of transformations that reads something like: :::::::::3. UI requests service log_in( ) from Guardian4. Guardian……… ::::::::::::7. UI requests service place_order(ord_details) from Shipment ::::::::::::
Using usecases to extract an object-oriented models:
Extracting the dynamic model
A well-formed usecase can tell us which object requested what service from which other object and in what sequence. It also captures (although deficiently) whether there was simultaneity and parallel threads.
This is almost all the information we need to extract an object-oriented dynamic model of the situation. This could be in the form of sequence diagrams, collaboration diagrams or later, state diagrams.
If we have a well-formed usecase, construction of a sequence diagram becomes rather trivial.
A sequence diagram depicts the order of the exchange of messages between the various objects involved in order to achieve a certain goal. Usecases do exactly the same and well-formed ones contain all the necessary information to extract a sequence diagram.
The left-hand side object of any one line of usecase is a client object, the right-hand side one the server for a particular message request, which is the transformation of that given line. Therefore all objects needed for the sequence diagram all simply the left-hand side and the right-hand side words of the transformation set.
A message (an arrow in a sequence diagram) is from a client to a server, thus it is from the life-line of a left-hand side object to the one of the right-hand side. The label on it is the name of the transformation.
The order of the arrows are the order of the lines.
Use rules of progression to figure out multi-threading.
Collaboration diagrams contain the same essential information as sequence diagrams.
A collaboration diagram also depicts the order of the exchange of messages between the various objects involved in order to achieve a certain goal. As we know usecases also do exactly the same and well-formed ones contain all the necessary information to extract a sequence diagram.
A well-formed usecase can tell us which object requested what service from which other object. Therefore a full set of well-formed and related usecases would contain in it all the objects that exchange messages in the system and the messages that they exchange. As each object must belong to a class, all classes required in the system are therefore identifiable. As each message is a request for an object to perform an operation, all the operations are also known.
The hierarchy of usecases and their subordinate ones also indicate a structural hierarchy.
This almost all the information we need to extract an object-oriented static model. This could be in the form of a class diagram.
Each line of usecase at level n implies a pair of objects (therefore also classes) and an operation on the server class. This latter class may be (usually is) a complex class (an entire system or sub-system) and the operation implied with respect to it a complex behavior.
This latter operation may however be now taken as the subject for a new usecase, implying that the server object at level n is now our “system”, with (for the moment) one goal; the operation it has to perform.
Now we can start the system analysis effort over again, this time at the lower n+1 level of granularity.
This implies new lower level (component) objects (and therefore
A usecase is well-formed if it follows the one initiation, five progression and two termination rules.
There may be other rules added to these to cater for architectural concerns, but that is of no concern to us here. Should extra rules exist, then following these is also a requirement of well-formedness.
Additionally, to be well-formed, a usecase must be documented in one of the accepted usecase documentation formats. The one provided herein is recommended.
Essential completeness is ensured when there is covered traceability to at least the functional requirements set. This means that all stated and implied functional requirements must be covered by usecases.
Structural completeness is ensured when all named transformations have been either expanded into lower level usecases or into procedural flow (if at leaf level). We also need to ensure that all necessary non-normal course usecases have been considered and documented.
It is also necessary to ensure that there is a relevant entry in each cell of the usecase template and that those containing no entries are explicitly mentioned to be blank.
Here we must ensure that everyone is happy with our usecase set. We must check for understandability, logical consistency, and necessity (that there is nothing we don’t need).
You need to review with all stakeholders:
Review with Clients
Review with Actors, and
Review with Owners.
Remember that there are several systems with which you are concerned here, not just a software specification.
Applying these techniques shall identify many potential classes from the domain. We now need to sift through these and select a coherent set of the “right” classes, discarding the rest. To do so we apply a number of heuristics (Younessi et al.; 1995):
An attribute is one aspect of reality relating to the class about which we need information. In fact an attribute is the shorthand for a question about the class. For example:
Good attributes should have the following characteristics:
• Relevant: An attribute must relate to the universe of discourse; e.g. color of check not relevant in a banking system
• Atomic: An attribute must contain one value at any one time
• Encompassing: An attribute must be characteristic of the entire object not a component of it; e.g. diameter is an attribute of a tire not of a car
• Local(non-relational): The attribute of an object must not attempt to capture a characteristic of a relationship; e.g. permission_value is an attribute of Permission not of either a Person or a File.
Operations are things that a class does (for other classes). They are the responsibilities of the class. This must be contrasted with things that class a does for itself. These are the private methods. We are concerned with operations (i.e. responsibilities).
Operations can also be simple or complex. Simple operations are not necessary in an analysis model. Simple operations include:
Technically speaking an association is a relationship between the classes of objects. This means that a link is established between these objects that are instances of this association. A link between two objects lets one object be mapped to the other.
This is a static relationship between classes, it is NOT a path for a message or a dynamic link between two individual objects.
Containment is that relationship when an object is temporarily placed inside another. For example a picnic basket in the trunk of a car.
In contrast aggregation is the relationship between objects which has a compositional, more permanent (not necessarily perpetual), and emergent properties.
Containment is always transitive, aggregation may or may not be.
Yet both containment and aggregation are always asymmetric.
An apple in a picnic basket in the trunk of a car (Containment)
Left arm part of Houman, Houman part of CS department (Aggreg.)
Now an apple, or a picnic basket although inside a car are not a part of the car in the sense that there is no emergent relationship or dependency between them. On the other hand, Houman’s arm is part of Houman and without it Houman will not be complete. Houman is also part of the CS department and without him (Houman hopes) the CS department is not complete.
This is the parent-child relationship. UML’s label for this type of relationship is GENERALIZATION.
In fact there are three main forms of inheritance all of which may be gainfully used in object orientation but only one of these conforms to a generalization.
As the name implies sub-typing is a logical relationship between types. Specialization and restriction are physical relationships between implementations of classes.
Example:
MOUSE is a sub-type of MAMMAL
A BINARY_SEARCH_TREE is a sub-type of BINARY_TREE
For B to be a sub-type of A, it first has to be an A. Then it can only ADD features, leaving all other features unchanged.
The process of production of CRC cards is most aligned with the first utility mentioned: To identify model elements such as classes, methods and associations.A CRC card is a 4 6 or a 5 7 card one which there are three main compartments. These compartments are:
• Identify a potential class. This may be done with the help of a usecase.
• Create a card for that class by first selecting a name and putting that name on the card.
• Now identify one responsibility for which you feel this class must exist. Record this in the responsibilities column
• Identify the potential object that requests this responsibility of the class identified. Record this in the collaboration column and in front of the responsibility concerned.
• Identify the specific pieces of information needed to identify this class, or the class needs to hold. Write them as attributes on the back of the card.
• If this potential class is in a hierarchy, depict the hierarchy.
• Include some notes and comments if needed and identify the project.
• Produce a similar card for any new potential class that was discovered.
Once you have a handful of inter-relating CRC cards that collectively describe the system or at least some of its functionality, you are ready to play the CRC game. The game is played in two different forms depending on whether the intent is to validate the model or to refine it.
To refine the model, you have to have your CRC cards and one person to play the role of each class.
To validate you have to have a reasonably complete set of cards, a reasonably comprehensive set of use cases, one person to play each class and one or several small bean bags, balls or similar objects.
Give each person the card they are to play the role of.
Start at a logical place with some class. Debate if it is needed or if it needs to change.
Start a thread that can be initiated by invoking one of the responsibilities of that class.
Identify the collaborator (target) class. Pass control to that class by calling the service you need of that class. If collaborator class does not exist, create it.
Keep playing until every responsibility on every card has been either discharged or debated and discarded. Similarly for every attribute.
Do not be afraid to combine classes, or split them as necessary, or indeed discard them.
Add responsibilities as and when needed or delete them if not useful.
• Give each person the card they are to play the role of. Also nominate a person to play each external actor.
• Start with your top ranking use case . Identify the actor who initiates things and give him or her the bean bag.
• The actor starts a thread that can be initiated by passing the bag to the correct class according to the use case.
• The class checks if it can accept the bag. If yes, it does so, if not we raise an alarm and debate and rectify the model. The class now passes the bag to a class whose service it needs (calls), a class for which it is a collaborator.
• Keep playing until the use case is complete and update the model if necessary
These issues are common amongst virtually all systems to be designed and there is nothing particularly object oriented about them. As such we shall not cover these issues in this treatment.
What we shall deal with is a set of design guidelines when dealing with object oriented software.
UML provides three labels: Private (-), Protected (#) and Public (+). Unfortunately these three labels are either insufficient when mapped to the visibility scope of some OO languages (e.g. Eiffel), or confusing as sometimes the definitions have subtle differences depending on what the target language might be.
I do not wish to go into language specifics but for example protected in C++ and in Java are slightly different. The private visibility in Smalltalk is more like the Java protected visibility than
They are a problem. In fact some modeling languages and processes (e.g. OPEN) do not support them.
Although semantically it is always the case that an n-ary association would lose information when resolved into n- binary associations, practically, we have no choice.
Identify ALL higher than binary associations and resolve them into as many binary associations as needed. Usually more than n.
Seemingly contrary to the previous tip, it is a good design decision to promote link attributes to bona fide classes. This will create a higher than binary situation which then needs to be resolved through indexing or some other means.
Resist the temptation to absorb the association attributes into one or the other associated class.
Separate the what from the how. Abstract the contract and deliver against it. This allows for changing the underlying implementation without having to change the client code.
Each one-to-many association maps to a distinct table or may be buried as a foreign key in the table for the many class.
Each one-to-one association maps to a distinct table or may be buried as a foreign table, usually the latter.
A qualified association (indexed association) maps to a distinct table with at least three attributes: the primary key of each related class and the qualifier.
Aggregation follows the same rules as enumerated associations.
In a large project, the design will consist of many classes and a myriad of associations and other artifacts. It can become too complex to handle, comprehend or even draw. This is when packaging things into modules would help.
Rules on packaging
Rule 1:
Keep classes that relate to the same concern or functionality together.
Rule 2:
Keep interactions and dependencies (coupling) between packages at a minimum
For example in a financial system dealing with stock-brokerage you might have some classes that deal with share dealing; you might have another set that deal with back-office accounting; yet another group of classes may deal with the user interface. There may be a set of classes that deal with communication between various systems and finally some classes that are used as utilities.
One good way is to package all share dealing classes together in a sub-system. All Back office accounting classes form another sub-system. Then the two can go together to form a larger sub-system called DOMAIN.
All GUI classes can go together in a subsystem called GUI, all communications classes into one called COMMS. Then the two together can form a larger subsystem called INTERFACE.
The Utilities classes go together in a package called UTIL.
Usecases and project schedule/Work Breakdown Structure (WBS):
We had mentioned earlier that a usecase may be prioritized. Once we have a priority value for each of our usecases, we can utilize this information to create a project schedule.
The process is very simple, we rank the usecases according to their priority and their level, we then start with the highest priority/level usecase and work our way down until we run out of time or money.
A level number corresponds with the level of the hierarchy of usecases and its subordinates. The top level usecase is at level 1, all its subordinates are at level 2, etc.
3. No non-normal course usecase may have a priority number higher than or equal to the normal course. Of course different non-normal course may have different priorities.
4a. Rank usecases in order of priority but with higher level usecases of the same priority first. OR
4b. Rank usecases in order of level numbers but with higher priority usecases of the same level first.
Usecases may be utilized in validation and verification of systems. It is however imperative to recognize that usecases are essentially specification tools and NOT a means of requirements elicitation; that role is filled by scenarios.
Usecases therefore are tools to validate design and not programs.
Despite their popular utility as test script, they are inappropriate for that purpose.
This does not mean however that we cannot extract test scripts from usecases with a little effort.
A usecase may be the guiding document for conducting a Class-Responsibility-Collaboration (CRC) game. CRC can highlight design faults and deviations of the design from the intended specification.
Using usecases to extract test-scripts:
The essence here is to extract an end-to-end non-abstracted sequence of events that describes a purposeful interaction with the system. Thus a usecase could yield many test-scripts. Equivalence partitioning is the technique to be used here.
This is where each input condition is partitioned into sets of valid and invalid classes called equivalence classes. These are in turn used to generate test cases by selecting representative values of valid and invalid elements from each class. In this approach one can reasonably assume but not be certain that a test of a representative value of each class is equivalent to a test of any other value. That is, if one test case in a class detects an error, all other test cases in the class would be expected to do the same. Conversely, if a test case did not detect an error, we would expect that no other test case in the class would find an error.