J2EE PET STORE &.NET PET SHOP Yong-Han Lee & Charles Harsch

Preview:

Citation preview

J2EE PET STORE &.NET PET SHOP

Yong-Han Lee & Charles Harsch

Introduction

Project Description

Recapitulation

J2EE Pet Store & .NET Pet Shop Business Model

Purpose of Pet Store & Pet Shop

Illustrate basic usage of J2EE technology and .NET technology

Demonstrate current best practices in system design.

Comparison of J2EE PS and .NET PS

J2EE: platform-independent, JAVA-centric

.NET: Windows-centric and language-neutral

Design goals of J2EE Pet Store and .NET Pet Shop were the same

Almost the same performance

Business Model

PS Business Support System (BSS)(IV)

* PS Customer

* Credit Card service

* Suppliers

* Account

1 ProductCatalog

* Product

Shopping Cart

* Order

*

-owner

*

*

-owner

<<trace>>

<<use>>

1

1

.

Technological Architecture Model

Model of the Sample Applications

Tier Overview Tiered Architecture and used

Technology MVC Patterns Design Patterns Modular Design (for J2EE Pet Store)

Tiered Architecture and used Technology

PS Presentation Tier Business Logic Tier ¡ì PS Data Access Layer ¡í

ASP.NET

C#

ADO.NET¡ì Database ¡í

.NET Objects

Business Entity

C#

C#

.NET Objects

.NET Objects

1

111

Pet Shop multi-tier: Purpose of Tiers

Pet Shop

1111

Presentation Tier Business Logic Tier Data Access Layer (DAL) Business Entity

interact with user,handle simple navigation,manage user session data

Represent the business logicof Pet Shop

Handle the interaction with back enddata stores, including databases,

messaging systems, etc.

Passing data between tiers of theapplication. Refer to business entity

components

Pet Shop: High-Level Logical Architecture

CLR

Pet Shop Business Logic Tier

IIS

Pet Shop DAL

Pet Shop Presentation Tier

ASP.NETWeb Forms

C# Business Components

Data Access Components

*

*

*

General structure of a J2EE multi-tiered application

Technologies used in different tiers and their functionality in J2EE Pet Store

Correspondance of Tiers

Presentation Tier Business Logic Tier Data Access Layer (DAL) Business Entity

Web Tier EJB Tier

.NET

J2EE

Presentation Tier

Components in the Presentation TierComputational Viewpoint – Detail Level 0

Pet Shop Presentation Tier (CV)

User InterfaceComponent

User Interface Component

User Interface Component

User Interface Processing

same

* *

*

*

Pet Shop Business Logic Tier

Pet Shop Presentation Tier: Computational Viewpoint of Components – Level 1

Pet Shop Presentation Tier (CV)

User Interface Component

* *

Process Flow

User Interface Processing

ControlsASP.NET

Files of J2EE Pet Store Web Site Web tier

Middle Tier

Components in the Business Logic TierComputational Viewpoint – Detail Level 0

Data Access Layer

Pet Shop Presentation Tier

Pet Shop Business Logic Tier (CV)

Business Component

Business Component

Business Component

EnterpriseService

EnterpriseService

EnterpriseService

same

same

* * *

* * *

Pet Shop Business Logic Tier: Computational Viewpoint of Components – IT Level

PS Business Logic Tier (CV)

Business Logic Component (CV)

OrderRead.cs Items.cs

OrderInsert.cs Inventory.cs

Account.cs Profile.cs

Cart.cs Product.cs

*

Different enterprise beans in J2EE PS Web Site EJB tier

Implementation of an EJB

ContactInfoEJB

-String familyName-String givenName-Address address-String email-String phone

ContactInfo.java+String getFamilyName()+String setFamilyName()+ContactInfo getData()…...

+Object ejbCreate()+void ejbActivate()+void ejbPassivate()+void ejbRemove()

ContactInfoEJB.java

+String getFamilyName()+String setFamilyName()….

ContactInfoLocal.java

+ContactInfoLocal create()+ContactInfoLocal findByPrimaryKey()

ContactInfoLocalHome.java

EJB in .NET?

Enterprise Services Business Entity

Data Access Layer

Components in the Data Access LayerComputational Viewpoint – Detail Level 0

Pet Shop Business Logic Tier

Data Access Layer (CV)

DAL Component

DAL Component

DAL Component

same

* * *

Pet Shop Data Access Layer: Computational Viewpoint of Components – IT Level

PS DAL Tier (CV)

DAL Component (CV)

DAL Factory (CV) SQL Server DAL (CV)

IDAL (CV) Oracle Server DAL (CV)

SQL Server 2000

Oracle Server

*

Account.cs

Inventory.cs

Item.cs

Order.cs

Product.cs

Profile.cs

IAccount.cs

IInventory.cs

IItem.cs

IOrder.cs

IProduct.cs

IProfile.cs

Account.cs

Inventory.cs

Item.cs

Order.cs

Product.cs

Profile.cs

Account.cs

Inventory.cs

Item.cs

Order.cs

Product.cs

Profile.cs

SQLHelper.cs

OracleHelper.cs

MVC Pattern

Model-View-Controller Pattern

Browser Client

Format Page to display

Determine Page to Display

Manage the behavior and data of the

application domainResponds to requests for information about

its state

Responds to instructions to change

state

Informing MODEL and/or VIEW to change as

appropriate

Interprets mouse and keyboard inputs from user

View

Model

Controller

Model-View-Controller Pattern:« Code behind »

PS Data Access Layer (CV)

PS Business Logic Tier (CV)

PS Business Entity (CV)

Pet Shop Presentation Tier (CV)User Interface Processing

Process Flow (CV)

Controls (CV)

*

*

User Interface Component

Category.aspx

…aspx

Items.aspx

ItemDetails.aspx

EditAccount.aspx

Default.aspx

CreateAccount.aspx

Checkout.aspx

Category.aspx.cs

…aspx.cs

Items.aspx.cs

ItemDetails.aspx.cs

EditAccount.aspx.cs

Default.aspx.cs

CreateAccount.aspx.cs

Checkout.aspx.cs

AccountController.cs

CartController.cs

AddressUI.cs

Banner.cs

Cart.cs

ConfirmAddresses.cs

NavBar.cs

NavBarNoMenu.cs

SignOutNavBar.cs

StaticAddress.cs

Preferences.cs

View Model- Controller

J2EE: Model-View-Controller and corresponding Tiers

Design Patterns

Design Patterns used in J2EE Pet Store Design Patterns used in .NET Pet Shop

Design Patterns used in J2EE Pet Store

In which tiers the Design Patterns are best implemented

Design Patterns and MVC

.NET Design Patterns:Design Patterns used in .NET Pet Shop

1 PS Web Site(CV)

PATTERNS

Intercepting filter Page Cache

Broker

Data Transfer ObjectObserver

Front ControllerPage Controller

.NET Design Patterns:Design Patterns in Tiers

PS Presentation Tier

Business Logic Tier PS Data Access LayerBusiness Entity

11

1

1

Intercepting filter Page Cache

BrokerData Transfer Object

Observer

Front ControllerPage Controller

Model-View-Controller Pattern:Model-Controller separation

PS Data Access Layer (CV)

PS Business Logic Tier (CV)

PS Business Entity (CV)

Pet Shop Presentation Tier (CV)User Interface Processing

Process Flow (CV)

Controls (CV)

*

*

User Interface Component

Category.aspx

…aspx

Items.aspx

ItemDetails.aspx

EditAccount.aspx

Default.aspx

CreateAccount.aspx

Checkout.aspx

Category.aspx.cs

…aspx.cs

Items.aspx.cs

ItemDetails.aspx.cs

EditAccount.aspx.cs

Default.aspx.cs

CreateAccount.aspx.cs

Checkout.aspx.cs

AccountController.cs

CartController.cs

AddressUI.cs

Banner.cs

Cart.cs

ConfirmAddresses.cs

NavBar.cs

NavBarNoMenu.cs

SignOutNavBar.cs

StaticAddress.cs

Preferences.cs

View

Model- Controller

Page Controller

Front Controller

Model-View-Controller Pattern:MVC in Controller Pattern

PS Presentation Tier

User Interface Processing

Controls (CV)

*

AddressUI.ascx.cs

Banner.ascx.cs

Cart.ascx.cs

ConfirmAddresses.ascx.cs

NavBar.ascx.cs

NavBarNoMenu.ascx.cs

SignOutNavBar.ascx.cs

StaticAddress.ascx.cs

Preferences.ascx.cs

Process Flow (CV)

AccountController.cs

CartController.cs

Front ControllerUser Interface Component

AddressUI.ascx

Banner.ascx

Cart.ascx

ConfirmAddresses.ascx

NavBar.ascx

NavBarNoMenu.ascx

SignOutNavBar.ascx

StaticAddress.ascx

Preferences.ascx

Page Controller

Modular Design of J2EE Pet Store

Modular development decouples components from one anotherbenefits: • ease maintenance • simplifies parallel development • provides opportunities for

incorporating third-party components

J2EE Pet Store Modular Design

Implementation of Control Module

Implementation of Catalog Module

Conclusion

Conclusion

No big differences Performance:

.NET a bit better, because efficient caching. .NET PS fewer lines of code, but not

significant. J2EE PS not optimized for performance

Architecture: Both are multi-tiered application with same

functionality .NET uses additional tier, business entity to

track and pass data J2EE uses enterprise beans in EJB tier

Our Website

http://icwww.epfl.ch/~lee/project

Questions?

Thank you for your attention