unit 7 patterns and frameworks. key concepts design classes components design architectures ead...

40
Unit 7 Patterns and Frameworks

Upload: silvia-robertson

Post on 31-Dec-2015

228 views

Category:

Documents


0 download

TRANSCRIPT

Unit 7

Patterns and Frameworks

Key ConceptsDesign classesComponentsDesign architecturesEADPatternsPackagesFrameworks

What Is a Design Element?Design Class – an enhanced version of

an analysis class that includes details regarding attributes and methods, including visibility, arguments, and data types.

Component – a replaceable part of a system that provides a clearly defined function through a set of interfaces.

What Is a Design Architecture?An overall blueprint of the design of a

system.Goal of design architecture – ability to

scale and evolve over time.Enterprise Application Design (EAD)

– the process of designing applications that embrace change.

Patterns OverviewA pattern is an abstraction.A pattern represents a proven way to solve

a problem.A pattern applies to multiple pieces of

software, not one specific solution.A pattern allows you to leverage existing

designsA pattern provides a way for designers to

communicate.

What is a Pattern?Context: a situation in which the problem

occurs.Problem: the recurring problem.Solution: a proven way to resolve the

problem.

Types of PatternsArchitecture pattern

Describes the architecture of a systemDesign pattern

More narrow in scopeApplies to a subsystemNot language-specific

IdiomNarrow in scopeApplies to only a specific programming

language

12-8

What Is a Tiered (or Layered) Architecture?

The partitioning of a system into layers such that each layer performs a specific type of functionality and communicates with the layers that adjoin it.

OptionsSingle-tierTwo-tierThree-tierN-tier

Single-Tier ArchitecturesOne computer performing all tasks

Either a standalone PC, or a mainframe servicing many dumb terminals

Rare for new systems, not very scalable

Also called "monolithic"

Two-Tier ArchitecturesClient-Server architecture

Client – Application layer (front-end), performs business rules and user interface

Server – Database layer (back end), provides data access

Middleware – the communication interface between client and server

What Is Middleware?Software that provides one set of interfaces

for connection to a client and another set of interfaces for connection to a server, thereby providing the possibility of connections between one of several clients with one of several servers.

Limitations of Client-Server ArchitecturesThick clients – heavy burden placed on

each client machine

Application changes need to be distributed to many clients

Typically use proprietary technologies, hindering application integration

Three-Tier ArchitecturesThree layers are:

Presentation – front tier, providing user interface, perhaps with formatting and constraint-checking rules

Business rules – middle tier, addressing logic and decisions for the system, sometimes called application layer

Data – back tier, addressing data storage and access, with some rules regarding data integrity

Note: presentation, business logic, and or data can be spread across multiple layers, creating N-tier architectures.

Presentation, business logic, and or data can be spread across multiple layers, creating N-tier architectures.

Mapping from Analysis to Design Classes1 Analysis Class 1 Design Class1 Analysis Class n Design Classes n Analysis Classes 1 Design Classn Analysis Classes 1 Package n Analysis Classes 1 Component

What is a Software Component?A software element with a well-defined

interface and functionality for a specific purpose that can be deployed in a variety of applications using plug-and-play capability

Usually purchased from a third party

Characteristics of ComponentsUsed for specific commonly used purposeCollection of classes and interfacesHidden implementation detailsPlug-and-play capabilityUsually distributed in binary, executable formThird-party developedReusable in many applicationsWell-tested and relatively error-freeWritten in any language that supports

component standard’s interface conventions

Component TerminologyRun-time Environment – classes and

components required to support services like handling secure transactions during run-time

Transaction – all-or-nothing unit of business work. Requires ACID:AtomicityConsistencyIsolationDurability

What Is a Component Standard?An agreed-upon format for defining interfaces

and implementations of components

Examples:Microsoft COM/COM+/DCOMOMG’s CORBASun Microsystem’s Enterprise Java Beans (EJB)Database Middleware Standards (ODBC, ADO,

JDBC)XML/SOAP

COM/COM+/Distributed COM (DCOM)Component Object Model (COM) from

Microsoft

Run-time environment for middle-tier components

Supports transactions, identity, and security services, and allows components to call each other locally or remotely through a messaging service

CORBACommon Object Request Broker ArchitecturePublished by Object Management Group

(OMG)Component standard for distributed and

heterogeneous networkObjects written in different languages

communicate through Interface Definition Language (IDL)

Interface is managed by Object Request Brokers (ORBs)

EJBEnterprise Java Beans

Component-based distributed computing architecture

EJB is a server-side component model for managing objects in a distributed environment

EJB requires CORBA for communications

Database Middleware StandardsMicrosoft’s ODBC – Open Database

ConnectivityMicrosoft's OleDb Microsoft’s ADO – ActiveX Data ObjectsSun’s JDBC – Java Database Connectivity

Comparison of OMG, Microsoft, and Sun

Limitations:1. Tightly coupled2. Binary 3. Proprietary

XML and SOAPText-based, loosely coupled, non-proprietary

internet-oriented standard for inter-layer communication

eXtensible Markup Language (XML) – method for putting structured data into text format, similar to HTML

Simple Object Access Protocol (SOAP) – XML-based protocol for exchanging messages between applications operating in different layers

What Is a Framework? A collection of components, consisting of

code and interfaces written in a specific language, that solves or helps build applications.

Two main competitors:• Microsoft .NET• Sun Java 2 Enterprise Edition (J2EE)

12-29

Microsoft .NETDevelopment framework for B2C

applications, with support for XML/SOAP Web services for B2B applicationsLarge library of extensible objectsInteroperability with ActiveX – OLE/COM

based component ADO, ADO .NET – database middlewareASP, ASP.NET – dynamic HTML generationEnterprise Services – Library for developing

Enterprise applications

Features of Microsoft .NET FrameworkVisual Studio .NET – development

environment

C#, Visual C++, and Visual Basic .NET – the three main programming languages for developing .NET applications

Common Language Runtime (CLR) – the runtime environment that loads/executes code, manages memory, provides security, exception handling and interoperability

Sun J2EEJava 2 Enterprise Edition

Development framework that provides a specification of architectural components designed to work together to define a complete enterprise architecture, with support for XML/SOAP and Web services

EJB – Java-based component standardJDBC – database middlewareJava Server Pages, Servlets – dynamic HTML

generation

Features of Java J2EEJava Virtual Machine (JVM) – interpreter for

executing Java compiled code (bytecode)

Remote Method Invocation (RMI) – middleware that allows Java programs running on different computers to access each others’ objects/methods

Applet – Java program that runs in the browser as part of a web page

Servlet – Java program executed on a Web server

Java Server Pages (JSP) – technology that mixed Java and HTML for dynamic web page generation

What is a Package?A general-purpose mechanism for

organizing design elements into groups

Package diagram – a diagram that shows the packages and the relationships between them

Characteristics of PackagesCohesivenessAllocation of resources among

development teamsUser typesPropensity to changeDevelopment phaseSeparate utilities from system-specific

components

In UML, packages are represented as rectangles with tabs in the top left corner. Dependencies between packages are shown with dashed arrow lines.

What Is a Design Class Diagram?A design class diagram shows the data

types of the attributes, the return types and arguments of the operations, and the visibility specifications for all attributes and operations.

Signature – the return type, name, and argument list of a method

Interfaces to classes are based on signatures.

Verifying Responsibility AllocationPattern – a named description of a

problem and solution that can be applied to new contexts

Responsibility assignment in patterns:Information expertise (expert pattern)Object creation (creator pattern)Loose coupling and strong cohesion

VisibilityThe characteristics of an attribute or an

operation that reveal whether it can be accessed directly

Three levels of visibility:Public – visible to any requesting objectPrivate – visible to the owning object onlyProtected – visible to the owning object,

objects of the same class, and objects of subclasses

Attribute TypesIn Design class diagram, attribute types

are explicitly displayed

In the following slide, you see:Visibility of attributes and operationsAttribute typesResponsibilities represented by methodsFull method signatures including return types

and parameters

Visibility is shown by minus signs (private) or plus signs (public)

Attribute types and full signatures are shown