Chapter 4 - Domain Models
Chapter 4 - Domain Models
Software Engineering - I
An Introduction to Software Construction Techniques for Industrial
Strength Software
Domain Models
During requirements analysis phase, different models are developed to express
requirements of the system. Though it is difficult to draw a line between these models as
they complement each other, they differ in the manner information is expressed in these
models. Most of these models are pictorial and contain explanation to the diagrams.
Some of these models are discussed in the following subsections.
As opposed to flow charts, there are parallel activities in this diagram which are further
elaborated by specifying their major activities. The process described in this diagram is as
follows
• A patient may come to visit In Patient Department (IPD) or output patient
department (OPD)
• System determines if he is a company patient or a private patient.
• For a company patient, system verifies him.
• For an OPD patient, system will issue a chit to the patient and inform him about
his number and the consultant to whom he has to consult and he will have to wait
for his turn.
• After verifying an IPD patient, system will create a visit and allocate him a room
or a bed etc. If system cannot allocate this, then it will inform the patient.
Otherwise the patient is checked in and his information is maintained in the
system.
• System displays information about the expenses of the required service to the
patient so that he is informed of his expected expenditure.
• Some advance payment is also received against the required service and this
amount is adjusted in the final settlement.
• All this information is supplied to cash office that eventually deals with payments,
etc.
• Upon receiving the cash, for OPD patient, a chit will be issued. For IPD patient,
an admission form will be filled and this information will be maintained in the
system. A receipt will be issued to the patient.
• For credit transaction, corresponding voucher will be prepared.
• So the model depicts process before the start of the treatment.
• A patient may ask to change his service on event of an unsatisfied response from
the hospital staff or any other reason. System may cancel his record and pay his
amount back.
• Similarly, a doctor may ask a patient to change his status from OPD to IPD.
In a business process diagram, following points are important and should be noted
• It does not describe the automated system
• It only reflects the existing process of the user to help software engineer/analyst in
understanding business domain.
• It may contain information on processes that need not be automated.
State transition diagrams (STDs) are another technique to document domain knowledge.
In many cases, information flows from one place to the other and at each place certain
action is taken on that piece of information before it moves to the next place. A file in an
office is a typical office is example of such system. In this case, different people make
comments and add information to that file and it moves from one table to the other> this
movement is controlled by a pre-defined set of rules which define under what condition
the file moves from place A to place B and so on. We can easily document these set of
rules with the help of state transition diagrams.
Following is an example of a use of STD to document the life cycle of a trouble ticket
(this example has been taken from ITU-X.790 document).
At the time of a trouble, a network may have been inter-working with another network to
provide a service, and the problem or malfunction may be due to the other network.
Therefore it may be necessary to exchange trouble management information between
management systems across interfaces which may be client to service provider or service
provider to service provider interfaces and may represent inter-jurisdictional as well as
intra-jurisdictional boundaries. In addition to exchanging information on trouble that has
already been detected, advance information on service inaccessibility may also need to be
exchanged. Thus, a service provider may need to inform a customer of future service
inaccessibility (because of planned maintenance, for example).
Queued
A trouble report is in a queued state when it has been instantiated but the trouble
resolution process has not yet been initiated. A trouble report which is in the queued state
may be cancelled by the manager. The agent on receiving such a request will attempt to
close the trouble report.
Open/active
The trouble report becomes “open/active” when appropriate actions to resolve the trouble
are initiated.
An “open/active” trouble report may be “referred” to another Hand-off Person, or
“transferred” to another Responsible Person for further processing. The state however
remains unchanged as “open/active”. A trouble report in the open/active state may be
cancelled by the manager. The agent on receiving such a request will attempt to close the
trouble report.
Deferred
This state indicates that corrective action to resolve the trouble has been postponed. This
can occur when the faulty resource is inaccessible for a period and repair activity cannot
proceed. A deferred Telecommunications Trouble Report may become “open/active”
again, or move directly to the “closed” state if it is cancelled for some reason. A trouble
report in the deferred state may be cancelled by the manager. The agent on receiving such
a request will attempt to close the trouble report.
Cleared
A trouble report is moved by the agent to the “cleared” state when it determines that the
trouble has been resolved. If the manager needs to verify that the trouble has been
resolved, verification may optionally be awaited by the agent prior to closure of the
trouble report.
Closed
This state indicates that the trouble resolution process is complete. Upon closure, the
trouble report attributes are captured in a historical event generated at trouble report
closure which may then be stored in a log of trouble history records, for future reference.
The trouble report may then be eliminated at the agent’s convenience. However, the
agent may be required to maintain such records for a period of time as per business
agreements.
Disabled
A “disabled” value is exhibited when a trouble report’s information cannot be updated
due to local conditions. In the “disabled” condition only read operations can be
performed.
The following figure shows the STD for a trouble ticket. This diagram depicts the
movement of a trouble ticket from one state to the other, thus making it easy to
understand.
Cancel
Open/Active
Release Re-open
Defer Clear
Cancel Close
Closed
Delete
(Explicit or Scheduled)
External Inputs
An external input (EI) is an elementary process that processes data or control information
that comes from outside the application boundary. The primary intent of an EI is to
maintain one or more ILFs and/or to alter the behavior of the system.
External Outputs
An external output (EO) is an elementary process that sends data or control information
outside the application boundary. The primary intent of an external output is to present
information to a user through processing logic other than, or in addition to, the retrieval
of data or control information. The processing logic must contain at least one
mathematical formula or calculation, or create derived data. An external output may also
maintain one or more ILFs and/or alter the behavior of the system.
External Inquiry
An external inquiry (EQ) is an elementary process that sends data or control information
outside the application boundary. The primary intent of an external inquiry is to present
information to a user through the retrieval of data or control information from an ILF or
EIF. The processing logic contains no mathematical formulas or calculations, and creates
no derived data. No ILF is maintained during the processing, nor is the behavior of the
system altered.
It is difficult to understand these definitions and one has to read them a number of times
to understand what is the difference between EI, EO, and EQ and in which case a
function would be classified as EI, EO, or EQ.
This table simply says that a function can alter the behaviour of the system, it can
maintain one or more ILFs, and/or it can present information to the user. The next step is
to determine whether it is EI, EO, or EQ. For that we have to determine what is the
primary intent (PI) of the function and in addition to this primary intent, what else does it
do. Identification of EQ is simple - in this case the only thing a function does is present
information to the user, which is also it’s primary intent. If it alters the behaviour of the
system or maintains and ILF then it can either be an EI or and EO but not an EQ. On the
other hand if the primary intent of the function is to present information to the user but at
the same time it also performs any of the first two operations, it is an EO. Finally, if the
primary intent of the function is either to alter the behaviour of the system of maintain
one or more ILFs, then it is an EI.
Hence by putting and organizing the information in the form of a table, we have not only
made it simple to understand the definition but also given an holistic picture which was
not easily visible otherwise.
Let us look at another example. This time the information is taken from the Income Tax
Ordinance of Pakistan 2001. Consider the following statement that describes the income
tax rates applicable to people with different brackets:
If the taxable income is less than Rs. 60,000, there will be no income tax. If the income
exceeds Rs. 60,000 but is less than Rs. 150,000 then income tax will be charged at the
rate of 7.5% for income exceeding Rs. 60,000. If the income exceeds Rs. 150,000 but
does not exceed Rs. 300,000 then the income tax will be computed at 12.5% of the
amount exceeding Rs. 150,000 plus Rs. 6,750. If the income exceeds Rs. 300,000 but
does not exceed Rs. 400,000 then the income tax will be computed at 20% of the amount
exceeding Rs. 300,000 plus Rs. 25,500. If the income exceeds Rs. 400,000 by does not
exceed Rs. 700,000 then the income tax will be computed at 25% of the amount
exceeding Rs. 400,000 plus Rs. 45,500. If the income exceeds Rs. 700,000 then the
income tax will be computed at 35% of the amount exceeding Rs. 700,000 plus Rs.
120,500.
The same information can be organized in the form of a table, making it more readable
and easier to use.
Income Tax
Less than Rs. 60,000 0%
Between Rs. 60,000 and Rs. 7.5% of (Income - 60,000)
150,000
Between Rs. 150,000 and Rs. 12.5% of (Income - 150,000) +
300,000 6,750
Between Rs. 300,000 and Rs. 20% of (Income - 300,000) +
400,000 25,500
Between Rs. 400,000 and Rs. 25% of (Income - 400,000) +
700,000 45,500
Greater than Rs. 700,000 35% of (Income - 700,000) +
120,500
Once the information has been organized in the tabular form, in many cases it can be
simply stored and mapped onto an array or a database table and the programming of this
kind of a rule is simply reduced to a table or dictionary lookup. This reduces the
complexity of the domain and hence reduces the over all effort for designing, coding,
testing, and maintaining the system.
The Notation
There are several notations of the data flow diagrams. In the following, four different
shapes are explained.
Process
• What are different processes or work to be done in the system.
• Transforms of data.
Process
External Agent
External systems which are outside the boundary of this system. These are represented
using the squares
External
Agent
Data Store
• Where data is being stored for later retrieval.
• Provides input to the process
• Outputs of the processes may be going into these data stores.
Data Store
Data Flow
• Where the data is flowing.
• Represents the movement of the data in a data flow diagram.
Other
Reconcile Deposit income
Account funds into an
Monthly Acct Sources
Balance Account
stmt
Bank
Accounts
Account Employer
Transactions
Withdraw Pay
funds from an a
Account Bill
Bank
Creditor
Processes
1. Reconcile account balance
2. Deposit funds into an account
3. Pay a bill
4. Withdraw funds from an account
External agents
1. Bank
2. Creditor
3. Employer
4. Other income sources
Data stores
1. Monthly Account statement
2. Bank accounts
3. Account transactions
Description:
First we shall discuss ‘withdraw funds from an account’ process. In this process,
information about the accounts and account transactions is retrieved (from the data
stores) and bank releases the funds. After this, it sends this information to ‘reconcile
account balance’ process which prepares a monthly account statement. In this statement,
information regarding bank accounts and account transactions are described. Next is the
‘pay a bill’ process through which a creditor pays his dues and the corresponding
accounts are updated against the cash transaction. A receipt is issued back to the creditor.
The fourth process is ‘deposits funds in an account’ in which an employer deposits
salaries of his employees and the salary information is deposited in the corresponding
bank accounts of the employees. Similarly, income received through other income
sources is also received and deposited in the corresponding bank accounts.
Typical Processes
Now we shall discuss processes which are typically modeled using data flow diagrams.
These processes transform data in one or the other way but these are found in almost all
the automated systems. Following are the examples
• Processes that take inputs and perform certain computations. For example,
CalculateCommission is a process that takes a few inputs like transaction amount,
transaction type, etc and calculates the commission on the deal.
• Processes which are involved in some sort of decision-making. For example, in a
point of sales application a process may be invoked that determines the
availability of a product by evaluating existing stocks in the inventory.
• Processes that alter information or apply a filter on data in a database.
For example , an organization is maintaining an issue log of the issues or complaints that their
clients report. Now if they want to see issues which are outstanding for more then a weeks time
then a filter would have to be applied to sort out all the issues with Pending status and whose
initiation date is a week old.
• Processes that sort data and present the results to users. For example, we pass an
array of arbitrary numbers to a QuickSort program and it returns an array that
contains the sorted numbers.
• Processes that trigger some other function/process
For example, monthly billing that a utility company like WAPDA, PTCL generates. This is a
trigger that invokes the billing application every month and it prepares and prints all the consumer
bills.
• Actions performed on the stored data. These are called CRUD operations and
described in the next subsection
CRUD Operations
These are four operations as describes below
• Create: creates data and stores it.
• Read: retrieves the stored data for viewing.
• Update: makes changes in an stored data.
• Delete: deletes an already stored data permanently.
Report
Patient Nurse
Warning
Vital signs Patient
Message
Monitoring
Request for System
Report
Log data
N Patient Log
In order to see detail processes involved in Patient Monitoring System, a level 1 data flow
diagram will have to be made. In the following, we are providing level 1 data flow
diagram which is a refinement of the level-0 data flow diagram.
Central
Warning Message
Nurse
Report Report
G t Log data
Request for Patient Log
Nurse Report
Level 1 data flow diagram is the refinement of the context (0-level) data flow diagram.
All the external entities are the same (Nurse, and Patient), however, the process of
‘Patient Monitoring System’ is further elaborated by the three processes Local
Monitoring, Report Generator, and Central Monitoring. The Local Monitoring process
transforms vital signs that it receives from Patient entity into Patient data and passes this
information to Central Monitoring process. Central Monitoring process retrieves vital
signs bounds and compares Patient data and it may generate Warning message if the
Patient data goes out of normal Vital signs bounds. A nurse may request for a report, in
response the Report Generator process retrieves Log data from Patient Log, generates the
report and displays it back to the nurse.
It should be noted here that this level 1 diagram is a further refinement of level 0 diagram
such that the underlying system is the same but processes which were hidden in level 0
are represented in this diagram.
A further refinement of this model is also possible if we expand any of these three
processes to capture further details. For example, the Local Monitoring process may
further be expanded to capture detailed activities involved in the monitoring process.
Following is level 2 diagram of Central Monitoring process.
In the above level 2 data flow diagram, Patient’s data is sent to the Unpack Signs process
which unpacks it and send Pulse, Temperature, and Blood pressure to the Evaluate
Bounds Violation process. This process retrieves Vital signs bounds information,
compares it with unpacked patient data and sends a violation sign to the Produce Warning
Message process upon an out of bound result of the comparison. The patient data is sent
to Format Patient Data process that generates the formatted patient data to be maintained
against patient profile. In this manner we elaborated the patient monitoring system up to
three levels describing different details at each level. In a similar manner, other two
processes in level 1 DFD could also be expanded in their respective level two diagrams in
order to describe their functionality in more detail.
By going through this example, the reader would have learnt how data flow modeling
technique helps in understanding domain of a system at different levels of abstractions. In
the following sub-section, we shall describe common mistakes that the people do while
preparing data flow diagrams.
Generate an
Employee Bank Statement Employee
Bank stmt
Existing Employee
Accounts Address Membership
Application
Member Create a
Employees Employee
Accounts
Status new member
Account
New Account
status Frozen
Freeze Accounts
Account
Member Receivable
Account Notification
Department
two inputs and produces an output but in order to generate a bank statement, all that is
needed is an account number and the time period for which the statement is required. If
we analyze the inputs given to this process, we can observe that both of these inputs
cannot help in generating the account statement. Therefore, these inputs are irrelevant to
the output being generated by this process.
In the above mentioned example, it is evident that by applying the source and sink
analysis we determined all the missing inputs and outputs to the processes of this
diagram.
In the following subsection, we shall describe actions which are not only mistakes but
illegal too for the data flow diagrams.
B1 B2
There must be an intermediate process which should transform data received from one
external entity and then send the transformed data to the other external entity. As we have
already described that data flow diagrams should be used to depict processes that
transform or process data. Simple data movement from one entity to another should not
be described using data flow diagrams.
A process is
needed to
B1 exchange data B2
between
external agents
B1 Data
Store
Therefore, a process should be inserted between the interacting entities (external agent,
data store) that should store information received from the external agent after processing
it.
A process is
B1 needed to Data
update a Store
data store
B1 Data
Store
A process is
B1 needed to Data
use a data Store
store
Data Data
Store Store
So, the correct method is again to use a data transform/process between the two data
stores. It should retrieve data from one data store and after transforming that data, store it
into another data store.
A process is
needed to
Data Data
Store copy data from Store
onr data store
to another