• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Exam Questions: Design Patterns used with EJB

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are at least a couple questions on the exam about what specific design pattern is used with specific features of EJB.
Of course, the answers to these questions are not in the GoF book, as that was published many years before java.
I have all the study books suggested here on this board, I have all the study books suggested by Sun. The ONLY place I have seen regarding this issue is the blueprints(aka "Designing Enterprise Applications with the Java 2 Platform, Enterprise Edition". However, the only pattern it mentions is Model-View-Controller, and that pattern is NOT one of the GoF patterns.
===> So where exactly is the source of information for questions about EJB Design patterns?
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Home interface: factory
Remote interface: proxy
EJBObject: decorator
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Model-View-Controller is from SmallTalk originally. As a means for GUIs seperation. The Model is the data, the View is the GUI, and the controller is the class that know about it all and also handles actions. If you look at the JTable and the JTableModel this closely resembles the MVC pattern.
Some of EJBs design patterns can be found at the
www.theserverside.com
Mark
 
Kevin Thompson
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! But what is the source of information? (If I wanted to prove out the answers that Win Yu provided, where do I go?)
//////////////////////
NOTE: I checked around and these places/links do not go into the three patterns & interfaces that Win Yu mentioned. (Yes, these places talk about J2EE Design patterns, but they are not the patterns included on the J2EE Architect Exam):
The ServerSide.com EJB Patterns Book:
http://www.theserverside.com/books/EJBDesignPatterns/index.jsp
Sun's J2EE Design Patterns:
http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
SUn's BluePrints Design Catalog:
http://java.sun.com/blueprints/patterns/j2ee_patterns/catalog.html
thanks!
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


So where exactly is the source of information for questions about EJB Design patterns?


I do not know of an official source, but you could use the following:
John Wetherbie's study notes
Based on John's notes, I would make the following changes:


Home interface: factory
Remote interface: proxy
EJBObject: decorator


  • EJBHome uses Abstract Factory Pattern for creating ejb objects
  • EJB Object


  • In J2EE technology, The EJB object is a decorator for the bean because the bean�s functionality is expanded to include remote behavior.

  • EJB remote interface


  • The EJB�s remote interface acts as a proxy for the bean. Proxy is also used in RMI.


     
    Win Yu
    Ranch Hand
    Posts: 224
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I copied some EJB patterns from someone's note,only for your reference.
    Patterns in J2EE
    General.
    • Bridge
    Anything that provides a generic interface to a vendor specific product – JDBC, JMS, JNDI, JavaMail.
    • Facade.
    Anything that hides the complexity from the client – InitialContext, Connection, DataSource
    Servlets / JSPs
    • Decorator, Chain Of Responsibility
    – Servlet 2.3 Filter
    • Singleton - ServletContext, only one per application
    JDBC
    • Iterator – ResultSet
    JNDI
    • Iterator - NamingEnumeration, etc.
    • Observer - EventContext.addNamingListener (.., NamingListener);
    EJB
    • Proxy, Facade - Remote interface
    The stub and skeleton combined act as a proxy to a remote EJB object.
    The stub and skeleton combined act as a facade – hides the networking details from the client.
    • Abstract Factory - EJBHome
    A client gets a reference to a home object which implements the EJBHome interface (analogous to
    AbstractFactory). The client uses the home object to create an EJB object which implements EJBHome
    (analogous to AbstractProduct).
    N.B. with EJB the create methods only return a single Product so only one in the family
    It’s tempting to say that the FactoryMethod is used in EJBHome but on balance it doesn’t quite match : the
    container implementation of the EJBObject may defer creation to a subclass but it’s unlikely (create methods
    are different for every EJB); the EJBObject adapts the bean class interface
    • Decorator , Adapter - Remote interface
    The container provides implementations for EJBHome and EJBObject. The implementations apply
    transactions/security to methods before delegating the request to the bean class – e.g. create () checks if the
    role is allowed to execute the method, if so bean.ejbCreate () is executed
    • Facade - Session Facade (a single session bean method manipulates multiple entity beans)
    • Memento - Value Objects, SFSB activation/passivation
    • Command - transaction logging
    • Flyweight - Instance pooling
    A SLSB may contain intrinsic state (e.g. a socket connection). When a client uses a SLSB they pass in
    extrinsic state (e.g. the parameters to the method call). Consequently, a small pool of objects can support a
    large number of clients.
    • Observer - EJB 2.0 MessageDrivenBean
    • Interpreter - EJB 2.0 QL
    • Template Method - EJB 2.0 CMP
    Persistent fields / relationships declared as abstract methods in the bean class. The bean uses the
    abstract/primitive methods in other methods. The container subclasses the bean class and implements the
    abstract methods. When a client references the EJB object, they’re using the container sub-classed version.
    JMS
    • Mediator, Observer - Publish/Subscriber
    The MOM acts as a Mediator between Colleagues, which in this case are the Subject(s) and Observer(s)
    [ April 19, 2002: Message edited by: Win Yu ]
     
    Kevin Thompson
    Ranch Hand
    Posts: 237
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for everyone's time & your posts. I do appreciate your help.
    However, I am exactly where I started.
    The QUESTION: Where exactly is the source of information for questions about Design Patterns applied to EJB?
    The ANSWER: None has been found.
    All of the private/personal sources about EJB/Design patterns have wild descrepancies. I have ALL the study notes ANYBODY has ever posted from this board and other boards). Even in this post there are conflicting views about the Home Interface. One person says Home Interface is Factory. Another person says Home Interface is Abstract Factory. On the other architect forum scea_j2ee on yahoo, they also have conflicting views about what pattern goes with what EJB. One person over there says Home Interface has no design pattern whatsoever.
    How can Sun have 2-3 questions on exam & there is no "official" source of information? (For "offical" I mean some book or some web site from Sun. Or some book that uses Sun's specs/blueprints as content information. All we have at this point is a bunch of very well intended people's conflicting personal opinions.)
    The only answer must be that Sun teaches this in their multi-thousand dollar classes.
    I can't afford to spend thousands of dollars to take Sun's classes. So my exam strategy will have to be => make the best guess based on available conflicting materials.
    This is what makes this exam so hard to study for. The materials are so "nebulous" and difficult to pin down.
     
    Ranch Hand
    Posts: 119
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hello, Kevin,
    One reason you might not be finding what you're looking for is that most people aren't too concerned with what you're asking. If you understand Design Patterns, and you understand EJB, then naturally, you'll understand where EJB uses Design Patterns - no need for a reference on both.
    You're also mistaken that MVC is not a GoF design pattern. It is the Observer pattern! You see, you need to study the GoF book harder.
     
    Kevin Thompson
    Ranch Hand
    Posts: 237
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks. But there IS a need for a reference for both. Note the huge disparities in people's opinions on this board and the other board regarding EJB Design Patterns (in relation to the exam).
    I could memorize & recite every word in the GoF book, and it does little good in answering the "EJB Design Pattern" questions on the exam. EJBs came about many years after that GoF was written.
    All we have on the topic is a whole bunch of very well intended people's personal opinions. (And their opinions don't match). I am just going to take my best guess/opinion on this topic of questions when I take the actual exam.
     
    Bagwan Mehrat
    Ranch Hand
    Posts: 119
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hello, Kevin.
    You don't need to "memorize and recite" the GoF book, only to understand it. If you understand the patterns, and you understand EJB, then it becomes clear where the patterns have been applied in the design of EJB and other J2EE components.
    This is the second time you have mentioned that "EJB's came out many years before GoF", but if you think carefully about what you have said, you'll see that it doesn't matter.
    Nobody is implying that those two subjects had to be developed in tandem somehow for them to relate to one another - they are separate subjects. J2EE naturally builds on design patterns, but you could say that about most any large software effort.
    Facets of EJB's don't use design patterns because some authority has declared that they do. They follow design patterns because that's how they happened to be designed and implemented. And if you understand the design and implementation, then the underlying pattern can be seen.
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Yeah Kevin. I want to join this lets jump on Kevin thread.
    By knowing the design patterns in GOF you will cover all the design pattern questions currently in the Architect exam. MVC is a form of the Observer pattern.
    You can also figure out what pattern EJBObject EJBHome and EJBRemote are using using the GOF book. But it is not written in stone, it is just known.
    As far as design patterns that are of practical use, or made up for EJB designing, you do not need to know them, and you have already said that the serverside sites design patterns are patterns that they have made up after the GOF were made.
    I hope this leads you to a more secure understanding of what everyone here is trying to tell you. You will not find a "Source" as what you are looking for. There doesn't need to be.
    Use the Force Kevin.
    Mark
     
    Kevin Thompson
    Ranch Hand
    Posts: 237
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    OK. I will rephrase this in a way that it can't be debated.
    Statement 1:
    There is at least 1, possibly up to 3 questions on the architect exam that asks for Design Patterns as applied to EJB. For example : What is the design pattern used in EJB Remote Object? What is design pattern used in EJB home interface?
    Statement 2:
    There are different opinions on this board, and also on other boards, as to what the answers to these type of questions are. There are two different opinions in this post alone regarding design pattern used in EJB Home Interface.
     
    Bagwan Mehrat
    Ranch Hand
    Posts: 119
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Yup, those statements can't be debated all right.
    The debate can begin when you understand the subject well enough to tell us who is wrong and who is right, and why!
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Bagwan. LOL
    and Kevin I agree with you 100%
    Remote Interface is always Proxy, thats an RMI thing.
    Home Object is definitely Factory, in that it creates EJB Objects for the client, but could it also be another pattern as well?
    EJB Object on the other hand, I can't quite figure that one out. I mean wouldn't it be different of Session beans versus Entity Beans?
    I think we should all discuss this and come up with a consensus.
    Mark
     
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,
    About EJB object - decorator for bean;expands the functionality of the bean with remote behaviour.
    Alex
     
    Ranch Hand
    Posts: 2713
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    You are right, EJBObject is a Decorator but not because of adding Remote Behavior. Transparently allowing distributed calls would more closely fit the Proxy Pattern. EJBObject is a Decorator because it transparently adds other services such as security and transactioning. Remote Interfaces only add remote behavior and therefore implement the Proxy Pattern.
    The Proxy and Decorator patterns are very similar, they only really differ in their intent. This is the case with many Design Patterns. BTW, MVC is not Observer. MVC typically uses the Observer pattern but it is made up of a number of Design Patterns. MVC would fit into the category of Architectural Patterns. Remember, Design Patterns by the GoF isn't the only book written on the subject. There are many, many more.
     
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Can anybody help me understand how Servlet and JSP are Facade patterns. I can see this stated in the post by Win from some notes.
    Thanks,
    Naresh
     
    Ranch Hand
    Posts: 883
    3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I suspect that we're missing Kevin's point on this.
    The question isn't "what design patterns are used by EJBs", but "what is the official answer" (the one that Sun is looking for on the exam) and where is that answer documented.
    Or, at least, that's the idea I got when I read Kevin's messages.
    As to the answers, I don't know - but if I find out, I'll be sure to post them here.
    Burk
     
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    "You are right, EJBObject is a Decorator but not because of adding Remote Behavior. Transparently allowing distributed calls would more closely fit the Proxy Pattern. EJBObject is a Decorator because it transparently adds other services such as security and transactioning."
    I think you are right in that the intent is the one of a decorator. However, it is usually not implemented as a decorator.
    What about home?
    I would say the intent is that of a Factory method, because obviously:
    - we want to delegate the creation to a subclass
    - we don't want to create related families of products (as with abstract factory).
    JF
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    I suspect that we're missing Kevin's point on this.


    Actually I think we completely get Kevin's point. His point is that we can't find a place that in print states the known standard design patterns that EJBs use. People post different points of views on it, and no where can we find the definitive answer.
    Mark
    Thanks guys
     
    Kevin Thompson
    Ranch Hand
    Posts: 237
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks everyone for the input. Yes, Mark has my point. I am seeking the official answers, because I want to pass the exam.
    The "EJB Design Pattern" questions are what I consider to be "religious questions". They require faith - because as no proof exists. It is like debating "How many angels can sit on the edge of a pin?" Since there is no "source", all of the evidence is "spectral evidence".
    As study strategy for the exam, I think it is fine to spend some time & thought on this, but then best to just go on to study "real" topics & questions, as opposed to being bogged down in the religious doctrine questions.
    To my knowledge, all of the other categories of questions on the architect exam actually have legitimate "source" material.
     
    Chris Mathews
    Ranch Hand
    Posts: 2713
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Actually the book Applied Java Patterns by Stephen A. Stelting and Olav Maassen addresses this topic. The focus of the book is to describe the GoF Design Patterns (plus a few more) from a Java perspective. If you own Design Patterns I can't say this book is entirely necessary because it doesn't offer any new insights. On the plus side, it is a much easier read than Design Patterns. They also have a little blurb on the front cover of the book about covering the Design Patterns objective for the SCEA exam.
    From the back cover:


    Applied Java Patterns also features a section on pattern use in systems built with J2EE and JINI technologies, and coverage of the servlet, JSP, EJB, and JavaSpaces APIs.


    If your interest is solely to find out which Patterns EJB uses for the SCEA exam then I would say this book is a waste of money simply because this topic is covered adequately here. If you are looking for your first Design Patterns book and plan to take the SCEA than I say go ahead and get this one.
    [ April 23, 2002: Message edited by: Chris Mathews ]
     
    Bagwan Mehrat
    Ranch Hand
    Posts: 119
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hello, Mark.
    You said it yourself. There is no official source for this information, because what design pattern a particular EJB feature uses is a question of reasoning. People may come to different conclusions, and each may be valid from a particular point of view.
    Sun seems to be using this particular style of question (i.e. "What design pattern does X use") in order to determine how well people have learned the GoF patterns (and to a lesser extent, the J2EE components). Memorizing what design pattern corresponds to what EJB component has no practical real-life application (unlike studying EJB's and design patterns). In fact, if you think about it, mapping EJB to design patterns is not in itself a worthy area of study. The interest that people have in looking for this kind of dubious "shortcut" is entirely a side-effect of the exam. This is why information is scant, and no official source is available. This is really a niche interest!
     
    Ranch Hand
    Posts: 351
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This has been a great thread.
    Over time I want to create a FAQ that covers this topic. I think there is enough of a brain trust in this forum to come up with a consensus, eventually.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic