Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Identify these patterns...

 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A) Implementing the grammar is easy too.
B) simplifies the aggregate interface
C) It promotes consistency among products
D) Sharing of objects
E) Families of related algorithms
F) A choice of implementation
G) Reduced Name space
H) Specifying new objects by varying value
I) Provides hooks for subclass
Regards,
Guru
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a question somewhere in there?
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and do your own homework ...
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gurumurthy,
I suggest you read GoF book.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E) Families of related algorithms,C) It promotes consistency among products
- Abstract factory pattern
 
Ishita Gupta
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
B) Iterator pattern
D) Composite pattern
E) Factory method pattern
F) Chain of resopnsibility
Thanx
- SCJP2
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is E fatory method pattern. It should be abstarct factory method pattern
 
Ishita Gupta
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,
Yes u r right Pradeep, E should be Abstract factory pattern.
But what about the others i mentioned, are'nt they all correct.
In the meanwhile i ll try to figure out what others are.
Thanx
-SCJP2
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A is interpreter pattern.
Book promotions are nice ways to get home work questions done. How I wish Javaranch was there when I was in college.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gurumurthy Ramamurthy:
A) Implementing the grammar is easy too.

Grammar sounds a little bit like Interpreter, but I actually don't grok the description...

B) simplifies the aggregate interface
C) It promotes consistency among products

I don't understand these.

D) Sharing of objects

Could be Flyweight?

E) Families of related algorithms
F) A choice of implementation

Could both be Strategy.
Why do you think E is Abstract Factory???

G) Reduced Name space
H) Specifying new objects by varying value

Again, I don't even get the question.

I) Provides hooks for subclass

Template Method?
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Strategy pattern is very useful for situations where you would like to dynamically swap the algorithms used in an application.
Strategy is intended to provide you with a means to define a family of algorithms, encapsulate each one as an object, and make them interchangeable. Strategy lets the algorithms vary independently from clients that use them.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C) It promotes consistency among products

Cant this be abstract factory?
I understand consistency as using related products together as a family.
I am totally confused.

 
Nambu Lui
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A) Implementing the grammar is easy too. - Interpreter
B) simplifies the aggregate interface - Iterator
C) It promotes consistency among products - Abstract Factory
D) Sharing of objects - Flyweight
E) Families of related algorithms -Strategy
F) A choice of implementation - Strategy
G) Reduced Name space - Singleton
H) Specifying new objects by varying value - Prototype
I) Provides hooks for subclass - Factory method
 
Jan Cumps
Bartender
Posts: 2596
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Nambu java (Namrata Bibodi)", please check your private messages for a JavaRanch administrative matter.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic