confidential - property of infinet solutions. architecting and designing scalable, multitier systems...

27
Confidential - Property of infiNET Solutions

Post on 20-Dec-2015

243 views

Category:

Documents


2 download

TRANSCRIPT

Confidential - Property of infiNET Solutions

Confidential - Property of infiNET Solutions

Architecting and Designing Scalable, Multitier Systems in J2EE

infiNET Solutions

David R. King – Chief Technology Officer

Yuhong Guo – Senior Software Engineer

Confidential - Property of infiNET Solutions

Agenda

• Our Task

• Software Process

• Multitier Systems Overview

• MVC Design Pattern

• Component Design Pattern

• Putting it Together

• Examples

Confidential - Property of infiNET Solutions

Our Task – The Challenge

• The CEO said:– “Build me on-line payment system for

higher education”

Confidential - Property of infiNET Solutions

Our Task – Business Perspective

• Different user roles

• Multiple merchants on campus

• Campus and department level branding

• Single sign-on

• Various client systems on campus

• Various business rules by institution

Confidential - Property of infiNET Solutions

Our Task – Technology Perspective

• Configurable• Customizable

– Apply custom business rules• Extendable

– Use as a development platform for new functionality

• Scalable• Secure• Rapid deployment• J2EE – The natural choice

Confidential - Property of infiNET Solutions

Software Engineering Process

• Process is critical to a solid system– Solves the business domain problem in a

cost efficient way– Addresses Architecture & Design– Addresses Testing & Quality Assurance– Allows effective and efficient contribution of

team members (1+1 > 2)

– Controls software life-cycle

Confidential - Property of infiNET Solutions

Multitier Systems Overview

• Front-end tier– Resides on end users’ devices

• Middle tier– Web and application servers

• Back-end tier– Databases

Confidential - Property of infiNET Solutions

MVC Design Pattern

Typical MVC pattern for Web

Confidential - Property of infiNET Solutions

MVC Design Pattern (cont’d)

Problem with typical MVC

• Controller logic embedded in servlets– Other UI types cannot reuse controller

Solution

• Separate controller logic from servlets and put into regular Java classes

Confidential - Property of infiNET Solutions

MVC Design Pattern – New Architecture

Confidential - Property of infiNET Solutions

MVC Design Pattern (cont’d)

• Benefits of separating controller logic from servlets– More flexible

• Add new interface component for the new UI

– Code Mobility• Controllers being regular Java classes allows you to

deploy the controllers to different tiers as needed

– Salable• See Code Mobility

Confidential - Property of infiNET Solutions

Component Design Pattern

• Component orientated architecture– Independent module that can be plugged into

system

• Flexibility– Separation of interface from implementation

• Reusability– Loose coupling between components

• Scalability– Functionality at different layers

Confidential - Property of infiNET Solutions

Component Design Pattern (cont’d)

• Business logic layer– Light weight component

• Light view of application data

– Application of dynamic business rules• Ex. Payment amount must be:

– = to some value– >= or <= some value– Minimum amount

– Management of session• Maintain current state• Flow control

Confidential - Property of infiNET Solutions

Component Design Pattern (cont’d)

• User/Service delegation model– User– Service– Service factory– User factory

• Delegation vs. Inheritance

Confidential - Property of infiNET Solutions

Component Design Pattern (cont’d)

• Application logic layer– Heavy weight component– Domain specific rules– Provides definition of relationship between

interfaces

Confidential - Property of infiNET Solutions

Component Design Pattern (cont’d)

• Application Programming Interface (API)

– Access by name• Bootstrap• Mapping

– Factory interface• Abstract Factory• Factory Method

– Domain interface

Confidential - Property of infiNET Solutions

Component Design Pattern (cont’d)

• Service Provider Interface (SPI)– Defines configuration format and

mechanism– Defines relationship between

implementation classes– Defines template method for

implementation

Confidential - Property of infiNET Solutions

Component Design Pattern (cont’d)

• Data Access Layer– Encapsulation of data source– Encapsulation of data access method– DAO interfaces– Value object– Data binding

Confidential - Property of infiNET Solutions

Component Design Pattern (cont’d)

• Implementation– XML based configuration

• Dynamic instantiation• Dynamic relationships• Dynamic meta-data

Confidential - Property of infiNET Solutions

Putting it Together

interface PaymentService {PaymentResult postPayment(…);

}

interface PaymentMethodService {boolean isAddressRequired();

}

interface PaymentResult extends Transaction {String getAccountNumber();

}

interface CreditCardPaymentResult extends PaymentResult;interface ECheckPaymentResult extends PaymentResult;

Confidential - Property of infiNET Solutions

Putting it Together (cont’d)

interface Processor {MetaData getMetaData();Transaction createTransaction(…);

}

class TransactionData {String getAccountNumber();void setAccountNumber(String);

}

interface Transaction {Account getAccount();boolean hasError();

}

Confidential - Property of infiNET Solutions

Putting it Together (cont’d)

abstract class AbstractProcessor implements Processor {concrete Transaction createTransaction(…);abstract Transaction createFrom(TransactionData);void setMetaData(MetaData);void setTransactionDAO(TransactionDAO);

}

class TransactionImpl implements Transaction {TransactionImpl(TransactionData, …);

} interface TransactionDAO {

boolean add(TransactionData);}

Confidential - Property of infiNET Solutions

Putting it Together (cont’d)

<config>

<user type=“student”>

<service>

<interface>PaymentService</interface>

<implementation>MyPaymentService</implementation>

</service>

</user>

</config>

Confidential - Property of infiNET Solutions

Putting it Together (cont’d)

<config>

<processor name=“credit card” className=“MyProcessor”>

<property name=“metaData” value=“…”/>

<data-access className=“OracleDAO”>

<table/>

….

</data-access>

</processor>

</config>

Confidential - Property of infiNET Solutions

Examples

• University of Pittsburgh

• University of Michigan

• University of California – San Diego

Confidential - Property of infiNET Solutions

Questions & Answers

Thank You!

David R. King - [email protected]

Yuhong Guo – [email protected]