• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

here we go again - design patterns from hell

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I passed XML Cert yesterday, and so today I re-started studying for SCEA Part I. (I have previously taken this exam and I did not pass.)
So here I am again, about 1 hour into studying and I am back to the same old familiar topic that I love with my whole heart ==> "Design Patterns from Hell".
EXAMPLE QUESTION FROM DESIGN PATTERNS FROM HELL:
The home interface of an EJB uses what design pattern?
ANSWER:
Well, the answer varies widely according to the source.
According to book: SCEA Study Guide - by Mark Cade and Simon Roberts, on page 89, the answer to this question is:
FACTORY
According to SCEA WhizLabs Trial Version - question #5, the answer to this question is:
DECORATOR.
According to Study Notes from Pete Morgan (I can't remember where I got these) - section titled "GOF Summary" the answer to this question is:
ABSTRACT FACTORY and also PROXY
According to my own personal study notes(which I could have sworn were accurate on this topic) say that the answer to this question is:
ABSTRACT FACTORY
According to "SCEA Nutshell" PDF Study Notes from Yahoo Groups scea_j2ee study group the answer to this question is:
ABSTRACT FACTORY
So there you have it. A certification exam with answers that are completely debatable. These are sort of like religious questions. It makes me think of a whole bunch of medieval church leaders debating how many angels can sit on the edge of a pin.
My personal exam strategy will have to be this:
I assume that I will miss 100% of all of these "Design Patterns from Hell" questions. I just have to score better on the remaining questions.
What is the point in studying material that has debatable answers?
 
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm thinking of doing the XML test was it hard?
Well the home object you get out of JNDI can talk over an RMI connection. So it's a representative of the ejb container on the client's system. That's where the proxy comes from. Proxy has a meaning outside of software.
Abstract factory, I'll research that.
You and I have discussed this issue before, I believe.
I'm sure I got one of the pattern questions because of my experience coding middleware solutions. It had nothing to do with studying for the exam.
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i "hate" patterns and think 50% of them are bs left for the academics to play with. i like alan williamson's "desgin pattern snobs" in java developer journal (nov/2002)
--------------------------------------------------
According to book: SCEA Study Guide - by Mark Cade and Simon Roberts, on page 89, the answer to this question is:
FACTORY
--------------------------------------------------
i agree with whatever the source (grader) says.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me try to explain...
First let us look at Whizlabs Trial Version Q5:
--------------------------------------------------
5.When remote calls are made on the container provided implementations of the EJBHome and EJBObject, various transactional and security checks are applied before the call is actually passed on to the bean instance.
The Container provided implementations of EJBHome and EJBObject are performing what Design Pattern's task?
Topic: Design Patterns / Difficulty: Intermediate
a.Command
b.Adapter
c.Bridge
d.Decorator
e.Fa�ade
Choice D is correct.
The intent of the Decorator pattern as described by GOF (175) - "Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality." A request intended for a component is routed to the decorator instead. The decorator forwards the request to the component. It may perform pre or post processing tasks before or after forwarding the request. J2EE is filled with examples of the use of design patterns. The container provided implementations of EJBHome and EJBObject decorate bean classes by providing transactional and security functionalities.
Choice A is incorrect because Command is used to encapsulate a request as an object (GOF 233.) Choice B is incorrect because Adapter (GOF 139) converts the interface of a class into another interface clients expect. Choice C is incorrect because Bridge (GOF 151) decouples an abstraction from its implementation so that the two can vary independently and choice E is incorrect because Fa�ade (GOF 185) provides a unified interface to a set of interfaces in a subsystem.
--------------------------------------------------
If you look at the question closely, it is not asking you what creational pattern the home interface of an EJB exemplifies...instead it is asking what pattern best describes the additional tasks the EJBHome and EJBObject objects perform. Clearly it is that of Decorator because it decorates the core business methods with additional functionality.
IMO the answer to your question "The home interface of an EJB uses what design pattern?" is Factory Method. There is a question in the full version of the product which covers this. Unfortunately it is explained with the help of a diagram, and hence I am unable to post that question as it appears exactly...the gist is that each of the concrete implementations of the Home Interfaces (say you have three beans) is used to obtain the reference to a different EJBObject.
I have encountered material that describes this as Abstract Factory, which I personally do not agree with (we are not trying to create a family of related or dependent objects...we're just creating one).
>>According to Study Notes from Pete Morgan (I >>can't remember where I got these) - section >>titled "GOF Summary" the answer to this >>question is:
>>ABSTRACT FACTORY and also PROXY
Whenever you deal with object distribution, you will be dealing with remote proxies (special kind of proxy - refer GoF for more info). I don't think the exam will give you both choices...even if they do, go with Factory.
HTH.
Sanjay.
 
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
Rufus: You are right. You and I have been down this road before. At this point my exam strategy is assume I miss 100% of these types of questions. I am just completely worn out from "number of angels on the top of a pin" discussions.
An: Thanks for the tip about "Design Pattern Snobs" article! It was a hoot!
Sanjay: Thanks. But I have conceded defeat on these "design patterns from hell" questions.
If my exam stratgey works - I will post it here.
I am following Dr. Phil's advice ==> Which is to remove emotionally and physically draining things from our lives.
Design patterns are a huge physical and emotional drain! What a relief it is to be free from them!
[ December 18, 2002: Message edited by: Kevin Thompson ]
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the first choice has to be "Abstract Factory".
The whole purpose of this question is to test if you understand the funstionality of the EJB home interface. It is primarily used to create/delete EJBs, which uses Abstract Factory pattern.
Proxy won't fit for the Home interface, but is perfect for the Remote interface.
 
Sanjay Raghavan
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't give up yet...I have the perfect mdicine for you. In the files section at scea_prep, you will find a document called "Non Software examples of software design patterns". I don't remember who wrote it but that's exactly what you need. A long time back when I used to consider patterns esoteric, this really document helped me out.
Do check it out. If not for the exam, you're going to use patterns heavily in the assignment, not to mention your s/w career.
HTH.
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by An Wang:
i "hate" patterns and think 50% of them are bs left for the academics to play with. i like alan williamson's "desgin pattern snobs" in java developer journal (nov/2002)
--------------------------------------------------
According to book: SCEA Study Guide - by Mark Cade and Simon Roberts, on page 89, the answer to this question is:
FACTORY
--------------------------------------------------
i agree with whatever the source (grader) says.


It sounds like you and Alan have totally missed the point of Design Patterns. Ted Neward gets it, read his article here.
I am not defending the jerks that use Design Patterns to look down on others. I am just saying that since I have become familiar with Design Patterns, designing systems has become easier and more importantly, communicating these designs has become much easier.
[ December 18, 2002: Message edited by: Chris Mathews ]
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sanjay !
I was also confused with design patterns the document in files section at scea_prep "Non Software examples of software design patterns" is really helpful.
Regards,
Ajay Rana
SCJP,SCWCD
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my best doctor phil impersonation.
It's going to be easier to pickup points on patterns than on common architecture.
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic