J2EE Pet Store & .NET Pet Shop
Download
Report
Transcript J2EE Pet Store & .NET Pet Shop
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)
<<use>>
* Account
* Credit Card service
1
-owner
* PS Customer
-owner
1 Product
Catalog
<<trace>>
* Order
*
*
* Product
*
Shopping Cart
1
.
* Suppliers
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
1
1
PS Presentation Tier
1
Business Logic Tier
¡ì PS Data Access Layer ¡í
C#
ADO.NET
¡ì Database ¡í
.NET Objects
.NET Objects
ASP.NET
C#
.NET Objects
1
Business Entity
C#
Pet Shop multi-tier: Purpose of Tiers
Pet Shop
1
Presentation Tier
interact with user,
handle simple navigation,
manage user session data
1
Business Logic Tier
Represent the business logic
of Pet Shop
1
Data Access Layer (DAL)
Handle the interaction with back end
data stores, including databases,
messaging systems, etc.
1
Business Entity
Passing data between tiers of the
application. Refer to business entity
components
Pet Shop: High-Level Logical Architecture
Pet Shop Presentation Tier
*
ASP.NET
Web Forms
IIS
Pet Shop Business Logic Tier
*
C# Business
Components
CLR
Pet Shop DAL
*
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
.NET
Presentation Tier
Web Tier
Business Logic Tier
Data Access Layer (DAL)
EJB Tier
J2EE
Business Entity
Presentation Tier
Components in the Presentation Tier
Computational Viewpoint – Detail Level 0
Pet Shop Presentation Tier (CV)
same
*
User Interface
Component
*
User Interface
Component
*
*
User Interface
Processing
Pet Shop Business Logic Tier
User Interface
Component
Pet Shop Presentation Tier:
Computational Viewpoint of Components – Level 1
Pet Shop Presentation Tier (CV)
*
*
User Interface Component
ASP.NET
User Interface Processing
Process Flow
Controls
Files of J2EE Pet Store Web Site Web tier
Middle Tier
Components in the Business Logic Tier
Computational Viewpoint – Detail Level 0
Pet Shop Presentation Tier
Pet Shop Business Logic Tier (CV)
*
Business
Component
*
Business
Component
*
Business
Component
same
*
Enterprise
Service
*
Enterprise
Service
*
same
Data Access Layer
Enterprise
Service
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
ContactInfo.java
-String familyName
-String givenName
-Address address
-String email
-String phone
ContactInfoEJB.java
ContactInfoLocal.java
ContactInfoLocalHome.java
+String getFamilyName()
+String setFamilyName()
+ContactInfo getData()
…...
+String getFamilyName()
+String setFamilyName()
….
+ContactInfoLocal create()
+ContactInfoLocal findByPrimaryKey()
+Object ejbCreate()
+void ejbActivate()
+void ejbPassivate()
+void ejbRemove()
EJB in .NET?
Enterprise Services
Business Entity
Data Access Layer
Components in the Data Access Layer
Computational Viewpoint – Detail Level 0
Pet Shop Business Logic Tier
Data Access Layer (CV)
*
DAL
Component
*
same
DAL
Component
*
DAL
Component
Pet Shop Data Access Layer:
Computational Viewpoint of Components – IT Level
PS DAL Tier (CV)
*
DAL Component (CV)
DAL Factory (CV)
Account.cs
Order.cs
Inventory.cs
Product.cs
Item.cs
Profile.cs
SQL Server DAL (CV)
Account.cs
Order.cs
Inventory.cs
Product.cs
Item.cs
Profile.cs
SQL Server 2000
SQLHelper.cs
IDAL (CV)
IAccount.cs
IOrder.cs
IInventory.cs
IProduct.cs
IItem.cs
IProfile.cs
Oracle Server DAL (CV)
Account.cs
Order.cs
Inventory.cs
Product.cs
Item.cs
Profile.cs
Oracle Server
OracleHelper.cs
MVC Pattern
Model-View-Controller Pattern
View
Controller
Determine Page to
Display
Interprets mouse and
keyboard inputs from user
Format Page to display
Informing MODEL and/or
VIEW to change as
appropriate
Browser Client
Model
Responds to requests
for information about
its state
Manage the behavior
and data of the
application domain
Responds to
instructions to change
state
Model-View-Controller Pattern:
« Code behind »
Pet Shop Presentation Tier (CV)
*
User Interface Processing
Process Flow (CV)
AccountControll
er.cs
User Interface Component
Category.aspx
Category.aspx.c
s
Checkout.aspx
Checkout.aspx.c
s
CreateAccount.as
px
CreateAccount.as
px.cs
CartController.c
s
*
Controls (CV)
Default.aspx
View
Default.aspx.cs
EditAccount.asp
x
EditAccount.asp
x.cs
ItemDetails.aspx
ItemDetails.aspx
.cs
Items.aspx
Items.aspx.cs
PS Data Access Layer (CV)
AddressUI.cs
Banner.cs
Model-Controller
Cart.cs
ConfirmAddress
es.cs
NavBar.cs
NavBarNoMenu.
cs
SignOutNavBar.
cs
…aspx
…aspx.cs
PS Business Entity (CV)
StaticAddress.c
s
Preferences.cs
PS Business Logic Tier (CV)
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
Page Controller
Front Controller
Observer
Data Transfer Object
Broker
.NET Design Patterns:
Design Patterns in Tiers
1
PS Presentation Tier
Intercepting filter
Page Cache
Page Controller
Front Controller
1
1
1
Business Entity
Data Transfer Object
Observer
Business Logic Tier
PS Data Access Layer
Broker
Model-View-Controller Pattern:
Model-Controller separation
Pet Shop Presentation Tier (CV)
*
Model-Controller
User Interface Component
Category.aspx
Category.aspx.c
s
Checkout.aspx
Checkout.aspx.c
s
CreateAccount.as
px
CreateAccount.as
px.cs
User Interface Processing
Process Flow (CV)
AccountControll
er.cs
Front
Controller
CartController.c
s
*
Controls (CV)
Default.aspx
View
Default.aspx.cs
PS Data Access Layer (CV)
AddressUI.cs
Banner.cs
EditAccount.asp
x
EditAccount.asp
x.cs
ItemDetails.aspx
ItemDetails.aspx
.cs
Items.aspx
Items.aspx.cs
Cart.cs
ConfirmAddress
es.cs
Page
NavBar.cs
Controller
NavBarNoMenu.
cs
SignOutNavBar.
cs
…aspx
PS Business Entity (CV)
…aspx.cs
StaticAddress.c
s
Preferences.cs
PS Business Logic Tier (CV)
Model-View-Controller Pattern:
MVC in Controller Pattern
PS Presentation Tier
User Interface Processing
*
Controls (CV)
AddressUI.ascx
AddressUI.ascx.cs
Banner.ascx
Banner.ascx.cs
Cart.ascx
Cart.ascx.cs
ConfirmAddresses.ascx
ConfirmAddresses.asc
x.cs
Process Flow (CV)
AccountController.cs
User Interface
Component
Page Controller
NavBar.ascx.cs
Front Controller
NavBar.ascx
CartController.cs
NavBarNoMenu.ascx
NavBarNoMenu.ascx.c
s
SignOutNavBar.ascx
SignOutNavBar.ascx.c
s
StaticAddress.ascx
StaticAddress.ascx.cs
Preferences.ascx
Preferences.ascx.cs
Modular Design of J2EE Pet Store
Modular development decouples
components from one another
benefits:
•
•
•
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