Tuesday, December 25, 2007
RATIONAL ROSE AS A CASE TOOL
automates parts of the software development process
through the use of the Unified Modeling Language. The
UML is meta-language receiving strong industry support
that specifies a standardized set of graphical notations
and their syntax that is useful in object-oriented analysis
and design (OOAD).
The Rational Software Corporation offers a
Software Engineering Educational Development
(SEED) program that provides copies of various software
packages and training materials, including Rational
Rose, to qualifying educational institutions. Information
about the SEED program may be obtained from
seed@rational.com or from the company web site at
http://www.rational.com. The SEED program can provide
both individual 1-year licenses that can be provided
to both students and faculty to use the Rational Rose
software as well as server licenses so that the software
can be installed in a laboratory environment. In addition
to Rational Rose, many other software tools are also
available under the SEED program such as those for
configuration management or real-time system development.
The SEED program can also make available
training materials for various courses related to OOAD,
UML, and Rational Rose (Sweeney 2000).
Rational Rose has many advantages as a UML
visual modeling tool, but its flexibility may be the most
valuable. This flexibility is achieved by the software’s
ability to support many object-oriented languages including
Java, MFC C++, Visual Basic, as well as Oracle
8i databases. Rational Rose promotes software component
reuse and better utilizes scarce software development
resources. Rational Rose supports both forward
and reverse engineering. Support for forward engineering
means that Rational Rose can generate code based
on a visual model of the application, whereas reverse
engineering support allows Rational Rose to convert
existing code into a visual model. The combination of
forward and reverse engineering is often referred to as
round-trip engineering.
Successful OOAD processes are often described
as having the characteristics of being both “iterative”
and “incremental” (Fowler 2000; Reed 2000; Liberty
1998). In the context of OOAD, iterative means
that the development proceeds piecemeal toward completion,
in such a way that as Fowler notes, “each iteration
builds production-quality software, tested and integrated,
that satisfies a subset of the requirements of the
project (Fowler 2000)”. Each iteration builds incrementally
on previous iterations during the construction phase
of the project. Rational Rose supports this iterative/
incremental development approach in part through
its round-trip engineering capabilities and by virtue of
its ability to be used in a team development environment.
CRC and Sequence Diagram
Check out this link to get a better understanding of CRC and sequence diagram
http://www.cs.toronto.edu/~jm/340S/02/PDF2/SequenceD.pdf
Example for Sequence Diagram
Check out this link to get an idea about Sequence diagram..
http://en.wikipedia.org/wiki/Sequence_diagram
The software to be designed will control a simulated automated teller machine (ATM) having a magnetic stripe reader for reading an ATM card, a customer console (keyboard and display) for interaction with the customer, a slot for depositing envelopes, a dispenser for cash , a printer for printing customer receipts, and a key-operated switch to allow an operator to start or stop the machine. The ATM will communicate with the bank's computer over an appropriate communication link.
The ATM will service one customer at a time. A customer will be required to insert an ATM card and enter a personal identification number (PIN) - both of which will be sent to the bank for validation as part of each transaction. The customer will then be able to perform one or more transactions. The card will be retained in the machine until the customer indicates that he/she desires no further transactions, at which point it will be returned
The ATM must be able to provide the following services to the customer:
A customer must be able to make a cash withdrawal from any suitable account linked to the card. Approval must be obtained from the bank before cash is dispensed.
A customer must be able to make a deposit to any account linked to the card, consisting of cash and/or checks in an envelope. The customer will enter the amount of the deposit into the ATM, subject to manual verification when the envelope is removed from the machine by an operator. Approval must be obtained from the bank before physically accepting the envelope.
A customer must be able to make a transfer of money between any two accounts linked to the card.
A customer must be able to make a balance inquiry of any account linked to the card.
A customer must be able to abort a transaction in progress by pressing the Cancel key instead of responding to a request from the machine.
The ATM will communicate each transaction to the bank and obtain verification that it was allowed by the bank. Ordinarily, a transaction will be considered complete by the bank once it has been approved. In the case of a deposit, a second message will be sent to the bank indicating that the customer has deposited the envelope. (If the customer fails to deposit the envelope within the timeout period, or presses cancel instead, no second message will be sent to the bank and the deposit will not be credited to the customer.)
If the bank determines that the customer's PIN is invalid, the customer will be required to re-enter the PIN before a transaction can proceed. If the customer is unable to successfully enter the PIN after three tries, the card will be permanently retained by the machine, and the customer will have to contact the bank to get it back.
If a transaction fails for any reason other than an invalid PIN, the ATM will display an explanation of the problem, and will then ask the customer whether he/she wants to do another transaction.
The ATM will provide the customer with a printed receipt for each successful transaction, showing the date, time, machine location, type of transaction, account(s), amount, and ending and available balance(s) of the affected account ("to" account for transfers).
The ATM will have a key-operated switch that will allow an operator to start and stop the servicing of customers. After turning the switch to the "on" position, the operator will be required to verify and enter the total cash on hand. The machine can only be turned off when it is not servicing a customer. When the switch is moved to the "off" position, the machine will shut down, so that the operator may remove deposit envelopes and reload the machine with cash, blank receipts, etc.
The ATM will also maintain an internal log of transactions to facilitate resolving ambiguities arising from a hardware failure in the middle of a transaction. Entries will be made in the log when the ATM is started up and shut down, for each message sent to the Bank (along with the response back, if one is expected), for the dispensing of cash, and for the receiving of an envelope. Log entries may contain card numbers and dollar amounts, but for security will never contain a PIN.
Use Cases for Example ATM System

System Shutdown Use Case
The system is shut down when the operator makes sure that no customer is using the machine, and then turns the operator switch to the "off" position. The connection to the bank will be shut down. Then the operator is free to remove deposited envelopes, replenish cash and paper, etc.
Session Use Case
The customer may abort the session by pressing the Cancel key when entering a PIN or choosing a transaction type.
Transaction Use Case
Note: Transaction is an abstract generalization. Each specific concrete type of transaction implements certain operations in the appropriate way. The flow of events given here describes the behavior common to all types of transaction. The flows of events for the individual types of transaction (withdrawal, deposit, transfer, inquiry) give the features that are specific to that type of transaction.
A transaction use case is started within a session when the customer chooses a transaction type from a menu of options. The customer will be asked to furnish appropriate details (e.g. account(s) involved, amount). The transaction will then be sent to the bank, along with information from the customer's card and the PIN the customer entered.
If the bank approves the transaction, any steps needed to complete the transaction (e.g. dispensing cash or accepting an envelope) will be performed, and then a receipt will be printed. Then the customer will be asked whether he/she wishes to do another transaction.
If the bank reports that the customer's PIN is invalid, the Invalid PIN extension will be performed and then an attempt will be made to continue the transaction. If the customer's card is retained due to too many invalid PINs, the transaction will be aborted, and the customer will not be offered the option of doing another.
The customer may cancel a transaction by pressing the Cancel key as described for each individual type of transaction below.
All messages to the bank and responses back are recorded in the ATM's log.
Withdrawal Transaction Use Case
A withdrawal transaction can be cancelled by the customer pressing the Cancel key any time prior to choosing the dollar amount.
Deposit Transaction Use Case
A deposit transaction asks the customer to choose a type of account to deposit to (e.g. checking) from a menu of possible accounts, and to type in a dollar amount on the keyboard. The transaction is initially sent to the bank to verify that the ATM can accept a deposit from this customer to this acount. If the transaction is approved, the machine accepts an envelope from the customer containing cash and/or checks before it issues a receipt. Once the envelope has been received, a second message is sent to the bank, to confirm that the bank can credit the customer's account - contingent on manual verification of the deposit envelope contents by an operator later. (The receipt of an envelope is also recorded in the ATM's log.)
A deposit transaction can be cancelled by the customer pressing the Cancel key any time prior to inserting the envelope containing the deposit. The transaction is automatically cancelled if the customer fails to insert the envelope containing the deposit within a reasonable period of time after being asked to do so.
Transfer Transaction Use Case
A transfer transaction can be cancelled by the customer pressing the Cancel key any time prior to entering a dollar amount.
Inquiry Transaction Use Case
An inquiry transaction asks the customer to choose a type of account to inquire about from a menu of possible accounts. No further action is required once the transaction is approved by the bank before printing the receipt.
An inquiry transaction can be cancelled by the customer pressing the Cancel key any time prior to choosing the account to inquire about.
Invalid PIN Extension
An invalid PIN extension is started from within a transaction when the bank reports that the customer's transaction is disapproved due to an invalid PIN. The customer is required to re-enter the PIN and the original request is sent to the bank again. If the bank now approves the transaction, or disapproves it for some other reason, the original use case is continued; otherwise the process of re-entering the PIN is repeated. Once the PIN is successfully re-entered, it is used for both the current transaction and all subsequent transactions in the session. If the customer fails three times to enter the correct PIN, the card is permanently retained, a screen is displayed informing the customer of this and suggesting he/she contact the bank, and the entire customer session is aborted.
If the customer presses Cancel instead of re-entering a PIN, the original transaction is cancelled.
THE FOLLOWING QUESTIONS BEING ASKED QUITE OFTEN?
Yes, there are differences. OOA is the act of determining the
abstractions which unerly the requirements. It is the backwards
reasoning that starts with the requirements and ends up with a set of
objects that express the abstractions; and messages that support the
required behaviors. OOD embodies the set of decisions that
determines how those objects and methods will be implemented.
Typically class inheritance and composition hierarchies are among
those design decisions.
OOA exposes the components of the required behaviors, in order that
they may be implemented. On the other hand, OOD hides the details
of the implementation so that those details do not pollute the rest of
the design.
Despite the differences, however, OOA and OOD are simply at
opposite ends of the same activity. Moreover, there is no good
dividing line which separates them, either in time or in function. It is
better to view OOA and OOD like the different colors in a spectrum.
They are certainly different, but it is difficult to tell when one starts
and the other leaves off. OOAD is a continuum of activity which
incorporates both analysis and design.
• Should we do OOA first, followed by OOD?
No, they are best done concurrently. Analysis and Design should not
be separated into broad phases. Nor should the analysis model be
frozen before the design modeling begins. It should be evident from
our case study that OOA and OOD are very closely related, and that
they cooperate synergistically. The analysis model cannot be
completed in the absence of the design model. And the design model
cannot be completed in the absence of the analysis model. One of the
most important aspects of OOAD is the synergy between the two
concepts.
• What is a reasonable output from OOA, OOD?
At very least a set of class and object diagrams. The class diagrams
show the static structure of the application. It is from these diagrams
that class headers can be written. Object diagrams show the
dynamics of the collaborations between objects. It is from these
diagrams that the class implementations will be written.
However, in large projects these meager beginnings are hardly
adequate. There is much that we have not covered in this simple case
study. We have not discussed how to organize the analysis and
design of a large program. How to control large scale visibility.
How to control the physical model so that a large project can be
developed and released in an organized and well managed way.
These topics are important parts of the OOAD universe, and should
not be neglected.
• Are there different notations for OOA and OOD?
Yes and No. OOA, since it is based on the analysis of required
behaviors, tends to focus on the behavioral model. Thus tit places
more emphasis on the generation of object diagrams. We saw this in
the case study. In every case, the central abstraction for each
requirement was documented, first, by an Object Diagram.
Conversely, since OOD focuses on finding static structures which
support the required dynamics, it tends to focus on class diagrams.
However, there are certainly plenty of cases where class diagrams are
produced by OOA activities and object diagrams are produced by
OOD activities.
One of the great advantages of OOAD over other analysis and design
techniques is that the notation for analysis is compatible with the
notation for design. In fact, only one set of documents is maintained.
We do not separate them into “analysis documents” and “design
documents".
Saturday, December 22, 2007
OO Technology and Reuse
The most common kind of reuse is through libraries. The user of the library is presented with a black box and a description of its interface. One is supposed to be able to use the API (application programmers interface) without a deep understanding of the implementation details of the library. The various widget components in the foundation classes for a windowing system are examples of this kind of low level fine-grained reuse.
Another form of reuse concerns low level architectural details, that is at the level of algorithms and data structures. All of us are familiar with the generic description of an algorithm, like quick sort, which we then code in language chosen for the application. We all know about binary trees, and we do not have to re-invent them for every application. Design patterns are also an example of this level of reuse. There is still substantial scope for inventiveness in new patterns, or in adapting and combining existing patterns.
Software components are self-contained modules that can be connected together using some protocol, such as CORBA or DCOM. They are more than just an implementation, since the also reflect a design philosophy. Arbitrary components can be connected only if they share the same connection, communication, and control architecture.
The highest form of reuse occurs at the sweeping architecture level composed of many pieces plus a philosophy. Here we try to reuse good designs. This is potentially the most profitable kind of reuse because good designs are costly to develop. The current technique for high level design reuse is via application frameworks.
An application framework provides a generic design within a given domain, and a reusable implementation of that design. An object-oriented application framework presents its generic design and reusable implementation of a system through a set of classes and their collaborations. Applications are built from frameworks by extending or customizing parts of the framework, while retaining the original design. Frameworks solve larger grained problems then individual components, and this makes the effort of finding and reusing them more cost effective than for small components.
The notion of reuse even makes sense in terms of the features of a language. You can evaluate various features in terms of "what does this feature let me reuse in my programs?". For example, parameterizing a function (e.g. qsort) lets you reuse it in many contexts, inheritance lets you reuse the behaviour of your ancestor classes, templates let you reuse design.
We can locate the various kinds of reuse on a reuse plane, which reflects what is being reused and the granularity of the reuse. OO technologies start to pay off at medium to high levels of reuse --- which is exactly the granularity at which iterative and incremental development occurs.
About Patterns
Patterns :
A design pattern describes a problem and the design of a generic solution for that problem. A pattern doesn't provide an implementation. Patterns are typically at a higher level of reuse than templates. Design patterns in software were influenced by the building and urban planning architectural patterns of Christopher Alexander
An actual instance of a pattern will take into account specific concerns. Often the system architecture combines patterns, so that a collaborating set of classes may actual embody two or more patterns.
Originally, patterns addressed common idioms in the world of OO design and implementation. Patterns have begun to be used in other areas, in particular analysis patterns are being used to describe common idioms at the business analysis level.
Patterns are described with a template that typically looks likes this:
Name and Classification - choose a good name as it will enter the vocabulary
Intent - short statement about what it does, its rationale, and intent, and the issue it addresses.
Also Known As - other well-known names, if any.
Motivation - a concrete example that illustrates a problem and how the pattern solves the problem.
Applicability - where can it be applied and how do you recognize when it can be applied.
Structure - graphical OO model of the pattern.
Participants - participating classes or objects and their roles and responsibilities.
Collaborations - how they collaborate to carry out responsibilities.
Issues and Consequences - what are trade-offs associated with the pattern, what dependencies does it create.
Implementation - hints, pitfalls, and techniques.
Sample Code - clarifying examples of language dependent issues.
Known Uses - evidence of pattern use from real systems.
Related Patterns - similar patterns and their differences, other patterns that work with this one.