From the seconddocument read about the actors and the use cases. Based on thisexample, START DESIGNING YOUR OWN ENTERPRISE APPLICATION:

•Give a 1p overview of the context and the need for your application

•Give at least 4 use cases, each supported by a user story (3-10 sentences each)

•Groups of 3-4 students OK.

•Read the portion of Lecture Notes 1 not discussed in class, especially theslides about “antipatterns”. Write a half-page description of anotherantipattern, ideally based on your experience. Groups of 3-4 students OK.

•Read from Fowler’s book, chapters 2, 4 and 6 as well as the patterns“Domain Model” (pp.116-124) and “Model-View Controller” (pp.330-332).

Two days before the next lecture email me THREE QUESTIONS aboutthings you didn’t understand. Each student.

EMTM 600, Spring 2011 Val Tannen

Bibliography

Patterns of enterprise application architecture

by Fowler, Addison Wesley 2003.

We use it as a textbook, has some excellent discussions, it’s moregeneral than Java EE.

by Brown, W. et al., Wiley 2001.Fun and excellent as a management companion.

EMTM 600, Spring 2011 Val Tannen

Bibliography

Planning Extreme Programming

by Beck & Fowler, Addison Wesley 2000.

Simple, clear, very useful also as a management companion.

?

Test-driven development: By example

by Beck, Addison Wesley 2002.

Also excellent for the developer. Force your programmers to read it!

Software testing in the real world

by Kit, ACM Press/Addison-Wesley 1995.Not a topic in this course but excellent.

.NET & J2EE Interoperability

by Peltzer. McGraw-Hill 2004

Pretty lame, but the others on this topic are worse…

EMTM 600, Spring 2011 Val Tannen

Enterprise Applications

•Most software development $$$ are spend on enterpriseapplications. Definition (M. Fowler): they focus on the display,manipulation, and storage of large amounts of (often complex)data and support the automation of business processes with thatdata.

Several succesful and popular open-source projects from Apache (another major playerin open-source) are Java-related:

Tomcat

(Java servlet “container” for the Apache Web server)

Struts

(Java servlet implementation framework)

Jakarta-Cactus

(unit testing framework for servlets, EJBs etc)

An open source implementation of Java EE calledJBoss

is now supported by RedHat, the Linux distribution company. JBoss has sproutedHibernate, an opensource object-relational persistence and query “service” for Java.

Another interesting open source implementation of a “portion” of Java EE isSpring,dubbed “lightweight” and supported by a company called Interface 21.

EMTM 600, Spring 2011 Val Tannen

More Open Source

Sun has seeded several open source projects:

GlassFish, an open source development of a Java EE applicationserver

OpenJDK 6/7, open source releases of Java SE (Standard Edition) 6 and7 around which contributing communities have formed. Sun has statedthat eventually the whole Java SDK will become open source. Currentstatus unclear.

Open source projects rely on open specifications of COMPONENTS

EMTM 600, Spring 2011 Val Tannen

Various Definitions of “Component”

1. "A component is a nontrivial, nearly independent, and replaceable part of a systemthat fulfills a clear function in the context of a well-defined architecture. Acomponent conforms to and provides the physical realization of a set of interfaces."(PhilippeKrutchen?, RationalSoftware?)

2. "A runtime software component is a dynamically bindable package of one or moreprograms managed as a unit and accessed through documented interfaces that canbe discovered at runtime." (GartnerGroup?)

3. "A software component is a unit of composition with contextually specifiedinterfaces and explicit context dependencies only. A software componentcan be deployed independently and is subject to third-party composition."(Clemens Szyperski, ComponentSoftware)

4. "A business component represents the software implementation of anautonomous business concept or business process. It consists of thesoftware artifacts necessary to express, implement, and deploy theconcept as a reusable element of a larger business system."(WojtekKozaczynski?, SSA)

From the Portland Pattern Repository

EMTM 600, Spring 2011 Val Tannen

5. "A component is a unit of distributed program structure that encapsulatesreuse by decoupling components from their operating environment."(Steve Crane. Seehttp://www-dse.doc.ic.ac.uk/~np2/pubs.html)

6. "A component is an object in a tuxedo. That is, a piece of software that isdressed to go out and interact with the world."--

MichaelFeathers

7. "Software components enable practical reuse of software parts andamortization of investments over multiple applications. There are otherunits of reuse, such as source code libraries, design, or architectures.Therefore, to be specific, software components are binary units ofindependent production, acquisition, and deployment that interact toform a functioning system." (Clemens Szyperski, ComponentSoftwarePreface)

More Definitions of “Component”

From the Portland Pattern Repository

EMTM 600, Spring 2011 Val Tannen

8. "A component is a physical and replaceable part of a system that conformsto and provides the realization of a set of interfaces...typically representsthe physical packaging of otherwise logical elements, such as classes,interfaces, and collaborations." (GradyBooch, JimRumbaugh, IvarJacobson,The UML User Guide, p. 343)

9. "Components are self-contained instances of abstract data types (ADTs)that can be plugged together to form complete applications."(DougSchmidt, How to Make Software Reuse Work for You, Jan. 1999 C++Report, p. 51)

Even More Definitions of “Component”

From the Portland Pattern Repository

EMTM 600, Spring 2011 Val Tannen

I asked EMTM 600 students which one they prefer!

The students liked the following definitions:

•#4-

5 votes

•#8

-

4.5 votes

•#7-

2.5 votes

•#6 and # 2-

2 votes eachWhich one do YOU prefer?

Email me!

The explanation for the half-votes is that one student liked half of #7 and half of #8,thus producing the following:

“A component is a physical and replaceable part of a system that conforms to andprovides the realization of a set of interfaces. It typically represents the physicalpackaging of otherwise logical elements, such as classes, interfaces, andcollaborations. To be specific, software components are binary units of independentproduction, acquisition, and deployment that interact to form a functioning system”

EMTM 600, Spring 2011 Val Tannen

Favorite definitions for “Component”

Another student liked #7 but found a related definition by Bachmann in an article athttp://www.sei.cmu.edu:

“A component is (1) an opaque implementation of[known!]

functionality, (2)subject to third-party composition, and (3) conformant with a component model[such as Java EE!]”.

Yet another student preferred to formulate his own:

“Asystemis an assemblage of related subsystems, components and elements,which work together to enable the flow of information.

A system can be definedas any assemblage which accepts an input, processes it, and produces andoutput. Starting at the lowest building block level, an element is a self containedpackage of code whose size and complexity is arbitrary. The only constraint isthat is serves no real function in isolation. A component is an assemblage ofelements that

are assembled such that they do serve a specific, well definedfunctionwithinthe system.

Components

are defined

not only by the elementsthat

the component comprises, but by the characteristics of

the component attheir interfaces. Components are

assembled

into a system, such that the systemserves a well defined

business need.”

Finally, one of the students found his favorite definition atwww.sabc.co.za/manual/ibm/9agloss.htm

“A reusable object or program that performs a specific function and is designedto work with other components and applications.”

EMTM 600, Spring 2011 Val Tannen

Acomponent framework

defines a set ofabstract interactions

that define theprotocols

by which components cooperate--

each component takes onroles in various abstract interactions.

The component framework also defines thepackaging

for components so thatthey can be instantiated and composed into legal configurations.

the number of components on a silicon integrated chipdoubles every year.)

Obviously, it’s not the same kind of component! An IC component has muchsimpler (and easier to specify in excruciating detail) interfaces than a softwarecomponent. But there is a similarity: the key to reuse is modularity through well-defined interfaces:

Are Components Reusable?

Component B1

Component B2

Component A2

Component A1

swap (different versions)

swap (different vendors)

interface

or

or

EMTM 600, Spring 2011 Val Tannen

Component frameworks such as Java EE promote more reuse because they are structuredaroundmany

Defines and manipulates objects that capture the business “logic” orbusiness abstractions. Can be implemented throughsession

EJBs or justplain objects. Key to the robustness of the implementation (thinkchanges!)

EMTM 600, Spring 2011 Val Tannen

Five Layers, cont’d

Data Mapping (aka Persistence) Layer

Separates the domain layer from details of the data sources: where thedata is, what needs to be made persistent, where and how. Can beimplemented throughentity

EJBs.

Data Source Layer

Access to EIS, often RDBMS but sometimes legacy. Uses J2EEstandards such as JDBC for relational sources, JMS for asynchronousaccess to sources with messaging capabilities, and J2C (Connector) forsynchronous access when available. More recently, in the context ofEnterprise Application Integration (EAI) and Service OrientedArchitectures (SOA), this layer also handles access to external WebServices.

Attach additional responsibilities to an object dynamically.Decorators provide a flexible alternative to subclassing for

extending functionality.

From “Design patterns” by Gamma et al.,AddisonWesley 1995

EMTM 600, Spring 2011 Val Tannen

Examples(3)

Structural Patterns (cont’d)

FacadeProvide a unified interface to a set of interfaces in a

subsystem. Facade defines a higher-level interface that makes the

subsystem easier to use.

Flyweight

Use sharing to support large numbers of fine-grained

objects efficiently.

Proxy

Provide a surrogate or placeholder for another object to

control access to it.

From “Design patterns” by Gamma et al.,AddisonWesley 1995

EMTM 600, Spring 2011 Val Tannen

Examples(4)

Behavioral Patterns

Chain of Responsibility

Avoid coupling the sender of a request to itsreceiver by giving more than one object a chance to handle therequest. Chain the receiving objects and pass the request along thechain until an object handles it.

Command

Encapsulate a request as an object, thereby letting youparameterize clients with different requests, queue or log requests, andsupport undoable operations.

Interpreter

Given a language, define a representation for itsgrammar along with an interpreter that uses the representation tointerpret sentences in the language.

Iterator

Provide a way to access the elements of an aggregate objectsequentially without exposing its underlying representation.

From “Design patterns” by Gamma et al.,AddisonWesley 1995

EMTM 600, Spring 2011 Val Tannen

Examples(5)

Behavioral Patterns (cont’d)

Mediator

Define an object that encapsulates how a set of objectsinteract. Mediator promotes loose coupling by keeping objects fromreferring to each other explicitly, and it lets you vary their interactionindependently.

Memento

Without violating encapsulation, capture and externalize anobject's internal state so that the object can be restored to this statelater.

Observer

Define a one-to-many dependency between objects so thatwhen one object changes state, all its dependents are notified andupdated automatically.

StateAllow an object to alter its behavior when its internal statechanges. The object will appear to change its class.

From “Design patterns” by Gamma et al.,AddisonWesley 1995

EMTM 600, Spring 2011 Val Tannen

Examples(6)

Behavioral Patterns (cont’d)

Strategy

Define a family of algorithms, encapsulate each one, andmake them interchangeable. Strategy lets the algorithm varyindependently from clients that use it.

Template Method

Define the skeleton of an algorithm in anoperation, deferring some steps to subclasses. Template Method letssubclasses redefine certain steps of an algorithm without changing thealgorithm's structure.

Visitor

Represent an operation to be performed on the elements of anobject structure. Visitor lets you define a new operation withoutchanging the classes of the elements on which it operates.

From “Design patterns” by Gamma et al.,AddisonWesley 1995

EMTM 600, Spring 2011 Val Tannen

Example: Abstract Factory

This is acreational

pattern. We used this idea with theListSpec

interface for mutable lists.

Context:Working with multiple standards.

Problem:To provide an interface for creating families of related or dependentobjects without specifying their concrete classes.

Solution:Group creation methods in an abstract factory class (in Java probably anabstract class or an interface). Extend/implement this with concrete classesthat follow each standard. Write generic code using the abstract factorymethods to create needed objects. This code could also be in abstract classes,leaving abstract the use of the factory. Then specialize this code for a specificstandard by implementing the factory with a concrete factory.

EMTM 600, Spring 2011 Val Tannen

Example: Adapter

This is astructural

pattern. It is also calledWrapper

(the Java

wrapper classes are adapters for the primitive types). We can use

it, for example, to implement stacks, queues and even priority

queues (as we did!) using ranked sequences.

Context:

Many!

Problem:Classes that need to work together cannot because of incompatibleinterfaces. Therefore we need to convert the interface of a class into anotherinterface clients expect.

Solution:

We can make the “adaptee” a subclass of the target (as we did withpriority queues and ranked sequences) but some do not consider this gooddesign. Instead they recommend that the adaptee have a private field referingto a target object (more like “wrapping”).

EMTM 600, Spring 2011 Val Tannen

Example: Iterator

This is abehavioral

pattern. The JavaEnumeration

is an

approximate example (the methods are a little different).

Context:

Working with collections of objects.

Problem:

Access the objects in a collection sequentially without exposing the underlyingrepresentation of the collection.

Solution:

We build the iterators as objects associated with the collections, having access totheir representation. (In Java this suggest strongly using inner classes.) The state of aniterator is given by a “cursor” referring to the current element of the collection. Iteratorsshould have an advance method, a method to access the current element, a method totest if the whole collection was traversed, and a method to restart the traversal. Multipleiterators on the same collection are useful. Also useful is starting an iterator at someelement referred to by another iterator.