Upload
prabhakar-kumar
View
227
Download
0
Embed Size (px)
Citation preview
8/8/2019 OOSE3 OOSE in Real World and Industry
1/189
1
Object OrientedObject Oriented
Software EngineeringSoftware Engineering# 4
Prof. Dr.Prof. Dr. O.P.VyasO.P.VyasM.TechM.Tech. ( Computer Sc. ) IIT. ( Computer Sc. ) IIT KharagpurKharagpur
Ph.D. (Computer Sc) IITPh.D. (Computer Sc) IIT KharagpurKharagpur
DAAD Fellow (Germany), AOTS Fellow(Japan)DAAD Fellow (Germany), AOTS Fellow(Japan)
Professor & Program Coordinator(SE)Professor & Program Coordinator(SE)Indian Institute of Information Technology, AllahabadIndian Institute of Information Technology, Allahabad
8/8/2019 OOSE3 OOSE in Real World and Industry
2/189
Prof.Dr. O.P.Vyas3.2Data Mining
Significant S/W projects & OSE approachSignificant S/W projects & OSE approach
Data & Knowledge Engineering
Data Base Connectivity approaches
Data Mining & Business Intelligence Projects?
Software Project for Mobile devices
Functional & Non-functional requirements
Feature Phone Vs Smartphone S/W:OSE approach
Service Oriented Architectures
SOA & Cloud computing solutions
Framework Requirements
OOSE Implementations: Which concepts to use?OOSE Implementations: Which concepts to use?
When & How: Inheritance,Polymorphism2
8/8/2019 OOSE3 OOSE in Real World and Industry
3/189
Prof.Dr. O.P.Vyas3.3Data Mining
3
Market Market requiresrequires InnovationInnovation
InnovationInnovation requiresrequires ResearchResearch
&&
Research requiresResearch requires concerted effort concerted effort
8/8/2019 OOSE3 OOSE in Real World and Industry
4/189
Prof.Dr. O.P.Vyas3.4Data Mining
Data & Knowledge Engineering: OSE approachData & Knowledge Engineering: OSE approach
DBMS applications: Two Tier or Three tier approachDBMS applications: Two Tier or Three tier approach
Front-End Vs Back End
Data Base Connectivity
Data & Knowledge Engineering: Data Mining ?Data & Knowledge Engineering: Data Mining ?
Data Mining: Characteristics
DM applications: Functionalities.
Developing Business Intelligence Projects
OOSE Implementations: Which concepts to use?OOSE Implementations: Which concepts to use?
When & How: Inheritance,Polymorphism
4
8/8/2019 OOSE3 OOSE in Real World and Industry
5/189
Prof.Dr. O.P.Vyas3.5Data Mining
5
Data & Knowledge EngineeringData & Knowledge Engineering--Chronological Dev.Chronological Dev.
Evolutionary steps Business queryBusiness query Enabling technologiesEnabling technologies Product vendorsProduct vendors Characteristics
Data Collection(1960s)
What was my totalrevenue in the last
five years
Computers, tapes,disks IBM Retrospective,Retrospective, staticdata delivery
Data Base
(1980s)
What were A.C unit
sales in New England
last March?
Relational
Databases, SQL,
ODBC
Oracle, Sybase, Informix,
IBM,MicrosoftRetrospectiveRetrospective
dynamic data delivery
at record level.
Data Warehousing
& Decision support
systems1990s)
What were A.C.unit
sales in New England
last March?Drill down
to Boston.
OLAP, Multi -
dimensional
databases, DW
Pilot, Comshare,Arbor,Cognos,Microstrategy.
Retrospective,Retrospective,
dynamic data delivery
at multiple levels.
Data Mining
(Emerging )
Whats likely to
happen to Bostons
A.C.unit sales next
month? Why ?
Advanced algorithms,
Machine Learning
approaches, massive
databases.
Pilot, Lockheed, IBM,SGI, Mineset etc.
Prospective,Prospective,
proactiveproactive information
delivery.
8/8/2019 OOSE3 OOSE in Real World and Industry
6/189
Prof.Dr. O.P.Vyas3.6Data Mining
Database ArchitectureDatabase Architecture
The architecture of a database systems is greatly influenced bythe underlying computer system on which the database is
running:
Centralized
Client-server
Parallel (multiple processors and disks)
Distributed
Data Base Application Architecture can be categorized asData Base Application Architecture can be categorized as
TwoTwo--TierTierand Three Tier ArchitectureThree Tier Architecture
8/8/2019 OOSE3 OOSE in Real World and Industry
7/189
Prof.Dr. O.P.Vyas3.7Data Mining
Database Application ArchitecturesDatabase Application Architectures
(web browser)(web browser)
OldOld ModernModern
8/8/2019 OOSE3 OOSE in Real World and Industry
8/189
Prof.Dr. O.P.Vyas3.8Data Mining
8
DBMS Project TeamDBMS Project Team
Data Specialists--> Modeler
--> Architect
Developers
FRONT END(VB, VC++, JAVA)
DBAs
BACK END( Oracle,
SQL-Server, DB-2)
Project Leader
8/8/2019 OOSE3 OOSE in Real World and Industry
9/189
Prof.Dr. O.P.Vyas3.9Data Mining
9
Data Mining & Knowledge DiscoveryData Mining & Knowledge Discovery
8/8/2019 OOSE3 OOSE in Real World and Industry
10/189
Prof.Dr. O.P.Vyas3.10Data Mining
10
Knowledge Discovery in Databases (KDD)Knowledge Discovery in Databases (KDD)
Technology: ProcessTechnology: Process
Adapted from[Fayyad, Piatetsky-Shapiro, and Smyth, 1996]
Data MiningData Mining
KnowledgeKnowledge
DiscoveryDiscovery
8/8/2019 OOSE3 OOSE in Real World and Industry
11/189
Prof.Dr. O.P.Vyas3.11Data Mining
Knowledge Discovery & BI implementationsKnowledge Discovery & BI implementations
8/8/2019 OOSE3 OOSE in Real World and Industry
12/189
Prof.Dr. O.P.Vyas3.12Data Mining
Data MiningAlgorithm
Score model
model
Results Pattern
Data Mining Systemtraining
evaluation
prediction
Historical Training data
New data
Data set
Data Mining Mechanism
8/8/2019 OOSE3 OOSE in Real World and Industry
13/189
Prof.Dr. O.P.Vyas3.13Data Mining
13
Machine Learning ApproachMachine Learning Approach
An unprecedented wealth of data is being generated
The demands and opportunities for interpreting these data are expanding more thanever.
Machine learning is one of the most popular approach to build Theory from the fielddata.
Machine learning approaches are ideally suited for areas in which there is a lot of data
but little theory.
On the theoretical side , a unifying framework for all machine learning methods hasemerged since late 1980s. This is the Bayesian probabilisticBayesian probabilistic framework for modelingand inference
The goal in machine learning is to extract useful information from a body of data bybuilding good probabilistic models and to automate the process as much as possible.
Will traditional OSE Approaches work fine with Machine Learning applications ?
8/8/2019 OOSE3 OOSE in Real World and Industry
14/189
Prof.Dr. O.P.Vyas3.14Data Mining
14
Data MiningData Mining
What kind of data
Biological Spatial Text Multimedia
RDBMS DataWarehouse Special WebData
OOD Time
Series
Legacy
8/8/2019 OOSE3 OOSE in Real World and Industry
15/189
Prof.Dr. O.P.Vyas3.15Data Mining
15
Data Mining
ClusteringClustering
AnalysisAnalysis
AssociationAssociation
MiningMining
A:R:M:Techniques
Applicationdomain
ClassificationClassification
ClassificationTechniques
Asso.Classifiers
Data Mining FunctionalitiesData Mining Functionalities
8/8/2019 OOSE3 OOSE in Real World and Industry
16/189
Prof.Dr. O.P.Vyas3.16Data Mining
Business Intelligence projects & OSEBusiness Intelligence projects & OSE
For Association Rule Mining: MBA
Algorithms for ARMAlgorithms for ARM
For Classification and Predictive Analytics
Learning & PredictingLearning & Predicting
For Clustering Analysis & Outlier Discovery
Descriptive approachDescriptive approach
16
8/8/2019 OOSE3 OOSE in Real World and Industry
17/189
Prof.Dr. O.P.Vyas3.17Data Mining
What is Market Basket Analysis?What is Market Basket Analysis?
Customer AnalysisCustomer Analysis
Market Basket Analysis uses the information about
what a customer purchases to give us insight into
who they are and why they make certain purchases. Product AnalysisProduct Analysis
Market basket Analysis gives us insight into the
merchandise by telling us which products tend to be
purchased together and which are most amenable topurchase.
8/8/2019 OOSE3 OOSE in Real World and Industry
18/189
Prof.Dr. O.P.Vyas3.18Data Mining
Market BasketMarket Basket Analysis S/W ProjectAnalysis S/W Project
Is soda typically purchased with bananas?Does the brand of soda make a difference?
Where should detergents be placed in theStore to maximize their sales?
Are window cleaning products purchasedwhen detergents and orange juice are
bought together?
How are the demographics of theneighborhood affecting what customers
are buying?
?
?
?
?
8/8/2019 OOSE3 OOSE in Real World and Industry
19/189
Prof.Dr. O.P.Vyas3.19Data Mining
Companies using Business IntelligenceCompanies using Business Intelligence
Burger KingBurger King that has restaurants in 11,435 locations in 58 countrieswith annual sales of $11.3 billion is using Business Objects
ofBusiness Intelligence to help them achieveoperational excellence throughout their organization, and maintain
their leadership in a competitive industry
Wal Mart
Wal-Mart is often described as a pioneering leader in data mining &data management S/W applications:
Wal-Mart captures point-of-sale transactions from over 2,900 stores in
six countries and continuously transmits this data to its massive7.5 terabyte data warehouse.Wal-Mart allows more than 3,500 suppliers to access data on their
products and perform data analyses. These suppliers use this data toidentify customer-buying patterns at the store display level.
They use this information to manage local store inventory andidentify new merchandising opportunities.
8/8/2019 OOSE3 OOSE in Real World and Industry
20/189
Prof.Dr. O.P.Vyas3.20Data Mining
DataData MiningMining B.I. ApplicationsB.I. Applications
Master Card
MasterCard International uses data mining to extract statistics about its millions of dailycardholder transactions; furthermore, MasterCard sell this data to its 20,000 business
partners banks and other companies, such as Shell Oil, that offer credit-card
services.
Internet Web Surf-Aid (Web Mining)
IBM Surf-Aid applies data mining algorithms to Web access logs for market-relatedpages to discovercustomer preference and behavior pages, analyzing effectiveness ofWeb marketing, improving Web site organization, etc.
Sports
IBM Advanced Scout analyzed game statistics (shots blocked, assists, and fouls) togain competitive advantage for their Team.their Team.
8/8/2019 OOSE3 OOSE in Real World and Industry
21/189
Prof.Dr. O.P.Vyas3.21Data Mining
Examples of Discovered PatternsExamples of Discovered Patterns
Association rules: find rules between different attributes
86% of Bread-Butter buyers are not Noodles customers but both are buyingTomato ketchup with 95% of customer base.
98% of AOL users also have E-trade accounts
Classification: Classify data based on the values in a classifying attribute
People with age less than 40 and salary > 40k trade on-line
Clustering: Group data to form new classes
Users A and B access similar URLs
Outlier Detection
Person A is showing sudden high increase in his Cholesterol !
User A spends more than twice the average amount of time surfing on theWeb
8/8/2019 OOSE3 OOSE in Real World and Industry
22/189
Prof.Dr. O.P.Vyas3.22Data Mining
Examples of Predictive Analytics ProjectsExamples of Predictive Analytics Projects
Classifying whether the new credit card applicantnew credit card applicant
will be ofHighHigh, MediumMedium orLowLow credit risk.
Will be a perspective buyer of a particular new launch?
For a targeted campaign . Classifying credit card / telephone card transactions
as legitimatelegitimate orfraudulent.fraudulent.
Categorizing news stories as finance,
weather, entertainment, sports, etc
Predicting tumor cells as benignbenign ormalignantmalignant
Classifying secondary structures of protein
as alpha-helix, beta-sheet, or random
coil
8/8/2019 OOSE3 OOSE in Real World and Industry
23/189
Prof.Dr. O.P.Vyas3.23Data Mining
Constructing Classifier for B.I.Constructing Classifier for B.I.
The leading Credit Card Company Visa InternationalVisa International and Computer CompanyAcerAcerInc.Inc. has agreed to market the newly launched Laptop Computer.
For targeted marketing campaign, both the companies would like to use the
existing database of Visa Credit card holders, to find out most likely buyersmost likely buyers of
their Computer.
For a given Database, your job will be to construct a Classifier.Classifier. This Classifier should take an input as the customer-details like
I. Age,
II. Income
III. Student or ProfessionalIV. Credit_Card Ratings
And based on above inputs, the ClassifierClassifierwould PredictPredict, whether the person is
likely buyer of the Laptop Computer or not.
8/8/2019 OOSE3 OOSE in Real World and Industry
24/189
Prof.Dr. O.P.Vyas3.24Data Mining
Significant S/W projects & OSE approachSignificant S/W projects & OSE approach
Data & Knowledge Engineering DBMS & beyond
Data Base Connectivity: existing approaches
Software Projects for Mobile devices Functional & Non-functional requirements
OSE approach !
Service Oriented Architecture Recent Trends in SOA & Cloud Computing
Framework Requirements
24
8/8/2019 OOSE3 OOSE in Real World and Industry
25/189
Prof.Dr. O.P.Vyas3.25Data Mining
S/W project for Mobile DevicesS/W project for Mobile Devices
Applications for Mobile devices J2ME features !
Developing Smartphone Applications
Platform for SmartphonePlatform for Smartphone
Emulators
25
8/8/2019 OOSE3 OOSE in Real World and Industry
26/189
Prof.Dr. O.P.Vyas3.26Data Mining
Motivation & ChallengesMotivation & Challenges MotivationMotivation ::
Interest of user is switching towards new gadgets eg. Cell phones etc..
Today's Web demand dynamic and customizable capability in products.
Available technology:Available technology:
Develop a smooth finished application with look and feel Ex. mashupsolution for Smartphone.
Mashup provides the customizable capabilities to the user.
Challenges:Challenges:
Limited Memory
Low processing speed
No standardization
Small display
8/8/2019 OOSE3 OOSE in Real World and Industry
27/189
Prof.Dr. O.P.Vyas3.27Data Mining
SmartphoneSmartphone Smartphone is a mobile phone that offers more
advanced computing ability and connectivity than a
contemporary basic 'feature phone'. Smartphones and feature phones may be thought
of as handheld computers integrated within a
mobile telephone, but while most feature phones
are able to run applications based on platformsbased on platforms
such assuch as Java MEJava ME orBREW,(Binary Runtime
environment for Wireless)
Java Platform, Micro Edition, or Java ME, is a Java
platform designed for mobile devices and
embedded systems.
From mobile phones (especially feature phones)and set-top boxes. Java ME was formerly known as
Java 2 Platform, Micro Edition (J2ME).
27
8/8/2019 OOSE3 OOSE in Real World and Industry
28/189
Prof.Dr. O.P.Vyas3.28Data Mining
SmartphoneSmartphone
A Smartphone is a mobile phone that offers more advancedcomputing ability and connectivity than a contemporary basic feature
phone.
A smartphone allows the user to install and run more advanced
applications based on a specific platform.
Smartphones run complete operating system software providing a
platform for application developers.
What are the new breed of application paradigm required?
MashupMashup on mobile is very useful for people who use smart phone to
have an edge over other and gain business advantages.
8/8/2019 OOSE3 OOSE in Real World and Industry
29/189
Prof.Dr. O.P.Vyas3.29Data Mining
SmartphoneSmartphone
Smart phones are the future of the wireless industry.
It is an easy device to be used and give all the benefits of a laptop.
All Smartphone hardware and software data (iPhone, Android, Blackberry, HP/Palm
)is compiled at The Smartphone Genome Project
Smartphone popularity has been increased these days because of its portability and
usage.
Its also attracting many developer to use its platform for running many web
application.
Share of 2010 Q1 smartphone sales to end users by O.S.
29
8/8/2019 OOSE3 OOSE in Real World and Industry
30/189
Prof.Dr. O.P.Vyas3.30Data Mining
WidgetsWidgets
In computer programming, a widget (or control) is an element of a graphicalgraphical
user interfaceuser interface (GUI) that displays an information arrangement changeable by
the user, such as a window or a text box.
Widget is short for window gadget.
The defining characteristic of a widget is to provide a single interaction point for
the direct manipulation of a given kind of data. In other words, widgets are basic visual building blocks which, combined in an
application, hold all the data processed by the application and the available
interactions on this data.
30
8/8/2019 OOSE3 OOSE in Real World and Industry
31/189
Prof.Dr. O.P.Vyas3.31Data Mining
WidgetsWidgets
31
8/8/2019 OOSE3 OOSE in Real World and Industry
32/189
Prof.Dr. O.P.Vyas3.32Data Mining
A widget is a small application or piece of dynamic content
that can be easily placed into a web page
Widgets are known as different names by different vendorsdifferent names by different vendors:
gadgets, blocks, flakes
Widgets can be written in any language or and can be simply
HTML .
iWidget is the IBM standardization for widgets.
Widget?
8/8/2019 OOSE3 OOSE in Real World and Industry
33/189
8/8/2019 OOSE3 OOSE in Real World and Industry
34/189
Prof.Dr. O.P.Vyas3.34Data Mining
Application WidgetsApplication Widgets In the context of an application, a widget may be enabled or disabled at a given
point in time.
An enabled widget has the capacity to respond to events, such as keystrokesor mouse actions. A widget that cannot respond to such events is considered
disabled.
The appearance of disabled widget is typically different from an enabled
widget; the disabled widget may be drawn in a lighter color, or may be visually
obscured in some way. See the image to the right for an example. Widgets are sometimes qualified as virtual to distinguish them from their
physical counterparts, e.g. virtual buttons that can be clicked with a mouse
cursor, vs. physical buttons that can be pressed with a finger.
A related (but different) concept is the desktop widget, a small specialized GUI
application that provides some visual information and/or easy access tofrequently used functions such as clocks, calendars, news aggregators,
calculators and desktop notes. These kinds of widgets are hosted by a widget
engine.
34
8/8/2019 OOSE3 OOSE in Real World and Industry
35/189
Prof.Dr. O.P.Vyas3.35Data Mining
Structure of a WidgetStructure of a Widget
Widgets have a name
the name should be unique amongst all widgets.
the name should describe the function of the widget
the name of the widget will not be exposed, unless the widget decides to
do so
Widgets live within their own folder within the same server as Sakai this enables a widget to perform AJAX operations back to the sakai
instance.
Within the widget folder there will be an html page that contains the widget
There will be a css folder, a js folder and optionally an images folder.
During development you will use local copies of javascript and css contained
within the widget development kit
35
8/8/2019 OOSE3 OOSE in Real World and Industry
36/189
Prof.Dr. O.P.Vyas3.36Data Mining
MashupMashup : New breed of Web Applications: New breed of Web Applications
Mash-ups are part of an ongoing shift towards more a more interactive and
participatory Web ( Web 2.0 ) with more user-defined content and services.
In web development, a mashup is a web page or application that uses or
combines data or functionality from two or many more external sources to
create a new service.
Mash-ups are often created by using a development approach calledAjax.Ajax.
Mashup center solution is already running well on desktop environment.
Desktop resource availability gives us freedom to run a heavy process likemashup on it quite easily.
36
8/8/2019 OOSE3 OOSE in Real World and Industry
37/189
Prof.Dr. O.P.Vyas3.37Data Mining
MashupMashup centercenter
37
Create new applications by reusing existing data andservices
Develop widgets from enterprise systems
Discoverand share mashups, widgets, feeds, andservices
Transform information into new feeds
8/8/2019 OOSE3 OOSE in Real World and Industry
38/189
Prof.Dr. O.P.Vyas3.38Data Mining
IBM Mashup CenterIBM Mashup Center
IBM Mashup Center is an end to end mashupplatform
enabling the rapid creation, sharing, anddiscovery of
reusable application building blocks(widgets, feeds, mashups) that can be easilyassembled into new applicationsOr leveraged within existing applications
delivering lower development costs, rapidROI, quick delivery ofdynamic applications,and greater productivity.
8/8/2019 OOSE3 OOSE in Real World and Industry
39/189
Prof.Dr. O.P.Vyas3.39Data Mining
39
Quickly Create and Share New Mashups
The mashup builder supports rapid assembly and sharing of mashup pages and spaces
without coding!
Rendering IBM-Mashup pages on mobile
8/8/2019 OOSE3 OOSE in Real World and Industry
40/189
8/8/2019 OOSE3 OOSE in Real World and Industry
41/189
Prof.Dr. O.P.Vyas3.41Data Mining
Developing projectsDeveloping projects
Business Intelligence solutions would require
Data Mining Algorithms
Pre-processed data for mining
OSE approach for
Project for Mobile devices
Emulators for the proposed work
Developing Widgets
Project on SOA
Using Framework for SOA
41
8/8/2019 OOSE3 OOSE in Real World and Industry
42/189
8/8/2019 OOSE3 OOSE in Real World and Industry
43/189
Prof.Dr. O.P.Vyas3.43Data Mining
43
Many ARM algorithmsMany ARM algorithms
There are a large number of them!! They use different strategies and data structures.
Their resulting sets of rules are all the same.
Given a transaction data set T, and a minimum support and a minimum confident, the
set of association rules existing in T is uniquely determined. Any algorithm should find the same set of rules although their computational
efficiencies and memory requirements may be different. We study only one: the
Apriori Algorithm
8/8/2019 OOSE3 OOSE in Real World and Industry
44/189
Prof.Dr. O.P.Vyas3.44Data Mining
Constructing Classifier for B.I.Constructing Classifier for B.I.
The leading Credit Card Company Visa InternationalVisa International and Computer CompanyAcerAcer
Inc.Inc. has agreed to market the newly launched Laptop Computer.
For targeted marketing campaign, both the companies would like to use the
existing database of Visa Credit card holders, to find out most likely buyersmost likely buyers of
their Computer.
For a given Database, your job will be to construct a Classifier.Classifier.
This Classifier should take an input as the customer-details like
I. Age,
II. Income
III. Student or Professional
IV. Credit_Card Ratings
And based on above inputs, the ClassifierClassifierwould PredictPredict, whether the person is
likely buyer of the Laptop Computer or not.
8/8/2019 OOSE3 OOSE in Real World and Industry
45/189
Prof.Dr. O.P.Vyas3.45Data Mining
45
UCI KDD ArchiveUCI KDD Archivehttp://kdd.ics.uci.eduhttp://kdd.ics.uci.edu
This is an online repository oflarge data sets which
encompasses a wide variety of datatypes, analysis tasks, and
application areas.
The prima
ry role ofthis reposi
tory is
to en
able rese
archers in
knowledge discovery and data mining to scale existing and
future dataanalysis algorithms to very large and complex data
sets.
. The archive is intended to serve as a permanent repository ofpublicly-accessible data sets for research in KDDand data
mining. It complements the original UCI Machine Learning
Archive , which typically focuses on smaller classification-
oriented data sets.
8/8/2019 OOSE3 OOSE in Real World and Industry
46/189
Prof.Dr. O.P.Vyas3.46Data Mining
SOA & F.I.SOA & F.I.
The Internet is a tremendous success story and with it the TCP/IPprotocols suite, which is the core technology of the Internet.
Using the Internet requires to use the TCP/IP protocols. Thus it is
hard to change or even modify these protocols.
Driven by the demands of ever emerging applications and thecapabilities of new communication networks, many workarounds
have been introduced, like sub-layer proliferation (e.g. MPLS at
layer 2.5, Ipsec at layer 3.5, and TLS at layer 4.5), and erosion of
the end-to-end model (middle-boxes, such as firewalls, NATs,
proxies, caches, etc.).
46
8/8/2019 OOSE3 OOSE in Real World and Industry
47/189
8/8/2019 OOSE3 OOSE in Real World and Industry
48/189
Prof.Dr. O.P.Vyas3.48Data Mining
SOASOA
A promising methodology is the service-oriented architecture(SOA) paradigm for organizing and utilizing distributed
capabilities that may be under the control of different ownership
domains .
In order to achieve loose coupling, protocols must not expose any
internal mechanisms.
This requires well defined interfaces, which reflect only the
service, i.e. the visible result, of a protocol.
48
8/8/2019 OOSE3 OOSE in Real World and Industry
49/189
Prof.Dr. O.P.Vyas3.49Data Mining
Layered ProtocolsLayered Protocols
No shared memory for data exchange
Use network to exchange messages
Problems:
What do the bits and bytes mean?
Where does a message start and end?
Has a message been lost?
Is the order of the messages received correct?
Solution: ISO OSI Reference Model
ISO = International Standards Organisation
OSI = Open Systems Interconnection
Models communication in open systems
Better understanding when problems arise
49
8/8/2019 OOSE3 OOSE in Real World and Industry
50/189
Prof.Dr. O.P.Vyas3.50Data Mining
SOASOA
Services are the central design elements of SOA.
The fundamental roles of a service-oriented architecture are the Service
Providers, the Service Consumers and the Service Brokers as shown in figure
1.
50
8/8/2019 OOSE3 OOSE in Real World and Industry
51/189
Prof.Dr. O.P.Vyas3.51Data Mining
SoASoA
Project develoment RequirementsSOA needs technical support
Technical University of Kaiserslautern (Germany)
Framework for the SOA
Network Functionality
51
8/8/2019 OOSE3 OOSE in Real World and Industry
52/189
Prof.Dr. O.P.Vyas3.52Data Mining
BB FrameworkBB Framework
52
8/8/2019 OOSE3 OOSE in Real World and Industry
53/189
Prof.Dr. O.P.Vyas3.53Data Mining
OOSE : Modeling & DesignOOSE : Modeling & Design
UML Diagrams provide the static and dynamic model of the system.
RoleRole andand LimitationsLimitations of UML !
A Class diagramClass diagram gives an overview of a system by showing its classes and the
relationships among them.
Class diagrams are staticstatic -- they display what interacts but notwhat interacts but not what happens
when they do interact.when they do interact. The classes represent entities with common features, i.e. attributes and
operations.
It is needful to decide
when to use Inheritance ,
When to use Association and
when the composition or Aggregation makes sense in
performance enhancements.53
8/8/2019 OOSE3 OOSE in Real World and Industry
54/189
Prof.Dr. O.P.Vyas3.54Data Mining
UML with Rational RoseUML with Rational Rose
UML is a few different thingsfew different things toto different peopledifferent people. This comes bothfrom its own history and from the different views that people have
about what makes an effective software engineering process.software engineering process.
Rational Rose not only provides UML implementations but also
works as complete CASE tool. But still designing a good OOS project remains an issue involving
many parameters.
9/21/2010 54
8/8/2019 OOSE3 OOSE in Real World and Industry
55/189
Prof.Dr. O.P.Vyas3.55Data Mining
UMLUML
A characterization ofthe three modes in which people use the UML:
1) sketch,
2) blueprint, and
3) programming language.
By far the most common of the three, is UML as sketch.
In this usage, developers use the UML to help communicate some aspects of
a system.
We can use sketches in a forward-engineering or reverse-engineering
direction. Forward engineering draws a UML diagram before you write code, while
reverse engineering builds a UML diagram from existing code in order to help
understand it.
9/21/2010 55
8/8/2019 OOSE3 OOSE in Real World and Industry
56/189
8/8/2019 OOSE3 OOSE in Real World and Industry
57/189
Prof.Dr. O.P.Vyas3.57Data Mining
UML as BlueprintUML as Blueprint
In contrast, UML as blueprint is about completeness !
In forward engineering, the idea is that blueprints are developed by a designer
whose job is to build a detailed design for a programmer to code up.
That design should be sufficiently complete in that all design decisions are laid
out, and the programmer should be able to follow it as aprogrammer should be able to follow it as a pretty straightforwardpretty straightforwardactivity that requires little thought.
The designer may be the same person as the programmer, but usually the
designer is a more senior developerwho designs for a team of programmers.
9/21/2010 57
8/8/2019 OOSE3 OOSE in Real World and Industry
58/189
Prof.Dr. O.P.Vyas3.58Data Mining
Software ArchitectureSoftware Architecture
SoftwareSoftware ArchitectureArchitecture defines the components of asystem, shows how they are packaged, and howhow
theythey interactinteract with one another.
The overall structure of the software and the ways in which thatThe overall structure of the software and the ways in which that
structure is,structure is, provides conceptual integrity for a systemprovides conceptual integrity for a system..
Shaw et al., Software Architecture
9/21/2010 58
8/8/2019 OOSE3 OOSE in Real World and Industry
59/189
Prof.Dr. O.P.Vyas3.59Data Mining
Software Design TermsSoftware Design Terms
architecture the overall structure of the software
patterns conveys the essence of a proven design solution
abstraction data, procedure, control
refinement elaboration of detail for all abstractions
refactoring improve design without effecting behavior information hiding controlled interfaces
modularity compartmentalization of data and function
functional independence high cohesion and low coupling
9/21/2010 59
8/8/2019 OOSE3 OOSE in Real World and Industry
60/189
Prof.Dr. O.P.Vyas3.60Data Mining
OOM design: User tipsOOM design: User tips
Hierarchy and factoring guidelines. A base class should not have too many
subclasses. If too many subclasses are derived from a single base class, thenit becomes difficult to understand the design. In fact, there should
approximately be no more than 7 2 classes derived from a base class at any
level.
Keeping message protocols simple. Complex message protocols are an
indication of excessive coupling among objects. If a message requires morethan 3 parameters, then it is an indication of bad design.
Number of Methods. Objects with a large number of methods are likely to be
more application-specific and also difficult to comprehend limiting the
possibility of their reuse. Therefore, objects should not have too many methods.
This is a measure of the complexity of a class. It is likely that the classeshaving more than about seven methods would have problems.
9/21/2010 60
8/8/2019 OOSE3 OOSE in Real World and Industry
61/189
Prof.Dr. O.P.Vyas3.61Data Mining
OOSE design tipsOOSE design tips
Depth of the inheritance tree. The deeper a class is in the class inheritance
hierarchy, the greater is the number of methods it is likely to inherit, making itmore complex. Therefore, the height of the inheritance tree should not be very
large.
Response for a class. This is a measure of the maximum number of methods
that an instance of this class would call. If the same method is called more than
once, then it is counted only once. A class which calls more than about sevencalls more than about sevendifferent methodsdifferent methods is susceptible to errors.
Number of messages per use case. If methods of a large number of objects are
invoked in a chain action in response to a single message, testing and
debugging of the objects becomes complicated. Therefore, a single messagesingle message
should not result in excessive message generationshould not result in excessive message generation and transmission in asystem.
9/21/2010 61
8/8/2019 OOSE3 OOSE in Real World and Industry
62/189
Prof.Dr. O.P.Vyas3.62Data Mining
Creating Quality Classes : Difficulties & RisksCreating Quality Classes : Difficulties & Risks
Modeling is particularly difficult skill Even excellent programmers have difficulty thinking at the
appropriate level of abstraction
Education traditionally focus more on programming than
modeling
Resolution:
Ensure that team members give adequate time on
MODELING
Discuss & Review all models thoroughly
Have experienced modeler as part of the team
9/21/2010 62
8/8/2019 OOSE3 OOSE in Real World and Industry
63/189
Prof.Dr. O.P.Vyas3.63Data Mining
OOM Design: Creating Quality ClassesOOM Design: Creating Quality Classes
Creating Classes based on the analysis of Use-Case diagrams
will be significant step towards successful project design.
Creating Class diagram requires thinking at appropriate level of
abstraction ! Assigning appropriate responsibility to each Class requires
analytical thinking.
The Quality of Classes should be kept high from the Design
perspective. Functional IndependenceFunctional Independence
9/21/2010 63
8/8/2019 OOSE3 OOSE in Real World and Industry
64/189
8/8/2019 OOSE3 OOSE in Real World and Industry
65/189
Prof.Dr. O.P.Vyas3.65Data Mining
OOM : design metricsOOM : design metrics
Main objectives :- to build highly cohesive classes
- to maintain loose coupling between those classes.
High-cohesion results in well-structured classes.
Loose coupling means more flexible, extensible software.
Applying this to the design and code helps determine whether
project goals have been achieved.
8/8/2019 OOSE3 OOSE in Real World and Industry
66/189
Prof.Dr. O.P.Vyas3.66Data Mining
CohesionCohesion
Classes contain certain data and exhibit certainbehavior.
Cohesive means that a certain class
performs a set ofclosely related actions.
A lack of cohesion means that a class is performingseveral unrelated tasks.
Lack of cohesion may never have an impact on theoverall functionality of a particular classor of theapplication itself
However, the application software will eventuallybecome unmanageable.
8/8/2019 OOSE3 OOSE in Real World and Industry
67/189
Prof.Dr. O.P.Vyas3.67Data Mining
Class Responsibility CollaborationClass Responsibility Collaboration
CRC cards are a brainstorming tool used in the design of object-oriented
software:
They are typically used when first determining which classes are needed and
how they will interact.
CRC cards are usually created from index cards on which are written:
The class name Its Superand Sub classes (if applicable)
The responsibilities of the class.
The names of other classes with which the class will collaborate to fulfill its
responsibilities.
Author
9/21/2010 67
8/8/2019 OOSE3 OOSE in Real World and Industry
68/189
Prof.Dr. O.P.Vyas3.68Data Mining
Lethbridge/Laganire
2005
Chapter5: Modelling
with classes68
AllocatingAllocating responsibilitiesresponsibilities toto classesclasses
A responsibility is something that the system is required to do.
Each functional requirement must be attributed to one of the classes;
All the responsibilities of a given class should be clearly related.
If a class has too many responsibilities, considersplitting it into distinctclasses
If a class has no responsibilities attached to it, then it is probablyuseless
When a responsibility cannot be attributed to any of the existingclasses, then a new class should be created
To determine responsibilities
Perform use case analysis Look forverbsverbs and nounsnouns describing actionsactions in the system description
8/8/2019 OOSE3 OOSE in Real World and Industry
69/189
Prof.Dr. O.P.Vyas3.69Data Mining
Lethbridge/Laganire
2005
Chapter5: Modelling
with classes69
CategoriesCategories ofof responsibilitiesresponsibilities
Creating and initializing new instances
Loading to and saving from persistent storage
Destroying instances
Setting and getting the values of attributes
Computing numerical results
Adding and deleting links of associations
Copying, converting, transforming, transmitting or
outputting
Navigating and searching
Other specialized work
8/8/2019 OOSE3 OOSE in Real World and Industry
70/189
OOSE forOOSE for
ATM Software : Case StudyATM Software : Case Study
8/8/2019 OOSE3 OOSE in Real World and Industry
71/189
Prof.Dr. O.P.Vyas3.71Data Mining
OOM for Software Project: ATM case studyOOM for Software Project: ATM case study
The software to be designed & developed 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 (inmultiples of Rs.100/-),
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 anappropriate communication link.
9/21/2010 71
Simulated ATM Case StudySimulated ATM Case Study
8/8/2019 OOSE3 OOSE in Real World and Industry
72/189
Prof.Dr. O.P.Vyas3.72Data Mining
Simulated ATM Case StudySimulated ATM Case Study
The step-by-step progression towards the successful completion
of the project will require following;
Begin with the Requirements and User Interface.
The first task that must be performed in any project is clearly
understanding the requirements.
Then view the Use Cases and FurtherAnalysis.
Analysis is begun by identifying the use cases that follow from the
requirements, and detailing a flow of events for each.
Further analysis identifies the key classes that are suggested by
the use cases,
9/21/2010 72
Simulated ATM Case StudySimulated ATM Case Study
8/8/2019 OOSE3 OOSE in Real World and Industry
73/189
Prof.Dr. O.P.Vyas3.73Data Mining
Simulated ATM Case StudySimulated ATM Case Study
The step-by-step progression will require following;
Begin with the Requirements and User Interface.
The first task that must be performed in any project is clearly
understanding the requirements.
Then view the Use Cases and FurtherAnalysis.
Analysis is begun by identifying the use cases that follow from the
requirements, and detailing a flow of events for each.
Further analysis identifies the key classes that are suggested bythe use cases,
9/21/2010 73
8/8/2019 OOSE3 OOSE in Real World and Industry
74/189
Requirement AnalysisRequirement Analysis&&
Use Case diagramUse Case diagram
forforATM SoftwareATM Software
ATM SoftwareATM Software
8/8/2019 OOSE3 OOSE in Real World and Industry
75/189
Prof.Dr. O.P.Vyas3.75Data Mining
It will service one customer at a time who will be required to enter a (PIN)-sent to the
bank for validation as part of each transaction.
The customer will then be able to perform one or more transactions.
ATM is able to provide the following services to the customer:
A customer must be able to make a cash withdrawal in multiples of Rs.100/. Approval
needed 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 can make a transfer of money between any two A/C .
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 .
9/21/2010 75
ATM SoftwareATM Software
8/8/2019 OOSE3 OOSE in Real World and Industry
76/189
Prof.Dr. O.P.Vyas3.76Data Mining
What are the Actors & Use Cases in the given System?
There are followingActors;
Operator- who starts and closes the ATM machine.
Customer
Bank.
Operatorwill do following :-
System Start up
System shut down
Customerwill do following :-
Perform theATM sessionATM session involving;
Transaction in which
Withdrawal, Deposit, Transfer of money &
Inquiry related to Account
will be performed
BankBank will involved in the Transaction
ATM Software: Use Case diagramATM Software: Use Case diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
77/189
Prof.Dr. O.P.Vyas3.77Data Mining
As per the given scenario the Use Cases can be identified in the given System;
With 03 Actors, following Use Cases will be in the system;
System Startup Use Case
System Shutdown Use Case
Session Use Case Transaction Use Case
Withdrawal Transaction Use Case
Deposit Transaction Use Case
Transfer Transaction Use Case
Inquiry Transaction Use Case
ATM : Transaction Use Case diagramATM : Transaction Use Case diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
78/189
Prof.Dr. O.P.Vyas3.78Data Mining
As shown in the given scenario the Transaction Use Case will be under ATM Session use
case & needs to be further analyzed;
Transaction is an abstract generalization. Each specific concrete type of transaction
implements certain operations in the appropriate way. The flow of events will 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.
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. All messages to the bank and responses back are recorded in the ATM's log.
UU C di f th ATM tC di f th ATM t
8/8/2019 OOSE3 OOSE in Real World and Industry
79/189
Prof.Dr. O.P.Vyas3.79Data Mining
UseUse-- Case diagram of the ATM systemCase diagram of the ATM system
9/21/2010 79
U I t fU I t f
8/8/2019 OOSE3 OOSE in Real World and Industry
80/189
Prof.Dr. O.P.Vyas3.80Data Mining
User InterfaceUser Interface
User Interface for ATM Software will be similar to the ATM machine panel with
User friendly interface
Creating User Interface may be done either by MFC and Visual C++.
Sun had used a logical and object-oriented design for creating a GUI and
handling its events.
There are two APIs for creating GUI applications in Java: Swing andAWT(Abstract Windowing Toolkit).
When Java was first released in 1995, it contained a GUI API referred to as the
AWT.
This API contained classes like Frame to represent a typical window, Button to
represent buttons, Menu to represent a windows menu, and so on. The Swing API uses many of the AWT classes and interfaces.
80
UI V i Alt tiUI V i Alt ti
8/8/2019 OOSE3 OOSE in Real World and Industry
81/189
Prof.Dr. O.P.Vyas3.81Data Mining
UI: Various AlternativesUI: Various Alternatives
AWT components are referred to as heavyweight components because their
implementation relies heavily on the underlying operating system.
The look and feel of AWT components depend on the platform the program is
running on. For example, an AWT button will look like a Windows button when
the program is run on a Windows platform. The same button will look like a
Macintosh button when the program is run on a Macintosh platform.
Swing is different from AWT in that Swing components are 100 percent Java,
thereby not relying on the native operating system or platform.
9/21/2010 81
ATM SoftwareATM Software
8/8/2019 OOSE3 OOSE in Real World and Industry
82/189
Prof.Dr. O.P.Vyas3.82Data Mining
ATM SoftwareATM Software
We have studied the concepts of
Use Case Diagram
Class Diagram
To develop these STATIC Diagrams for ATM System.
Dynamic modeling diagrams
Develop dynamic diagrams for ATM Systems
9/21/2010 82
UseUse Case diagram: Analysis for ClassesCase diagram: Analysis for Classes
8/8/2019 OOSE3 OOSE in Real World and Industry
83/189
Prof.Dr. O.P.Vyas3.83Data Mining
UseUse-- Case diagram: Analysis for ClassesCase diagram: Analysis for Classes
9/21/2010 83
ATM : Analysis for ClassesATM : Analysis for Classes
8/8/2019 OOSE3 OOSE in Real World and Industry
84/189
Prof.Dr. O.P.Vyas3.84Data Mining
As initial in the Use Case diagram, now Classes needs to be analyzed;
A controller objectcontroller object representing theATMATM itself (managing the boundary objects as
listed )
Controller objectsController objects corresponding to use cases. (Note: class ATM can handle the
Startup and Shutdown use cases itself, so these do not give rise to separate objects
here.)
1)1) SessionSession
2)2) TransactionTransaction (abstract generalization, responsible for common features, withconcrete specializations responsible for type-specific portions)
Boundary objects representing the individual component parts of the ATM:
Operator panel.
Card reader.
Customer console, consisting of a display and keyboard. Network connection to the bank.
Cash dispenser.
Envelope acceptor. & Receipt printer.
Class AnalysisClass Analysis
8/8/2019 OOSE3 OOSE in Real World and Industry
85/189
Prof.Dr. O.P.Vyas3.85Data Mining
Class AnalysisClass Analysis
Controller objects corresponding to use cases; class ATMclass ATM can handle the
Startup and Shutdown use cases itself, so these do not give rise to separateobjects here.
Session
Transaction (abstract generalization, responsible forcommon features, with concrete specializations
responsible for type-specific portions)
An entity object representing the information encoded on the ATM card
inserted by customer.
An entity object representing the log of transactions maintained by the
machine.
9/21/2010 85
CRCCRC
8/8/2019 OOSE3 OOSE in Real World and Industry
86/189
Prof.Dr. O.P.Vyas3.86Data Mining
Using CRC cards to assign responsibilities to various classes for the tasks
required by the various use cases leads to the creation of the following cards.
Class ATMClass ATM
Controller objects corresponding to the variousController objects corresponding to the various use casesuse cases
Class SessionClass Session
Class TransactionClass Transaction
Class WithdrawalClass Withdrawal
Class DepositClass Deposit
Class TransferClass Transfer
Class InquiryClass Inquiry What about relations among these Classes?
Entity objects found necessary when assigning responsibilities to other object
9/21/2010 86
CRC for Class ATMCRC for Class ATM
8/8/2019 OOSE3 OOSE in Real World and Industry
87/189
Prof.Dr. O.P.Vyas3.87Data Mining
CRC for Class ATMCRC for Class ATM
Responsibilities CollaboratorsResponsibilities Collaborators Start up when
switch is turned on OperatorPanel
CashDispenser
NetworkToBank
Shut down when switch is turned off NetworkToBank
Start a new session when card is inserted by customer
CustomerConsoleSession
Provide access to component parts for sessions and transactions
CustomerConsoleSession
9/21/2010 87
Class SessionClass Session
8/8/2019 OOSE3 OOSE in Real World and Industry
88/189
Prof.Dr. O.P.Vyas3.88Data Mining
Class SessionClass Session
ResponsibilitiesResponsibilities Collaborators Perform
session use case ATMCardReader
Card
CustomerConsole
Transaction
Update PIN value if customer has to re-enter it
9/21/2010 88
CRC: ClassCRC: Class CardReaderCardReader
8/8/2019 OOSE3 OOSE in Real World and Industry
89/189
Prof.Dr. O.P.Vyas3.89Data Mining
CRC: ClassCRC: Class CardReaderCardReader
Responsibilities CollaboratorsResponsibilities Collaborators
Tell ATM when card is inserted ATM
Read information from card Card Eject card
Retain card
Class Card
Responsibilities Collaborators
Represent information encoded on customer's ATM card
9/21/2010 89
Class DiagramClass Diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
90/189
Prof.Dr. O.P.Vyas3.90Data Mining
Class DiagramClass Diagram
In the ATM system, one of the responsibilities of the ATM is to provide access
to its component parts for Session and Transaction objects; thus, Session andTransaction have associations to ATM, which in turn has associations to the
classes representing the individual component parts.
(Explicit "uses" links between Session and Transaction, on the one hand, and
the component parts of the ATM, on the other hand, have been omitted from
the diagram to avoid making it excessively cluttered.) The need for the various classes in the diagram was discovered at various
points in the design process.
9/21/2010 90
Class diagramClass diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
91/189
Prof.Dr. O.P.Vyas3.91Data Mining
Class diagramClass diagram
Some classes were discovered when doing analysis
Some classes were discovered when doing CRC cards
Message - used to represent a message to the bank.
Receipt - used to encapsulate information to be
printed on a receipt. Status - used to represent return value from message
to the bank.
Balances - used to record balance informationreturned by the bank
9/21/2010 91
Class diagramClass diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
92/189
Prof.Dr. O.P.Vyas3.92Data Mining
Class diagramClass diagram
Some Classes were discovered when doing detailed design or writing code
Money - used to represent money amounts, in
numerous places.
AccountInformation - contains names of varioustypes of accounts customer can choose from
That is, OO design is not a "waterfall" process - discoveries made when doing
detailed design and coding can impact overall system design.
To prevent the diagram from becoming overly large, only the name of each
class is shown - the attribute and behavior "compartments" are shown in the
detailed design, but are omitted here.
9/21/2010 92
ass agramass agram
8/8/2019 OOSE3 OOSE in Real World and Industry
93/189
Prof.Dr. O.P.Vyas3.93Data Mining
9/21/2010 93
Modeling as UML :Static & DynamicModeling as UML :Static & Dynamic
8/8/2019 OOSE3 OOSE in Real World and Industry
94/189
Prof.Dr. O.P.Vyas3.94Data Mining
Modeling as UML :Static & DynamicModeling as UML :Static & Dynamic
94
Why dynamic modelingWhy dynamic modeling
8/8/2019 OOSE3 OOSE in Real World and Industry
95/189
Prof.Dr. O.P.Vyas3.95Data Mining
Why dynamic modelingWhy dynamic modeling
As the software system continuously changes ( in states, activities, and
collaborations) during life time, therefore it is needful to model it and following
are grouped in the dynamic modeling diagrams of UML;
StatesStates
SequencesSequences
CollaborationsCollaborations
ActivitiesActivities
These diagram shows how objects interact dynamically, during execution time of
the system.
9/21/2010 95
dynamic modeling diagramsdynamic modeling diagrams
8/8/2019 OOSE3 OOSE in Real World and Industry
96/189
Prof.Dr. O.P.Vyas3.96Data Mining
dynamic modeling diagramsdynamic modeling diagrams
There are following four diagrams, who represent the behavioral view of the system and as
behavior is a dynamic phenomenon, the diagrams are also categorized as Dynamic modeling
diagrams
1. State diagrams describes different states an object can have during its life cycle, behavior
in the states, events that can change states
2. Sequence diagrams describes how objects interact and communicate with each other with
the focus on time
3. Collaboration diagrams also describes how objects interact, but the focus is on space
4. Activity diagrams another way to show interaction but the focus is on work
State chart diagramsState chart diagrams
8/8/2019 OOSE3 OOSE in Real World and Industry
97/189
Prof.Dr. O.P.Vyas3.97Data Mining
State chart diagramsState chart diagrams
Objects have behaviorsbehaviors (methods) and statestate (attributes)(attributes).
The state of an object depends on its current activity or condition.
A state chart diagram shows the possible states of the object and
the transitions that cause a change in state.
Captures life cycle of objects, subsystems and systems. Tells us the states that an object can have and what events can
change the states.
97
Activity diagramsActivity diagrams
8/8/2019 OOSE3 OOSE in Real World and Industry
98/189
Prof.Dr. O.P.Vyas3.98Data Mining
Activity diagramsActivity diagrams
The activity diagram is possibly one modeling element which was not present in
any of the predecessors of UML. No such diagrams were present either in theworks of Booch, Jacobson, or Rumbaugh.
The activity diagram focuses on representing activities or chunks of processing
which may or may not correspond to the methods of classes.
An activity is a state with an internal action and one or more outgoing
transitions which automatically follow the termination of the internal activity.
If an activity has more than one outgoing transitions, then these must be
identified through conditions.
98
Activity DiagramsActivity Diagrams
8/8/2019 OOSE3 OOSE in Real World and Industry
99/189
Prof.Dr. O.P.Vyas3.99Data Mining
Activity DiagramsActivity Diagrams
An interesting feature of the activity diagrams is the swim lanes.
Swim lanes enable you to group activities based on who is performing them.
Thus swim lanes subdivide activities based on the responsibilities of some
components.
The activities in a swim lane can be assigned to some model elements, e.g.
classes orsome component, etc. Activity diagrams are normally employed in business process modelingbusiness process modeling. This is
carried out during the initial stages of requirements analysis and specification.
Activity diagrams can be very useful to understand complex processing
activities involving many components. Later these diagrams can be used to
develop interaction diagrams which help to allocate activities (responsibilities)to classes.
99
Activity diagram vs. State chart diagramActivity diagram vs. State chart diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
100/189
Prof.Dr. O.P.Vyas3.100Data Mining
Activity diagram vs. State chart diagramActivity diagram vs. State chart diagram
Both activity and state chart diagrams model the dynamic behavior of the
system. Activity diagram is essentially a flowchart showing flow of control fromactivity to activity. A state chart diagram shows a state machine emphasizing
the flow of control from state to state.
An activity diagram is a special case of a state chart diagram in which all or
most of the states are activity states and all or most of the transitions are
triggered by completion of activities in the source state (An activity is anongoing non-atomic execution within a state machine).
100
Activity diagram Vs. State chart diagramActivity diagram Vs. State chart diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
101/189
Prof.Dr. O.P.Vyas3.101Data Mining
Activity diagram Vs. State chart diagramActivity diagram Vs. State chart diagram
101
Activity diagramsActivity diagrams may stand alone to visualize, specify, anddocument the dynamics of a society of objects or they may be used to
model the flow of control of an operation.
State chart diagramsState chart diagrams may be attached
to classes, use cases, or entire systems in order to visualize, specify,and document the dynamics of an individual object.
State Chart diagramState Chart diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
102/189
Prof.Dr. O.P.Vyas3.102Data Mining
State Chart diagramState Chart diagram
The basic elements of the state chart diagram are as follows: Initial state. This
is represented as a filled circle.
Final stateFinal state. This is represented by a filled circle inside a larger circle.
StateState. These are represented by rectangles with rounded corners.
TransitionTransition. A transition is shown as an arrow between two states. Normally, the
name of the event which causes the transition is places along side the arrow. Aguard to the transition can also be assigned. A guard is a Boolean logic
condition. The transition can take place only if the grade evaluates to true.
102
StatechartStatechart diagramdiagram
8/8/2019 OOSE3 OOSE in Real World and Industry
103/189
Prof.Dr. O.P.Vyas3.103Data Mining
ObjectsObjects have behaviors and state.
The state of an object depends on its current activity or condition.
A statechart diagram shows the possible states of the object and the
transitions that cause a change in state.
Let us consider another similar banking application and model the Login partLogin part
of an online banking system.of an online banking system.
Logging in consists of entering a valid social security numberand personal id
number, then submitting the information for validation.
103
Logging in Banking systemLogging in Banking system
8/8/2019 OOSE3 OOSE in Real World and Industry
104/189
Prof.Dr. O.P.Vyas3.104Data Mining
Logging in Banking systemLogging in Banking system
Logging inLogging in can be factored into four non-overlapping states:
I. Getting SSN,
II. Getting PIN,
III. Validating, and
IV. Rejecting.
From each state comes a complete set of transitions that determine the
subsequent state.
104
StatechartStatechart diagram for Banking Logging in Systemdiagram for Banking Logging in System
8/8/2019 OOSE3 OOSE in Real World and Industry
105/189
Prof.Dr. O.P.Vyas3.105Data Mining
105
States are rounded rectangles. Transitions are arrows from one state toanother.Events or conditions that trigger transitions are written beside thearrows. Our diagram has twotwo selfself--transitiontransition, one on Getting SSN and
anotheron Getting PIN.
Logging in systemLogging in system
8/8/2019 OOSE3 OOSE in Real World and Industry
106/189
Prof.Dr. O.P.Vyas3.106Data Mining
gg g ygg g y
The initial state (black circle) is a dummy to start the action. Final states are
also dummy states that terminate the action.
The action that occurs as a result of an event or condition is expressed in the
form /action.
While in its Validating state, the object does not wait for an outside event to
trigger a transition. Instead, it performs an activity. The result of that activity
determines its subsequent state.
106
Activity diagramsActivity diagrams
8/8/2019 OOSE3 OOSE in Real World and Industry
107/189
Prof.Dr. O.P.Vyas3.107Data Mining
y gy g
An activity diagram is essentially a fancy flowchart. Activity diagrams and
statechart diagrams are related. While a statechart diagram focuses attentionon an object undergoing a process (or on a process as an object), an activity
diagram focuses on the flow of activities involved in a single process. The
activity diagram shows the how those activities depend on one another.
For our example, we used the following process.
"Withdraw money from a bank account through an ATM."Withdraw money from a bank account through an ATM."
The three involved classes (people, etc.) of the activity are Customer, ATM,
and Bank.
The process begins at the black start circle at the topblack start circle at the top and ends at the
concentric white/black stop circlesconcentric white/black stop circles at the bottom.
The activities are rounded rectangles.
107
Activity diagramActivity diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
108/189
Prof.Dr. O.P.Vyas3.108Data Mining
108
Interaction DiagramsInteraction Diagrams
8/8/2019 OOSE3 OOSE in Real World and Industry
109/189
Prof.Dr. O.P.Vyas3.109Data Mining
Interaction diagrams are models that describe how group of objects collaboratecollaborate
to realize some behavior.
Typically, each interaction diagram realizes the behavior of a single use case. An interaction diagraminteraction diagram shows a number of example objects and the messages
that are passed between the objects within the use case.
There are two kindstwo kinds of interaction diagrams:
sequence diagrams and collaboration diagrams. These two diagrams are equivalent in the sense that any one diagram can be
derived automatically from the other.
These two actually portray different perspectives of behavior of the system and
different types of inferences can be drawn from them. The interaction diagrams
can be considered as a major tool in the design methodology.
109
Sequence DiagramSequence Diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
110/189
Prof.Dr. O.P.Vyas3.110Data Mining
q gq g
A sequence diagram is an interaction diagram that details how operations are
carried out -- what messages are sent and when.
Sequence diagrams are organized according to timetime.
Focus is on message sequences.
Sequence diagrams have two axestwo axes:
VerticalVertical timeHorizontalHorizontal set of objects.
The timetime progresses as you go down the page.
The objectsobjects involved in the operation are listed from left to rightleft to right according to
when they take part in the message sequence.
110
8/8/2019 OOSE3 OOSE in Real World and Industry
111/189
Sequence diagramSequence diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
112/189
Prof.Dr. O.P.Vyas3.112Data Mining
q gq g
Each message in Sequence diagram is labeled with the message name.
Some control information can also be included. Two types of control
information are particularly valuable:-
A condition (e.g. [invalid]) indicates that a message is sent, only if the conditionis true.
An iteration markeriteration marker shows the message is sent many times to multiple receiver
objects as would happen when a collection or the elements of an array are
being iterated.
The basis of the iteration can also be indicated .
112
8/8/2019 OOSE3 OOSE in Real World and Industry
113/189
8/8/2019 OOSE3 OOSE in Real World and Industry
114/189
Collaboration DiagramCollaboration Diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
115/189
Prof.Dr. O.P.Vyas3.115Data Mining
A collaboration diagram shows both structural and behavioral aspectsstructural and behavioral aspects explicitly.
This is unlikunlike a sequence diagram which shows only the behavioral aspectsbehavioral aspects. The structural aspect of a collaboration diagram consists of objects and the
links existing between them. In this diagram, an object is also called a
collaborator.collaborator.
The behavioral aspect is described by the set of messages exchanged amongset of messages exchanged among
the different collaborators.the different collaborators. The linklink between objects is shown as a solid linesolid lineand can be used to send messages between two objects.
The messagemessage is shown as a labeled arrow placed near the link. Messages are
prefixed with sequence numberssequence numbers because they are only way to describe the
relative sequencing of the messages in this diagram.
The use of the collaboration diagrams in our development process would be tohelp us to determine which classes are associated with which other classes.
115
Collaboration diagramsCollaboration diagrams
8/8/2019 OOSE3 OOSE in Real World and Industry
116/189
Prof.Dr. O.P.Vyas3.116Data Mining
Focus is on interactions between objects with the emphasis on space
Note that the emphasis in sequence diagrams was on time
Collaboration diagrams show the objects and their links to each other
A link is an instance of an association.
Collaboration diagrams are also interaction diagrams. They convey the same information as
sequence diagrams, but they focus on object roles instead of the times that messages are
sent.
In a sequence diagram, object roles are the vertices and messages are the connecting links.
Collaboration diagramCollaboration diagram
8/8/2019 OOSE3 OOSE in Real World and Industry
117/189
Prof.Dr. O.P.Vyas3.117Data Mining
117
The object-role rectangles are labeled with eitherclass or object
names (or both).Class names are preceded by colons ( : ).Each message in a collaboration diagram has a sequencenumber. The top-level message is numbered 1. Messages at thesame level (sent during the same call) have the same decimalprefix but suffixes of 1, 2, etc. according to when they occur.
LinksLinks
8/8/2019 OOSE3 OOSE in Real World and Industry
118/189
Prof.Dr. O.P.Vyas3.118Data Mining
A link is a connection between two objects
Role names of the objects can be shown at the end of the links
Qualifiers can also be shown on the links
Stereotypes may be attached to the roles of the objects
Standard stereotypes are: global, local, parameter, self, vote, broadcast
Types of linksTypes of links
8/8/2019 OOSE3 OOSE in Real World and Industry
119/189
Prof.Dr. O.P.Vyas3.119Data Mining
Global - corresponding instance is visible because it is global in
scope Local - corresponding instance is visible because it is local in
scope
Parameter visible because it is a parameter in an operation
Self specifies that the object can send message to itself Vote constrains a collection of return messages such that the
return value is selected through a majority vote
Broadcast specifies that the set of messages are not invoked in
a certain order
PolymorphismPolymorphism
8/8/2019 OOSE3 OOSE in Real World and Industry
120/189
Prof.Dr. O.P.Vyas3.120Data Mining
Ex. Bird, Person and Fish
are child classes ofAnimal. Each subclass overrides
the move() method in itsown way
Animal [] A = newnew Animal[3];
A[0] = new Bird();A[1] = new Person();
A[2] = new Fish();
for (int i = 0; i < A.length; i++)
A[i].move();
move()
move()
move()
References are all the same, butobjects are not
Method invoked is thatassociated with the OBJECT, NOT
with the referencereference
8/8/2019 OOSE3 OOSE in Real World and Industry
121/189
InheritanceInheritance -- related Terminologyrelated Terminology
8/8/2019 OOSE3 OOSE in Real World and Industry
122/189
Prof.Dr. O.P.Vyas3.122Data Mining
21/09/201002:10:45 Marc Conrad -
University of Luton
122
Derived class orsubclass orchild class. A class which inherits some of its attributes and methods
from another class.
Base class orsuperclass orparent class.
A class from which another class inherits.
Ancestor.
A classs ancestors are those from which its own
superclasses inherit.
Descendant.
A classs descendants are those which inherit from its
subclasses.
Inheritance vs. AggregationInheritance vs. Aggregation
8/8/2019 OOSE3 OOSE in Real World and Industry
123/189
Prof.Dr. O.P.Vyas3.123Data Mining
21/09/201002:10:45 Marc Conrad -
University of Luton
123
Inheritance means that one class inherits the
characteristics of another class.
This is also called a is a relationship:
Aggregation describes a has a relationship. One object
is a part of another object.
A caris a vehicle
A carhas wheels
A student is a person
A person has legs
Inheritance and is aInheritance and is a
8/8/2019 OOSE3 OOSE in Real World and Industry
124/189
Prof.Dr. O.P.Vyas3.124Data Mining
We can understand this the is a idea A subclass object is a superclass object
However, some extra instance variables and methods mayhave been added and some other methods may have beenchanged
Note that is a is a one way operation
Subclass is a superclass (specific "is a" general)
With modifications / additions
Superclass is NOT a subclass (general not "is a" specific Missing some properties
Inheritance and is aInheritance and is a
8/8/2019 OOSE3 OOSE in Real World and Industry
125/189
Prof.Dr. O.P.Vyas3.125Data Mining
Bird, Human and Fish are all Animals
However, an Animal is not necessarily a Bird, Human orFish
Animal
Bird Human Fish
is ais a
is a
8/8/2019 OOSE3 OOSE in Real World and Industry
126/189
CompositionComposition
8/8/2019 OOSE3 OOSE in Real World and Industry
127/189
Prof.Dr. O.P.Vyas3.127Data Mining
object composition is a way to combine simple objects or data types into more
complex ones. Compositions are a critical building block of many basic data structures,
including the tagged union, the linked list, and the binary tree, as well as the
object used in object-oriented programming.
Composited (composed) objects are often referred to as having a "has a"
relationship.
A real-world example of composition may be seen in an automobile: the objects
wheel, steering wheel, seat, gearbox and engine may have no functionality by
themselves, but an object called automobile containing all of those objects
would serve a higher function, greater than the sum of its parts.
127
CompositionComposition
8/8/2019 OOSE3 OOSE in Real World and Industry
128/189
Prof.Dr. O.P.Vyas3.128Data Mining
When, in a language, objects are typed, types can often be divided into
composite and noncomposite types, and composition can be regarded as arelationship between types: an object of a composite type (e.g. car) "has an"
object of a simpler type (e.g. wheel).
Composition must be distinguished from subtypingsubtyping which is the process of
adding detail to a general data type to create a more specific data type. For
instance, cars may be a specific type of vehicle: caris a vehicle. Subtyping doesn't describe a relationship between different objects, but
instead, says that objects of a type are simultaneously objects of another type.
128
CompositionComposition
8/8/2019 OOSE3 OOSE in Real World and Industry
129/189
Prof.Dr. O.P.Vyas3.129Data Mining
In programming languages, composite objects are usually expressed by means
of references from one object to another; depending on the language, suchreferences may be known as fields, members, properties or attributes, and the
resulting composition as a structure, storage record, tuple, user-defined type
(UDT), or composite type.
Fields are given a unique name so that each one can be distinguished from
the others. However, having such references doesn't necessarily mean that an object is a
composite.
It is only called composite if the objects it refers to are really its parts, i.e. have
no independent existence. For details, see the aggregation section below.
129
AggregationAggregation
8/8/2019 OOSE3 OOSE in Real World and Industry
130/189
Prof.Dr. O.P.Vyas3.130Data Mining
Aggregation differs from ordinary composition in that it does not imply
ownership. In composition, when the owning object is destroyed, so are thecontained objects. In aggregation, this is not necessarily true.
For example, a university owns various departments (e.g., chemistry), and
each department has a number of professors. If the university closes, the
departments will no longer exist, but the professors in those departments will
continue to exist. Therefore, a University can be seen as a composition ofdepartments, whereas departments have an aggregation of professors. In
addition, a Professor could work in more than one department, but a
department could not be part of more than one university.
130
UML notationUML notation
8/8/2019 OOSE3 OOSE in Real World and Industry
131/189
Prof.Dr. O.P.Vyas3.131Data Mining
In UML, composition is depicted as a filled diamond and a solid line. It always
implies a multiplicity of 1 or 0..1, as no more than one object at a time can havelifetime responsibility for another object.
The more general form, aggregation, is depicted as an unfilled diamond and a
solid line. The image below shows both composition and aggregation.
131
Composition & AggregationComposition & Aggregation
8/8/2019 OOSE3 OOSE in Real World and Industry
132/189
Prof.Dr. O.P.Vyas3.132Data Mining
The C++ code below shows what the source code is likely to look like.The C++ code below shows what the source code is likely to look like.
//// CompositionComposition
class Car { private: Carburetor* itsCarb; public: Car() {itsCarb=new
Carburetor();} virtual ~Car() {delete itsCarb;} };
// Aggregation
class Pond { private: vector itsDucks; };132
Example: OOM designExample: OOM design
As we have seen in the Employee Compute pay example the Salary and
8/8/2019 OOSE3 OOSE in Real World and Industry
133/189
Prof.Dr. O.P.Vyas3.133Data Mining
As we have seen in the Employee Compute pay example, the Salary and
Hourly classes are repeating code. Salary and hourly employees are still
employees, and there is a lot of information in common between the two. Although Salary and Hourly employees are different types, they are not
entirely different. Which is seen by the repetition of fields and methods in
these two classes.
The Salary and Hourly classes demonstrate the need forinheritance.
Using inheritance will improve this design considerably, not only to avoid
repeating code, but also to create a program design that allows for better
maintenance and code changes later.
Therefore, writing two separate classes for the two different types of employees is
not yet a satisfactory solution.
Design in OOSE is definitely an issue.
Two ClassesTwo Classes
public class Salarypublic class Hourly
{
8/8/2019 OOSE3 OOSE in Real World and Industry
134/189
Prof.Dr. O.P.Vyas3.134Data Mining
{
public String name;
public String address;
public int SSN;
public int number;
public float salary;
public void mailCheck(){
System.out.println(Mailing a check to +
name
+ + address);
}
public float computePay()
{
return (float) salary/52.0;
}
{
public String name;
public String address;public int SSN;
public int number;
public float hourlyRate;
public float hoursWorked
public void mailCheck()
{
System.out.println(Mailing a check to +
name + + address);
}
public float computePay()
{ return (float) hoursWorked * hourlyRate;
}
}134
OOMOOM
8/8/2019 OOSE3 OOSE in Real World and Industry
135/189
Prof.Dr. O.P.Vyas3.135Data Mining
A better design for the Salary and Hourly classes is to take their common
elements and put them in a parent class, leaving the unique elements in thechild classes.
For example, the mailCheck() method could appear in the Employee parent
class, and the computePay() method could appear in each of the child classes.
The assumption is that the process of mailing a check is the same for all
employees, but computing their pay is directly affected by how they are paid.
Employees do not share a common computePay() method. By placing
computePay() in each child class, the method will be written twice.
This is not repeating code, though, because computePay() in Salary is quite
different than computePay() in Hourly.
135
Example: OOM designExample: OOM designThis benefit is difficult to achieve with procedural programming and also with poorly designed OOP
8/8/2019 OOSE3 OOSE in Real World and Industry
136/189
Prof.Dr. O.P.Vyas3.136Data Mining
p p g g p y g
applications.
To avoid these situations, constantly test yourOOP design against these simple rules:
An object has an attribute, and an object does a behavior.An object has an attribute, and an object does a behavior.
In our employee example, if it is not true that an employee has a salary, an Employee class should not
have a salary field, and we should redesign our program.
None of the existing code needs to be touched.
With OOPS Characteristics - inheritance, all of these issues are avoided.
The common features of employees appear in a parent class. Each different type of employee is
represented by a child class.
When a new type of employee such as a contractorcomes along, a new child class is written that
extends the parent class.
Using inheritance will improve this design considerably, not only to avoid repeating
code, but also to create a program design that allows for better maintenance andcode changes later.
TheThe is a Relationshipis a Relationship
Th i l ti hi i i l b t f l l f t ti if i h it
8/8/2019 OOSE3 OOSE in Real World and Industry
137/189
Prof.Dr. O.P.Vyas3.137Data Mining
The is a relationship is a simple but powerful rule for testing if your inheritance
is a good design.
Whenever you use inheritance, you should be able to say that a childchild is aparentparent.
If this statement is true, your inheritance is likely a good design.
For example, it is true that a salaried employeea salaried employee is anis an employee.employee.
Similarly, an hourly employeehourly employee is anis an employee;employee; therefore, it is reasonable thatthe Salary and Hourly classes extend the Employee class.
Lets look at an example where inheritance is not a good idea. Suppose that
you have a Date class that represents a calendar date, and you want to use
that class to keep track of the date when an employee was hired.
137
Inheritance ?Inheritance ?
8/8/2019 OOSE3 OOSE in Real World and Industry
138/189
Prof.Dr. O.P.Vyas3.138Data Mining
Because inheritance has so many benefits, you decide to have the Employee
class extend the Date class. When you instantiate an Employee object, you will also get a Date object for
storing the employees hire date; however, is it true that an employee is a date?
The is a relationship clearly fails here. Although the result might work for us, an
Employee class inheriting from a Date class is not a good design and should
not be used. The solution to the improperuse of inheritance with the Employee and Date
classes is to realize that an employee has a hire date, not that an employee is
a hire date. If an object has an attribute, the attribute should be a field in the
class.
The Employee class should add a field of type Date to represent the hire dateof an employee, as opposed to extending the Date class.
138
Object Oriented MethodologyObject Oriented Methodology
8/8/2019 OOSE3 OOSE in Real World and Industry
139/189
Prof.Dr. O.P.Vyas3.139Data Mining
Objects & Classes in JavaObjects & Classes in Java
Writing a Class in JavaWriting a Class in Java .
OOM design issuesOOM design issues
OOM Characteristics:
Inheritance: When to use / not to use ? Implementing Inheritance: Instantiating Child objects
Types of Inheritance
ObjectObject Class : Over riding ?
Super keyword & Final methods
Modeling in OOM way Modeling in OOM way
139
8/8/2019 OOSE3 OOSE in Real World and Industry
140/189
8/8/2019 OOSE3 OOSE in Real World and Industry
141/189
8/8/2019 OOSE3 OOSE in Real World and Industry
142/189
InheritanceInheritance
8/8/2019 OOSE3 OOSE in Real World and Industry
143/189
Prof.Dr. O.P.Vyas3.143Data Mining
A child class has access to the fields and methods in the parent class,
depending on the access specifier, The computePaycomputePay() method() method of the Salary class displays the name of the
employee being paid, but there is no nameno name field in the salary class.
The name field is in Employee, the parent of Salary. In this example, becausebecause
name isname is publicpublic, Salary has acces to it and can use it at any point in the Salary
class. (What will happen if it is Private?) Notice that the Hourly class print