Can we consider a design pattern as a tier in j2ee application
Recently i got this question in my interview..
He had asked me about N tier ,I was telling him about 3 tier applications Suddenly he asked me Can i have 5 tiers :) I told him may b开发者_开发技巧e but i never used that..
IV: Ok now tell me what can be the 5 tiers ME: BLa bla
After the interview i asked him for the answer and he gave me a example like below
Web or client layer -> delegate(pattern)Ejb layer(business)->value objects(pattern)-Implemenatation of dao layer-then ur db
He added one more point when your application talks with another application then urs will be N tier application
Is it so friends?
I think he confused tiers with layers.
In an architecture, tiers are the coarsest building blocks, seperating concerns like presentation, business logic and persistence, sometimes even in a physical manner. However, a design can introduce additional layers for reasons like reusability, but that doesn't affect the number of tiers the architecture is made of.
Here is an example (I'm not saying follow it, only hardware vendors and application servers vendors like to sell this monster):
- Client Tier: browser
- Presentation Tier: Servlet/JSP
- Service Tier: Session Beans
- Domain Tier: Entity Beans (writing this makes my eyes bleed).
- EIS Tier: database
Now, to answer your question, a design pattern is certainly not a tier in itself. But a tier can be made of components implementing a pattern (e.g. the Session Beans of the Service Tier implement the Facade pattern).
You can have more than 3 physical tiers, e.g. if you have (1) presentation accessing (2) business logic using (3) web services to wrap (3) legay application which uses a (4) database. But I think like torbengee that it was rather a confusion between logical layer and physical tiers.
精彩评论