Вы находитесь на странице: 1из 55

Requirement Engineering

Requirement engineering
• It help software engineers to better understand
the problem to solve
• It is composed of the tasks that lead to an
understanding of what the business impact of
the software will be ($ consideration), what the
customer wants (including function, data, and
behavior), and how end users will interact with
the software (the interface part mentioned
before)
Requirement engineering
• To ensure doing right things instead of doing
things right
• For a complicated system, requirements may
be ambiguous, incomplete, or even conflict.
Requirement engineering solves the problems.
Requirement engineering tasks:
Inception (開端)
• Most projects begin when a business need is
identified, or a potential new market or service
is discovered
• Software engineers ask questions to establish a
basic understanding of the problem, the people
who want a solution, the nature of the solution
that is desired, and so on (中文曰:知己知彼,百
戰百勝).
Requirement engineering tasks:
Elicitation (引出)
• Obtain requirements from related
stakeholders, including:
– requirements (including those of hardware
and software)
– problem scope (to avoid fishing)
Requirement engineering tasks:
Elaboration (細緻化)
• Refine the requirements elicited from the
stakeholders
• It develops a refined model of software
functions (or the system to developed),
features, and constraints.
• It facilitate understanding more details of
requirements and correcting possible
requirements errors
Requirement engineering tasks:
Specification (開規格)
• The specification of a software system is
primarily composed of analyzed (or correct)
requirements
• Specification should be represented in a
model. The model can be nature
languages, formal languages, graph
notations, and so on
• Graph notations offers semi-formal
description for specifications
Requirement engineering tasks:
Validation (確認)
• Software engineers and customers
validate the specification they obtained.
• After validation, the specification becomes
a contract between Software engineers
and customers
Example: automating a library system
Library system: Inception
• Initiated problem: Establish an automated
library management system to replace
traditional manual systems
Library system: Inception
The function of the traditional manual work system (partial)
1. Sort and compile books numbers
2. Put books on shelves According to their numbers
3. Create an index card for retrieval
4. Provide pen and note paper
5. Access control
6. Processing borrowing books
7. Processing the return
8. Destroy the overdue return
9. Processing appointment requirements
10. Notify the appointment book that the book has been returned to the
library.
11. Processing expired books
Library system: Inception
• Which of the aforementioned functions should be automated? In this
example, the following functions are assumed to be automated (some
functions will change when they are automated)
1. Sort and write the book number -> Write the book number (assuming the
classification is still manual)
2. Create an index card for searching -> Provide search function
3. Processing borrowing books
4. Processing the return
5. Destroying the overdue return -> Making a default record and overdue list
6. Processing appointment requirements
7. Notify the appointment book that the book has been returned to the museum
-> Make a list of the book that has been returned to the library
8. Processing expired books
Library system: Elicitation
• Once you've determined which features to
automate, you can start collecting requirements
• The sources of demand are (they are all
stakeholders): library owners, librarians, library
users, and engineers who have developed
library systems. Alternatively, you can refer to
existing systems. All of the above should assist
in gathering requirements.
Library system: Elicitation
• After preliminary collection of requirements, the system should have the following
functions:
1. According to the classification of the book and the current collection status, the book
number is compiled.
2. Find the book that meets the requirements according to the user's query conditions.
3. When the user requests to borrow a book, check whether the user has the right to borrow
the book. If so, lend the book to the user and log in the borrowing information.
4. When the user returns the book, the user's borrowing record is cleared.
5. Regularly check borrowing records and make default records and overdue lists
6. When you have a user reservation, you can log in to the appointment information.
7. When the book is returned to the library, compare the reservation record to make a list of
the reserved books that have been returned to the library.
8. Regularly clear the records of expired books to be discarded and reflect on the collection
status
Library system: Elaboration
• The aforementioned requirements are too
vague, so they need to be described in
more detail. The following slides show the
results of the aforementioned
requirements after elaboration.
Library system: Elaboration
1. According to the classification of the book and the
current collection status, the book number is compiled.
The result of Elaboration:

Go to the book classification table to find the English letters


at the beginning of the call number (such as TK, TQ,
etc.). Determine the book number to be classified
according to the current status of the collection, and the
number is the current maximum number plus one.
Library system: Elaboration
2. Find the book that meets the requirements according to
the user's query conditions.
The result of Elaboration:

The user can make a query based on the title of the book,
the name of the author, or the title of the book. The book
should be printed out according to the year when the
query is completed, and the new year is placed in front.
Library system: Elaboration
3. When the user requests to borrow a book, check whether the user
has the right to borrow the book. If so, lend the book to the user and
log in the borrowing information.
The result of Elaboration:

When the user requests to borrow a book, check whether the user has
been suspended, default (ie, whether there is a default record
relative to the user), or the borrowing has reached the upper limit,
etc. If there is, the loan is refused. Otherwise That is, the book is
given to the user. After that, the book borrowing record of the book
is made, indicating who borrowed the book and when it expires. At
the same time, the book has been loaned and the total amount of
the user's borrowed book is increased by one.
Library system: Elaboration
4. When the user returns the book, the user's borrowing
record is cleared.
The result of Elaboration:

When the user also deletes a book, the book is recorded


relative to the book, and the book is returned to the
library and the total amount of the user's borrowed book
is reduced by one. In addition, the function of the
demand seven (see later slide) is activated. 2. Make a
list of reserved books that have been returned to the
museum.
Library system: Elaboration
5. Regularly check borrowing records and make default
records and overdue lists
The result of Elaboration:

Regularly check the borrowing record, check the expiration


date in the record, and if there is an overdue record,
make a record of default to the user in the record,
indicating when he borrowed the book and when it
expires. The book he borrowed was included in the
overdue list for library staff to ask for (by manual
reminder)
Library system: Elaboration
6. When you have a user reservation, you can log in to the appointment
information.
The result of Elaboration:

When the user requests the appointment book, check whether the user
has been suspended or defaulted (ie, whether there is a default
record relative to the user), and if so, refuse to accept the
appointment. Otherwise, make an appointment record, indicating
who to make an appointment to which book. Here we accept the
appointment of the borrower who has reached the limit, because he
may have returned some books before actually borrowing the book.
Library system: Elaboration
7. When the book is returned to the library, compare the reservation
record to make a list of the reserved books that have been returned
to the library.
The result of Elaboration:

When there is a book back to the library (that is, when the user still has
a book), check the reservation record. If the book is reserved,
indicate that the book is currently suspended for lending, and record
the book and the information of the reservation person in the
returned In the list of appointment books, the library staff informs the
reservation to borrow books (by manual notification)
Library system: Elaboration
8. Regularly clear the records of expired books to be
discarded and reflect on the collection status
The result of Elaboration:

When an expired book is discarded, it is indicated on the


record of the book that it has been discarded.
Library system: Elaboration
The contents of the previous slides obviously need to be sorted out,
mainly including data and function. After scrutinizing the above
requirements, we can combine the requirements of four and seven to
form a function, which is described as follows:

When the user also deletes a book, the book is recorded relative to the
book, and the book is returned to the library and the total amount of the
user's borrowed book is reduced by one. In addition, the reservation
record is checked, and if the book is reserved, Indicate that the book is
currently suspended for lending, and record the book and the
information of the subscriber in the list of reserved books that have
been returned to the library for the library staff to inform the reservation
to borrow the book (by manual notification)
Library system: Elaboration
The above merges to get the following functions (note: some text modifications):
1. According to the book classification table and the current collection status, the
book number is compiled.
2. Find the book that meets the requirements according to the user's query
conditions.
3. When the user requests to borrow a book, check whether the user has the right
to borrow the book. If so, lend the book to the user and log in the borrowing
information.
4. When the user returns the book, the book's borrowing record is cleared, and the
reserved record is compared to make a list of the book that has been returned to
the library (combined with the original 4 and 7).
5. Regularly check borrowing records and make default records and overdue lists
6. When you have a user reservation, you can log in to the appointment information.
7. Regularly clear the records of expired books to be discarded and reflect on the
collection status
Library system: Elaboration
• The following data can be obtained by examining the
elaboration results of the aforementioned requirements
(data generally comes from the noun part of the
requirement description):
1. Book record: description title, author name, year, call
number, current status (eg: in the hall, loaned, suspended
lending, discarded, etc.)
2. Book Classification Table: Describe the classification of
books and corresponding English letters
3. Current status of the collection: Describe the
classification that has been numbered so far.
4. User record: Describe the user's name (or ID), the
maximum number of books that can be borrowed, the
Library system: Elaboration
• Data from elaboration results (continued):
6. Default record: Describe what user borrowed the book and when it has
expired
7. Appointment record: Describe the user who booked the book
8. List of appointments that have been returned to the museum: Describe why
the book is reserved by the user
9. Overdue list: Content of the total set of default records
10. Query conditions: Describe how the user can query (eg: title, author name,
or title keyword) and conditional content
11. Query results: Description of the book title, author name, year, call number,
and current status of the book (eg, in the library, loaned, suspended,
abandoned, etc.)
12. Expired books to be discarded: Description of the title and call number of
the expired book to be discarded.
Library system: Specification
• The result of Negotiation is represented by
a model to form the specification, which
will be represented by the UML use case
model.
• In the next slides, we will describe the
concepts and the use of use case model in
UML
Exercise 1
• Capture requirements for your system
UML model for requirements

- Use case model


- Activity diagram
- Etc.
Use case model

• A use case model in UML shows use cases


of a system, which is composed of use
cases, actors, and use case relationships
• A use case is composed of a sequence of
interaction between actors and a system
(think about withdrawing money)
• A use case can be regarded as a system
level function
Use cases

• A use case captures partial function of a


system. Therefore, a system’s use cases
capture the system’s functional
requirements
• Example use cases in a vending machine:
buy a beverage, perform scheduled
maintenance, make repair, load items
Use cases

• Actors interact with a system, which are


outside the system. They represent
everything that needs to exchange
information with the system.
• Example actors in a vending machine:
customer, repair technician, stock clerk
Actors

• Actors vs. users: an actor is a role. A user


may play more than one role (i.e., a user
may be instances of several actors). For
example, a user may be both a customer
and a stock clerk in a vending machine
• Different actors use different use cases. For
example, a customer use the use case “buy
beverage” and a stock clerk uses “load
items”
Use case model

• Use cases are modeled using use case


diagram. The following figure shows the
notations used in a use case diagram
(a)
use case

(b)
actor
Example use case diagram
vending machine

buy
beverage
customer
perform
scheduled
maintenance

repair technician
make
repairs

load
items
stock clerk
Use case relationships

• The “include” relationship among use cases


allows a use case (which likes a subroutine)
to be used by multiple use case
• A use case included by multiple use cases
is actually a chunk of function that is the
same across multiple use cases
Use case relationships

• For example, both the use cases “borrow a


book” and “reserve a book” should check
the book’s status. Therefore, the function
“check book status” can be extracted and
made a use case for the above use cases
to include.
A
<<include>> <<include>>

B C
Use case relationships

• The “extend” relationship among use cases


allows a use case to be extended. For
example, the use case “paper Jam handling”
extends “Photocopying”
A
Photocopying
<<include>> <<include>>

<<extend>>
B C
paper Jam handling
Use case relationships

• The “generalization” relationships show


specific variations on a general use case
• The relationship is similar to inheritance
relationship among classes
Use case relationships

• For example, the use case “drive a car” is a


generalization of the use cases “drive a
Benz car” and “drive a BMW car”
drive a car

drive a Benz car drive a BMW car


Use case modeling - an example
The car rental system manages the status of cars and
renters. When a renter rents a car, a rental record is created.
A renter may be a member or not. A member can rent a car if
he/she has no bad record. A non-member should apply for
becoming a member or mortgage something valuable before
he/she rents a car. Old cars can be removed and new cars
can be added.
When a rented car is returned, the car should be checked.
If the car is damaged, the renter should compensate for that.
The manager of the system should periodically check car
status. A car with an age more than ten years should be
removed. The manager should also periodically check rental
records. A bad record should be created for a member who
does not return a car in time.
Use cased identified
• Use cases identified in the above example:
– rent a car
– return a car
– check car status
– check rental record
– damage compensation
– add a member
– remove a member
– add a car
– remove a car
Additional use cases

• Two additional use cases can be extracted to


be included by multiple use cases. They are
“check existence of a car” and “check existence
of a member”. The former is included by the
use case “remove a car” and “add a car” and
the latter is included by “add a member” and
“remove a member”
• The use case “damage compensation” extends
“return a car”
Use case diagram for the example
Damage compensation

<<extend>>

Return a car

Check car status


Rent a car
renter

Remove a car Add a car


Check rental record

<<include>> <<include>>
Add a member
Remove a member Manager
Check existence
<<include>> of a car
<<include>>

Check existence
of a member
Activity diagram

• Activity diagrams are useful in describing


workflow with a lot of parallel activity, in
which an activity is some task to do
• Activity diagram describes activities to do,
sequence of activities, parallel execution of
activities, conditions, and so on
• Activity diagrams are especially useful in
describing the flow of a use case
Activity diagram

• Activity diagrams are useful in describing


complicated class methods. They can also
be used to describe the flow of a use case
• The next slide depicts an activity diagram
that describes a use case, in which the
symbol “*” is used to denote multiple
triggers
Activity diagram

• An activity diagram can show the workflow


across use cases
• For example, the use case in the next two
slides can be combined into the slide after
the next two slides (note that the activity
“dispatch order” can be performed only
when the activities directed by the three
income arrows are finished)
Activity diagram

• Activities in an activity diagram can be


decomposed
• For example, the activity “Authorize
Payment” in the previous slide is
decomposed into an activity diagram in the
next slide

Вам также может понравиться