Component Based Architecture

26
Component Based Architecture

description

Component Based Architecture. Objectives. Introduce notions of Software Component Discuss Pros and Cons. Introduction. Component-based Architecture used to Divide a problem into sub-problems Each sub-problem is associated with a component Interface plays an important role Motivation - PowerPoint PPT Presentation

Transcript of Component Based Architecture

Page 1: Component Based Architecture

Component Based Architecture

Page 2: Component Based Architecture

Objectives

Introduce notions of Software ComponentDiscuss Pros and Cons

Page 3: Component Based Architecture

IntroductionComponent-based Architecture used to

Divide a problem into sub-problems Each sub-problem is associated with a componentInterface plays an important role

MotivationComponents are highly reusableA component encapsulates the functionality and behaviors of a software element into a reusable and self-deployable binary.Use of COTS or developed in-house componentsIncreases overall reliability

Can greatly reduce development cost

Page 4: Component Based Architecture

Components Important points

A component is a deployable software package that can provide services to its clientIt may require services from other componentsIt remains self-contained and substitutable as long as it interface is unchanged.

Page 5: Component Based Architecture

Components Vs. OO designA component-oriented represents a higher level of abstraction than an equivalent OO design

The component-oriented design defines components and connections between them instead of classes and connections between classes

In component-oriented designFirst identify all components and their interfaces

Advantages over OO designReduced time in marketLower development costs by reuse of the existing components, and increased reliability with reuse of the existing components

Page 6: Component Based Architecture

Component ExamplesMany standard component frameworks

COM/DCOMJavaBeanEJBCORBA.NetWeb ServicesGrid Services

Page 7: Component Based Architecture

What is ComponentA component is a modular (cohesive), deployable (portable), replaceable (plug-and –play), and reusable set of well-defined functionalities that encapsulates its implementation and exports it as a higher-level interface.

Component

• It is called as provided port

• Services the component provides

• Supported Interface

• It is called as required port

• Services the component requires

• Supported Interface

Ports may be connected synchronously or asynchronously or via I/O streams

Page 8: Component Based Architecture

ExampleA UML component can be mapped to any target technology componentExamples:

EBJ Component (.jar file)Java Web Component (.war file)What about MS .Net Component? .dll file

Page 9: Component Based Architecture

Why use components?ReusabilityProductivityComposabilityAdaptibilityScalabilityReliability and many others

Page 10: Component Based Architecture

Component ImplementationUsually consists of a set of class files

Abstract InterfaceConcrete Implementation Classes

Note:Some IDE tools support visualization of components, e.g., VS Studio .Net ToolsetHowever, it does not mean that each component should have such a visual representation

Page 11: Component Based Architecture

Java Example: Java Counter

package counter;

interface Counter { public void setCount(int c); public int getCount(); public void inc();}

Page 12: Component Based Architecture

Java Example: Implementation File

import counter.*;class CouterImpl implements Counter { private int count; public void setCount(int c){ count = c;} public int getCount(){ return count;} public void inc() { count ++; } }

Page 13: Component Based Architecture

Why Interface & Implementation?

Separation of Interface and Implementation allows changeability!

Example 1: CounterImpl1 myCounter = new CounterImpl1();myCounter.inc();

Example 2:CounterImpl2 myCounter = new CounterImpl2();

Page 14: Component Based Architecture

Principles of Component-Based ArchitectureFigure out semantics of connections

Communication semantics important Local: relatively easy Remote: pay attention! many different call semantics

Think about INTERFACE, not the implementation

Page 15: Component Based Architecture

Component Level DesignBefore the design phase, we have

Use case modelingBusiness concept modeling

Use case diagrams Describes user interactions with the system which indicate all

necessary operations of the componentWe can map use case diagram to the provided service interfaces of the first-cut component specification

Page 16: Component Based Architecture

Component Level DesignA collaboration diagram

is an identifiable slice of functionality that describes a meaningful service involving several concepts.

A collaboration diagram the implementation of a use case

For each use case U, there will be a collaboration diagram “encapsulated” in a component C.

Page 17: Component Based Architecture

Component Level DesignUse case component implementation

Page 18: Component Based Architecture

Component Level DesignBusiness concept diagram

Depicts the relationships of the business process entities in the domain

Extract business process entities that can exist independently without any associated dependency on other entities.

Recognize and discover these independent entities as new components.

Page 19: Component Based Architecture

Component Level DesignStarts from Use Case Diagram

May also need business concept diagram

MappingUse case interface providerconceptual classes modules of componentsIf necessary, big components can be further decomposed

Page 20: Component Based Architecture

Example: Doctor Appt. SystemA clinic has dozen family doctorsEach doctor has a schedule with slots of 15 minutespatients can make appointmentpatients can change and cancel appointmentNew patients are welcomedoctor can mark off slotspatients and doctors can display schedules on computer at any time

Page 21: Component Based Architecture

Use Case Diagram

patient

doctor

makeappointment

change or cancelappointment

display appointment

make schedule

Page 22: Component Based Architecture

Business Concepts Diagram

doctor

schedule patient

daily appointment

billing

1

1 1

**

1

1

n

Domain entities and business concept

Page 23: Component Based Architecture

Identification of Components and Types

<<interface>>IDMGT

<< core >>doctor

<< core >>patient

<< Interface >>IPtMGT

<< type >>Schedule

<< type >>daily appointment

1 1

1

*

* *

Assume no class diagram available

Doctor and patients can exist alone without any dependency

The UML notation for interface or core type is << >>

The core type can exist independently

Each core type has management interface

A schedule belongs to doctor and is derived from appointments

Daily appointments are derived from doctor-patient schedule

Derived, so cannot exist independently

Page 24: Component Based Architecture

Component Design

<< comp >>

billing

<< comp >>

<< comp >>

patient management

doctor management

<< comp spec >>

clinic

appointment

system

make appointment

update appointment

update schedule

Page 25: Component Based Architecture

Summary - CBA

Applicable domain Suitable for where the interface contracts between sub-systems are clear.Suitable for loose coupling between the components and many reusable components are availableSuitable for the class library system organization. .NET class library and Java API themselves are built in component architecture

Page 26: Component Based Architecture

Summary - CBABenefits:

Reusability of components: System maintenance and evolution: Independency and flexible connectivity of componentsProductivity Many OO design tools available

Limitations:Sometime it is difficult to find suitable components to reuse.Adaptation of components is always an issue.