Вы находитесь на странице: 1из 13

Introduction

To maintain traffic on popular web sites complex hardware architecture in which


software and data is distributed across many machines is created.

Design Pattern :
A repeatable solution for a commonly occurring software problem

Non- functional Requirements

Performance: large number of users and minimum response time


Modularity : Different pieces running on different boxes, so app has to be modular
Flexibility, Maintainability, Extensibility :
F : change of system
M : new DB vendor, track a bug, change of naming service,
E : adding new features

Software design principles


1. Code to interfaces : polymorphism
2. Separation of concerns and cohesion : one cohesive purpose
3. Hide Complexity : put look up code in separate component
4. Loose coupling :
5. Remote proxy
6. Increase declarative control

How business team(model and controller),


supports web designers when MVC
components are on one JVM.
1. By keeping interfaces to the model components consistent. 2 key interface
points in their design are

a. When the controller first interacts with model.


b. JSP view interacts with the bean it needs.

3 versions of method, in 3 different objects in


RMI

If model components are remote?


1. We need jndi and rmi
2. Now if we put that in controller that would be bad design
3. So we move it to business delegates

4. Now unless these delegates have ServiceLocator they will have duplicate
code for the look up service.
5. So we put all the look up logic in locator and thus increase cohesion for the
business delegates

What are the other java and non-java


registries?
Java : rmi and jinni.But JNDI is easy and powerful.
Non-java : UDDI.
Though the patterns remain the same only code changes across different registries.

Patterns are forever adding new layer of


objects to the architecture. So what common
benefits do patterns provide?
Cohesion : both business delegate and ServiceLocator increase the cohesiveness of
objects they support.
Network Transparency : Adding a layer shields objects from being network aware.
Separation of Concerns : closely related to cohesion is separation of concerns.

Advantage of separation of concerns.


Lets say the address changes then all you need to do is change ServiceLocator and
not so many business delegates.
So separation of concerns adds lot of flexibility and maintainability.

Protecting Web designers JSP from remote


model complexitiy
1. Using Service Locator and Business Delegate Patterns we have protected our
controller from remote model complexitiy
2. Comapare old non-remote and new remote way

3. Using BD and SL we hide the complexity from controller and jsp but we have
2 problems both related to the fact the bean the jsp is dealing with is a stub
to a remote object.
a. All those fine grained network calls are likely to be a big performance
issue.
i. Each EL triggers a network call. So it is a bandwidth/latency
issue
ii. On top of that these calls may cause problems on server. Each
call might lead to a separate transaction and database load(and
possibly store) on the server.

b. The JSP is not the right place for handling exceptions that might occur
if the remote server crashes.
4. Why not the JSP talk to the bean instead of a stub.

a. If its serializable rmi can send it across the network


b. This will result in one big network call and no remote exceptions to
worry about
c. However there may be stale data. Well thats the trade off performance
vs how current the data is.
i. But in a highly dynamic environment where customer is doing
transactions 24/7 you need to show most up-to-date info.

TO
Business service might want its data in a big message. Service creates a serializable
java object with lot of instance variables.

So far business tier design patterns , now web


tier design patterns
Intercepting filter was the first one.

Revisiting MVC

A look at our Controller

Improved Controller

Front Controller

1. Struts is an example of a front controller


2. Its spoc for the app
3. The spoc can be a Servlet or JSP.
4. It handles dispatching the requests to appropriate places
5. Struts is a front controller with all the bells and whistles

Вам также может понравиться