CS 501: Software Engineering System Architecture III CS 501 Spring 2002 Lecture 15

advertisement
CS 501: Software Engineering
Lecture 15
System Architecture III
1
CS 501 Spring 2002
Administration
2
CS 501 Spring 2002
Software Reuse: Application Packages
•
Package supports a standard application (e.g., payroll, user
interface to Internet information, mathematical algorithms)
• Functionality can be enhanced by:
=> configuration parameters (e.g., table driven)
=> extensibility at defined interfaces
=> custom written source code extensions
3
CS 501 Spring 2002
Reuse: Object Oriented Software
Engineering
Example:
Java is a relatively straightforward language with a very rich set
of class hierarchies.
• Java programs derive much of their functionality from
standard classes
•
Learning and understanding the classes is difficult.
=> Java experts can write complex systems quickly
=> Inexperienced Java programmers write inelegant and
buggy programs
4
CS 501 Spring 2002
Reuse: Objects - Basic Definitions
• An object is a piece of code that owns attributes and
provides services through methods.
• The methods operate on instance data owned by the
object.
• A class is a collection of like objects.
5
CS 501 Spring 2002
Reuse: Objects - Characteristics
• Encapsulation. An object has a public interface that
defines how other objects or applications can
interact with it.
methods
public instance data
• Inheritance. Subclasses can be derived from parent
classes. They inherit or override the parents'
methods and instance data.
• Polymorphism. The effect of a method can vary
depending on the class that implements it (e.g.,
display_object)
6
CS 501 Spring 2002
Reuse: Objects - Object Binding
Binding is the linking of the software interface between two
objects.
• Static binding: The interface is determined at compile or
build time.
Straightforward
Allows type checking
• Dynamic binding or late binding: The link is established at
run time.
Flexible and extensible
Complex
7
CS 501 Spring 2002
Reuse: Objects - Distributed Objects
Objects on separate computers interact through method calls
and instance data.
Major systems:
8
•
CORBA (Common Object Request Broker Architecture)
•
Microsoft family: OLE, COM, DCOM, Active X, .net
CS 501 Spring 2002
Desirable Properties of Distributed
Objects
• Different languages and operating environments
• Reusable code: components
• Architecture can be extensible
• Future changes can be localized
• Standard tools used for client/server interactions
9
CS 501 Spring 2002
Object Request Broker (ORB)
C
C++
Cobol Objects
IDL
IDL
IDL Interface IDL
Java
Client
Other
IDL
Server
Object Request Broker
10
CS 501 Spring 2002
Example: Fedora IDL
A research project to explore extensibility:
-- very simple Interface Definition Language
-- powerful tools for extensions
-- interoperability experiments, Cornell and CNRI
http://www.cs.cornell.edu/cdlrg/fedora.html
11
CS 501 Spring 2002
Interface Definition Language
module <identifier>
{
<type declarations>;
<constant declarations>;
<exception declarations>;
interface <identifier> [:<inheritance>]
{
See next slide
}
Naming context
Define a class
interface <identifier> [:<inheritance>] Define a class
{ ..... }
{
12
CS 501 Spring 2002
Interface Definition Language
(continued)
interface <identifier> [:<inheritance>]
{
<type declarations>;
<constant declarations>;
<exception declarations>;
Define a class
[<op_type] <identifier>(<parameters>) Define a method
[raises exception] [context];
....
[<op_type] <identifier>(<parameters>) Define a method
[raises exception] [context];
....
}
13
CS 501 Spring 2002
ORB: Programmer's View
Client
Invoke a
on
object X
Server
Invoke a
on
object Y
Object X
Object Y
a
a
Object Request Broker
14
CS 501 Spring 2002
Object Request Broker (ORB)
An ORB lets objects make requests to and receive
responses from other objects located locally or remotely.
• Static and dynamic method invocations
• High-level language bindings
• Self-describing system
• Local/remote transparency
• Inter-ORB protocols
Internet Inter-ORB Protocol (IIOP)
15
CS 501 Spring 2002
ORB: System View
Interface
repository
Client
Dynamic Client IDL ORB
invocation stubs
interface
Object
Implementation
implementation
repository
Static
Dynamic Object
skeletons invocation adapter
Object Request Broker
16
CS 501 Spring 2002
CORBA Services
•
•
•
•
•
•
•
•
•
•
•
•
•
17
Naming service
Event service
Concurrency control service
Transaction service
Relationship service
Externalization service
Query service
Life cycle service
Persistence service
Licensing service
Properties service
Security service
Time service
CS 501 Spring 2002
Distributed Objects and the System
Life-Cycle
All large systems change with time.
•
Dynamic binding of objects combined with polymorphism
permits the addition of extra object types, incremental
changes, etc. to be localized.
Development environments change with time.
•
Language bindings and IIOP permit changes.
Production environments changes with time.
•
18
Code can be reused in different environments.
CS 501 Spring 2002
Discussion of Pfleeger, Chapter 6
Format:
State a question.
Ask a member of the class to answer.
(Sorry if I pronounce your name wrongly.)
Provide opportunity for others to comment.
When answering:
Stand up.
Give your name or NetID. Make sure the TA hears it.
Speak clearly so that all the class can hear.
19
CS 501 Spring 2002
Question 1: Class boxes
Here is a UML class box.
Bill
Issue_date: Date
price()
taxes()
add_bill (customer, amount)
Explain the three sections of this box.
20
CS 501 Spring 2002
Question 2: Packages
Turn to Figure 6.18 on page 281.
(a) What is the purpose of a package diagram?
(b) Why do you think that some, but not all, of the lines
have arrows?
(c) What is the significance of the numbers on the line
between the Parking and Parking Spaces classes?
21
CS 501 Spring 2002
Question 3: Use cases
(a) What is a Use Case?
(b) What is an extension to a Use Case?
(c) At what stage of the Waterfall Model would you
make use of Use Cases?
(d) What have Use Cases to do with Object
Oriented Design?
22
CS 501 Spring 2002
Question 4: A UML Diagram
Explain the following diagram
libMem:
LibraryMember
BookBorrower
theBook:Book
theCopy:Copy
borrow(theCopy)
okToBorrow
borrow
borrow
23
CS 501 Spring 2002
Download