chapter 10 introduction to components. process phases discussed in this chapter requirements...
TRANSCRIPT
![Page 1: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/1.jpg)
Chapter 10Introduction to Components
![Page 2: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/2.jpg)
Process Phases Discussed in This ChapterRequirementsAnalysis
Design
Implementation
ArchitectureFramework Detailed Design
xKey: = secondary emphasisx = main emphasis
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 3: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/3.jpg)
Learning Goals for This Chapter
… benefits of components
… what components consist of
… how they are developed
… how they are combinedo with each other
o with applications
… how components can be executed
Understand …
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 4: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/4.jpg)
Design Goal At Work: Reusability
We want to re-use collections of software.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 5: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/5.jpg)
Building With and Without Components
Without components
With components: Parts replaceable without significant rebuilding
This affected by window change
This affected by window change
etc.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 6: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/6.jpg)
Key Concept: What is a Component?
-- a software collection used without alteration.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 7: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/7.jpg)
Components Can Be Made of …
… Source codeo Classes -- one or more, possibly related
… Executable codeo Object code
o Virtual object code
… Other fileso Images, text, indices, etc.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 8: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/8.jpg)
The Controlled Juggler Application
![Page 9: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/9.jpg)
BeanBox Environment
![Page 10: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/10.jpg)
Selecting Juggler
![Page 11: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/11.jpg)
Juggler is a class – actually an Applet, so it implements the
Serializable interface
We do not alter (the code for) Juggler
BeanBox recognizes that Juggler is a Component, and displays
an image of an instance.
Juggler listens for several kinds of events
BeanBox recognizes that Juggler implements the Runnable
interface, and automatically executes its run()
Juggler operates by displaying images from the array images
of type Image[]. The key lines in run() are
Image img = images[ ( loop % 4 ) + 1 ];…g.drawImage( img, 0, 0, this );
Observations on Juggler Source
Code 1
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 12: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/12.jpg)
rate is a private variable: A public method is available to set it as follows. public void setAnimationRate( int x ) { rate = x;}
BeanBox recognizes animationRate as an int property, and allows it to be set.
Juggler code distinguishes the behavior of the bean between “design time,” “run time” etc. For example/*
* If switching to runtime, …
* If switching to design time and debugging is true, ….
*/
public void setDesignTime( boolean dmode ) …..
Observations on Juggler Source
Code 2
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 13: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/13.jpg)
Design Goal At Work: Reusability
We want to construct and re-use a Juggler instance connected to Start / Stop buttons.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 14: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/14.jpg)
Causing ExplicitButton Press to callstopJuggling() on Juggler
![Page 15: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/15.jpg)
Design Goal At Work: Reusability
We want the functionality and event sensitivity of a Bean to be available in any context.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 16: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/16.jpg)
What Components Provide The Parts of a Component
Properties
Methods o in the form of methods,
published in interfaces
Reactions to Events Ability to provide
information about themselves
Set of classesproviding interfaces
ManifestSee below
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 17: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/17.jpg)
Manifests
Identification of the component Authorship of the component List of files or classes making up this component Other components on which this one relies Encryption information Means of verifying that all parts of the
component are present Version number
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 18: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/18.jpg)
Introspection: Runtime Java Information Includes …
ClassName, superclass, super-interfaces, inner classes, fields, constructors, Mmethods
Field Name, type
Constructor Parameters, exceptions
Method Name, parameters, return type, exceptions
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 19: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/19.jpg)
Key Concept: The Aspects of a Component
-- properties, functionality, sensitivity to events, a manifest listing its files, and an interface providing a self-description.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 20: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/20.jpg)
UML Notation for Components
componentsinterfacessupported
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 21: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/21.jpg)
Phases of a Component’s Lifetime
Assembly Time*
Deployment Time
Execution Time
xx
Design / Implementation Time
Instance Creation Time*instance
application
executable
Collection of classes; manifest
* Performed in a development environment e.g., BeanBox
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 22: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/22.jpg)
Design Phase for Components
Write source code for classes
o Ensure that the runtime environment contains library
classes required
o Conform with required rules, if any (e.g., Java Beans)
Incorporate required non-library classes
Create a manifest listing the component’s parts
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 23: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/23.jpg)
Instance Creation Time
Compiled collection of classes
componentinstance
Component environment Storage
componentCreate instance Store instance
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 24: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/24.jpg)
Assembly Time
Components
Relatedinstances
Instance creation and connection
Storage
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 25: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/25.jpg)
Deployment Time
Compiled classes of the application
component
Executionenvironment Storage
Complete application
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 26: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/26.jpg)
Key Concept: The Lifecycle of a Component:
Select, design, code source, instantiate, combine instances, deploy in applications, execute.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 27: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/27.jpg)
Components in CORBA Have “Ports”
Facets (functionality provided for clients)
Receptacles (functionality it requires)
Dependence on other components
Event sources (that it’s sensitive to)
Event sinks (that it listens for on other components)
Attributes (properties)
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 28: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/28.jpg)
Ports
facets
attributes
event sink
event source
receptacles
(“Methods”)
(“Properties”)
(“Events”)
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 29: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/29.jpg)
Component May Support Interfaces
Interface DepositTransactions { . . . };
Used in …
Component Bank supports DepositTransactions
{ … Provide additional parts as desired … };
Specification of an interface (a list of function prototypes)
Specification of a component
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 30: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/30.jpg)
Finding CORBA Components and Creating Instances
Get reference to component XYBank using the CORBA naming service. (Not covered here.)
Create instances in two steps.
(1): Use create() on the component
Org.omg.Components.ComponentBase
myXYBankInstance = XYBank.create();
(2): Cast the instance as XYBank object
XYBank bank = (XYBank) myXYBankInstance;
Now use bank . . . Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
![Page 31: Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed](https://reader036.vdocuments.site/reader036/viewer/2022070407/56649e3b5503460f94b2da85/html5/thumbnails/31.jpg)
Summary: Components …
… are software elements used without alteration
… allow the re-use of compiled parts
o Interaction via events reduces interdependence
… typically developed in a convenient container
o e.g., for visualizing and interconnecting
o to free the developer from common tasks
… consist of classes, files etc. and a manifest
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.