The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes here we go again - design patterns from hell Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "here we go again - design patterns from hell" Watch "here we go again - design patterns from hell" New topic
Author

here we go again - design patterns from hell

Kevin Thompson
Ranch Hand

Joined: May 04, 2001
Posts: 237
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?
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
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.
Terry Wang
Ranch Hand

Joined: Aug 27, 2001
Posts: 102
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.


scjp/jd/wcd/mcad/scea 1
Sanjay Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 148
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.


Sanjay Raghavan<br />SCJP2, SCEA-J2EE<br />Moderator - <a href="http://groups.yahoo.com/group/scea_prep" target="_blank" rel="nofollow">SCEA PREP</a><br />Co-Author - <a href="http://www.whizlabs.com/scea/scea.html" target="_blank" rel="nofollow">SCEA@Whiz</a><br /><i>Where did you sip your Java Today?</i>
Kevin Thompson
Ranch Hand

Joined: May 04, 2001
Posts: 237
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 ]
Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
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.


SCJP, SCJD, SCWCD, SCBCD, SCEA, IBM Certified Enterprise Developer, WebSphere Studio V5.0
Sanjay Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 148
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.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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 ]
AJAY RANA
Ranch Hand

Joined: May 30, 2002
Posts: 75
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
Sondra Colagrossi
Ranch Hand

Joined: Oct 30, 2002
Posts: 68
This is my best doctor phil impersonation.
It's going to be easier to pickup points on patterns than on common architecture.
 
Consider Paul's rocket mass heater.
 
subject: here we go again - design patterns from hell