Presentation is loading. Please wait.

Presentation is loading. Please wait.

SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits.

Similar presentations


Presentation on theme: "SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits."— Presentation transcript:

1 SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits of components  what components consist of  how they are developed and combined with each other and with applications  how components can be executed Ch 10 Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

2 SWE 316: Software Design and Architecture Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed Design x Key:= secondary emphasis x = main emphasis We want to re-use collections of software. KEY CONCEPT Design Goal At: Reusability IntroductionExampleComponent PartsUML Notation 2/26

3 SWE 316: Software Design and Architecture Component-based software engineering *  Component-based software engineering (CBSE) is an approach to software development that relies on software reuse.  It emerged from the failure of object-oriented development to support effective reuse. Single object classes are too detailed and specific.  Components are more abstract than object classes and can be considered to be stand-alone service providers. * Software Engineering - Sommerville Introduction ExampleComponent PartsUML Notation 3/26

4 SWE 316: Software Design and Architecture Without components With components: Parts replaceable without significant rebuilding This affected by window change etc. Building With and Without Components Introduction ExampleComponent PartsUML Notation 4/26

5 SWE 316: Software Design and Architecture What is a Component?  -- a software collection used without alteration.  The Object Management Group  “A physical, replaceable part of a system that packages implementation and provides the realization of a set of interfaces. A component represent a physical piece of a system’s implementation, including software code (source, binary or executable) or equivalents, such as scripts or command files” Introduction ExampleComponent PartsUML Notation 5/26

6 SWE 316: Software Design and Architecture Components Can Be Made of …  … Source code  Classes -- one or more, possibly related  … Executable code  Object code  Virtual object code  … Other files  Images, text, indices, etc. Introduction ExampleComponent PartsUML Notation 6/26

7 SWE 316: Software Design and Architecture Components and objects *  Components are deployable entities.  Components do not define types.  Component implementations are opaque.  Components are language-independent.  Components are standardised. * Software Engineering - Sommerville Introduction ExampleComponent PartsUML Notation 7/26

8 SWE 316: Software Design and Architecture Component models  A component model is a definition of standards for component implementation, documentation and deployment.  Examples of component models  EJB model (Enterprise Java Beans)  COM+ model (.NET model)  Corba Component Model  The component model specifies how interfaces should be defined and the elements that should be included in an interface definition. Introduction ExampleComponent PartsUML Notation 8/26

9 SWE 316: Software Design and Architecture The Controlled Juggler Application Introduction Example Component PartsUML Notation 9/26

10 SWE 316: Software Design and Architecture BeanBox Environment Introduction Example Component PartsUML Notation 10/26

11 SWE 316: Software Design and Architecture Selecting Juggler Introduction Example Component PartsUML Notation 11/26

12 SWE 316: Software Design and Architecture Observations on Juggler Source Code 1  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 Introduction Example Component PartsUML Notation 12/26

13 SWE 316: Software Design and Architecture Observations on Juggler Source Code 2  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 ); Introduction Example Component PartsUML Notation 13/26

14 SWE 316: Software Design and Architecture Observations on Juggler Source Code 2  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. Introduction Example Component PartsUML Notation 14/26

15 SWE 316: Software Design and Architecture Observations on Juggler Source Code 2  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 ) ….. We want to construct and re-use a Juggler instance connected to Start / Stop buttons. KEY CONCEPT Design Goal At: Reusability Introduction Example Component PartsUML Notation 15/26

16 SWE 316: Software Design and Architecture Adding behavior Causing ExplicitButton Press to call stopJuggling() on Juggler We want the functionality and event sensitivity of a Bean to be available in any context. KEY CONCEPT Design Goal At: Reusability Introduction Example Component PartsUML Notation 16/26

17 SWE 316: Software Design and Architecture The Parts of a Component  Properties  Methods  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 10.3 Referred as PME model Properties/Methods/Events IntroductionExample Component Parts UML Notation 17/26

18 SWE 316: Software Design and Architecture 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 properties, functionality, sensitivity to events, a manifest listing its files, and an interface providing a self-description. KEY CONCEPT The Aspects of a Component IntroductionExample Component Parts UML Notation 18/26

19 SWE 316: Software Design and Architecture Introspection Class Name, superclass, super-interfaces, inner classes, fields, constructors, Mmethods FieldName, type ConstructorParameters, exceptions MethodName, parameters, return type, exceptions Runtime Java Information Includes IntroductionExample Component Parts UML Notation 19/26

20 SWE 316: Software Design and Architecture components interfaces supported UML Notation for Components 10.4 IntroductionExampleComponent Parts UML Notation 20/26

21 SWE 316: Software Design and Architecture 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 Phases of a Component’s Lifetime IntroductionExampleComponent Parts UML Notation 21/26

22 SWE 316: Software Design and Architecture 1- Design/ Implementation Phase  Write source code for classes  Ensure that the runtime environment contains library classes required  Conform with required rules, if any (e.g., Java Beans)  Incorporate required non-library classes  Create a manifest listing the component’s parts IntroductionExampleComponent Parts UML Notation 22/26

23 SWE 316: Software Design and Architecture Compiled collection of classes component instance Component environment Storage component Create instanceStore instance 2- Instance Creation Time IntroductionExampleComponent Parts UML Notation 23/26

24 SWE 316: Software Design and Architecture Components Related instances Instance creation and connection Storage 3- Assembly Time IntroductionExampleComponent Parts UML Notation 24/26

25 SWE 316: Software Design and Architecture Compiled classes of the application component Execution environment Storage Complete application 4- Deployment Time Select, design, code source, instantiate, combine instances, deploy in applications, execute. KEY CONCEPT The Lifecycle of a Component IntroductionExampleComponent Parts UML Notation 25/26

26 SWE 316: Software Design and Architecture Summary: Components …  … are software elements used without alteration  … allow the re-use of compiled parts  Interaction via events reduces interdependence  … typically developed in a convenient container  e.g., for visualizing and interconnecting  to free the developer from common tasks  … consist of classes, files etc. and a manifest IntroductionExampleComponent PartsUML Notation 26/26


Download ppt "SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits."

Similar presentations


Ads by Google