Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed.

Similar presentations


Presentation on theme: "Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed."— Presentation transcript:

1 Chapter 10 Introduction to Components

2 Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed Design x Key:= secondary emphasis x = main emphasis Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

3 Learning Goals for This Chapter  … benefits of components  … what components consist of  … how they are developed  … how they are combined o 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.

4 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.

5 Building With and Without Components Without components With components: Parts replaceable without significant rebuilding This affected by window change etc. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

6 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.

7 Components Can Be Made of …  … Source code o Classes -- one or more, possibly related  … Executable code o Object code o Virtual object code  … Other files o Images, text, indices, etc. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

8 The Controlled Juggler Application

9 BeanBox Environment

10 Selecting Juggler

11  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.

12  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.

13 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.

14 Causing ExplicitButton Press to call stopJuggling() on Juggler

15 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.

16 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 classes providing interfaces  Manifest See below Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

17 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.

18 Introspection: Runtime Java Information Includes … Class Name, superclass, super-interfaces, inner classes, fields, constructors, Mmethods FieldName, type ConstructorParameters, exceptions MethodName, parameters, return type, exceptions Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

19 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.

20 UML Notation for Components components interfaces supported Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

21 Phases of a Component’s Lifetime Assembly Time* Deployment Time Execution Time x x 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.

22 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.

23 Instance Creation Time Compiled collection of classes component instance Component environment Storage component Create instanceStore instance Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

24 Assembly Time Components Related instances Instance creation and connection Storage Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

25 Deployment Time Compiled classes of the application component Execution environment Storage Complete application Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

26 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.

27 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.

28 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.

29 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.

30 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.

31 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.


Download ppt "Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed."

Similar presentations


Ads by Google