Introduction to business component technologies. Component definitions Szyperski: A software...

15
Introduction to Java EE Introduction to business component technologies

description

Context dependencies Component may require security, transaction, logging and other middleware services provided by component container (aka component framework) Component may require other components to be made available (required interface) Business components3

Transcript of Introduction to business component technologies. Component definitions Szyperski: A software...

Page 1: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Introduction to Java EEIntroduction to business component

technologies

Page 2: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Component definitionsSzyperski:

A software component is a unit of composition with contractually specified interfaces and explicit context dependencies only. A software component can be deployed independently and is subject to composition by third parties

D'Souza and Wills: A software component is a coherent package of software artefacts

that can be independently developed and delivered as a unit and that can be composed, unchanged, with other components to build something larger

UML v2.4:A component represents a modular part of a system that

encapsulates its contents and whose manifestation is replaceable within its environment

More definitions:http://en.wikipedia.org/wiki/Software_componentry

Business components 2

Page 3: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Context dependenciesComponent may require security, transaction,

logging and other middleware services provided by component container (aka component framework)

Component may require other components to be made available (required interface)

Business components 3

Page 4: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Problem with these definitionsDefinitions above are correct, but they do not

stress differences between a component and a class:

public class Component implements Interface { ...}

Business components 4

Page 5: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Essential characteristics of a componentComponent Oriented Development in OSGi with Declarative Services, Spring Dynamic Modules andApache iPOJO, Neil Bartlett, Heiko Seeberger, 2009

May provide services to other components and use services from other components

Have a life cycleActive participants in the system

They need middleware services, such as transactions, security, logging, etc.

Characteristic of future component technologies:Aware of and adapt to their environment

Business components 5

Page 6: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Old analogyComponent Oriented Development in OSGi with Declarative Services, Spring Dynamic Modules andApache iPOJO, Neil Bartlett, Heiko Seeberger, 2009

inactive do not

provide/use services

no life-cycle do not adopt to

environment

Business components 6

Page 7: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

New analogyComponent Oriented Development in OSGi with Declarative Services, Spring Dynamic Modules andApache iPOJO, Neil Bartlett, Heiko Seeberger, 2009

Business components 7

Page 8: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

How to distinguish a component from a class?Components cannot live without special environment

called containercontainer instantiates components and controls their life-

cyclecontainer (not programmer!) binds components together

(required interfaces with provided interfaces)container provides services to components

Instances of a component are created by container, never by programmer itself (operator new is prohibited)Conversely, instances of classes are created by

programmer using operator new.Later we will look at components in more details (slides

about modules and components)

Business components 8

Page 9: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Distributed Object Technology – fundamentals for component technologies

Business components 9

Page 10: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Concepts: business logic and middlewareBusiness logic

models real life business objects (such as accounts, loan, and inventories)

prescribes how business objects interact with one anotherenforces the routes and the methods by which business

objects are accessed and updatedis part of functional requirementscreates essential added value that client is willing to pay for.

Middleware - software that provides services to applications beyond those available from the operating systemFor example: transactions, logging, security, messaging, etc.if is mentioned in requirements document then only as part of

non-functional requirements; often is assumed as matter-of-course and not documented at

all. Business components 10

Page 11: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Explicit middlewareMoney transfer between two accounts:

void transfer(Account account1, Account account2, long amount) { 1: Perform a security check 2: Create audit log record 3: Start a transaction 4: Load data from the database 5: account1 -= amount; account2 += amount; 6: Store updated data to the database 7: Commit the transaction}Business logic is intertwined with the logic to call middleware

servicesLowers developer productivity, difficult to write and maintain.

Business components 11

Page 12: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Implicit middlewareProgrammer writes only business logic:

void transfer(Account account1, Account account2, long amount){ account1 -= amount; account2 += amount;}

If middleware services are needed, we declare that, for example, in:XML file,annotations.

Middleware services are called by component container with the help of request interceptor.

Business components 12

Page 13: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Business components 13

Page 14: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Main ConclusionsComponent-based technologies enable us to

separate business logic from middleware servicesProvide means to apply Separation-of-Concerns

principle in practiceClient never communicates with component

instance directly – there always will be intermediary (request interceptor, proxy, etc.)Sometimes even more than one intermediary

Business components 14

Page 15: Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.

Modern business component technologiesEnterprise JavaBeans (EJB)

https://java.net/projects/ejb-spec/ OSGi Enterprise

http://www.osgi.org/download/r5/osgi.enterprise-5.0.0.pdf

CORBA Component Model (CCM)http://www.omg.org/spec/CCM/

Microsoft Application PlatformBook: Microsoft Application Architecture Guide,

2nd Edition Component Guidelines Designing Business Components

Business components 15