if you were god.....

G

grahamo

Hi,


if you were god and were in the position to ask a C++ developer
whether they had a full understanding of design patterns, what would
you ask?



personally,I would ask them this....

1) What are the *benefits* of the builder pattern in the context of
C++?

2) What's the difference between the factory and abstract factory
pattern? Can you give a concrete example thats relevant in the context
of C++?

3) Under what circumstances would you use the decorator pattern? What
are it's benefits over other approaches?

4) give a *concrete* example of where the flyweight pattern outweights
another strategy, again in the context of C++


What would you answer to the above questions?


Can you think of other challenging questions that would engender good
conversation? Again in the context of C++ and design patterns?


maybe this could be considered a revision course wrt design patterns
and C++............





cheers


Graham
 
H

Howard

Well, I don't know about your God, but mine already knows what the developer
does or doesn't know. Perhaps you mean if I were an employer? :)

(I wouldn't ask the questions, personally, because *I* don't have a full
understanding of design patterns, and I can't answer them well myself.)

-Howard
 
U

Unforgiven

grahamo said:
Hi,


if you were god and were in the position to ask a C++ developer
whether they had a full understanding of design patterns, what would
you ask?

Man, I just threw a whole rainforest of handouts out the door from my
Software Engineering class. Now that was wasted paper.
 
M

Mike Wahler

grahamo said:
Hi,


if you were god and were in the position to ask a C++ developer
whether they had a full understanding of design patterns, what would
you ask?

If I were God, I'd have no need for C++ developers.
If I wanted a program, I'd just say, "Let there be code".

"And there was code, and God saw that it was good..."

-Mike
"And then God made bugs." Damn!
 
A

Alf P. Steinbach

* grahamo:
1) What are the *benefits* of the builder pattern in the context of
C++?

I don't know what 'builder pattern' refers to. And I do know a lot
about programming and about C++ in particular. Presumably I've used
that pattern hundreds of times, and since I don't know the name I can
confidently conclude that knowing that name has no advantage whatsoever.

Checking Google...

Okay, it seems the Builder pattern is way to construct objects using a
factory, what I use to call "passing a parts-provider object". The
examples I found were _all_ un-type-safe. However, when used correctly
in C++ it is on the contrary a way to achieve strict type safety when
the construction of a class T needs to have parts where the exact type
of those parts are defined by a class derived from T (of course this is
not how the pattern is described, are pattern-junkies all idiots?).

2) What's the difference between the factory and abstract factory
pattern? Can you give a concrete example thats relevant in the context
of C++?

Nope. Presumably an abstract factory is just an abstract (virtual or
perhaps templated?) factory, or perhaps it's a factory where the known
type of the result is just an interface, whatever. Again, I've used
factories thousands of times, and never needed to think about what
they're called; it's very irrelevant except perhaps to the total newbie,
like inventing different names for integers depending on the usage.

In the context of C++ there are some instances where factories (whether
they're called "abstract factories" or not I don't know) are required,
where they're not absolutely required in some other languages.

One example is the parts-provied object technique outlined above.

3) Under what circumstances would you use the decorator pattern? What
are it's benefits over other approaches?

That it decorates? What's that got to do with C++?


4) give a *concrete* example of where the flyweight pattern outweights
another strategy, again in the context of C++

It's a language-independent pattern, what's C++ got to do with it?
 
A

Alf P. Steinbach

* Alf P. Steinbach:
* grahamo:

...

I apologize _deeply_ for probably answering HOME WORK questions.

Sorry, sorry, sorry.

It's late at night...
 
C

Chris Theis

Alf P. Steinbach said:
* Alf P. Steinbach:

I apologize _deeply_ for probably answering HOME WORK questions.

Sorry, sorry, sorry.

It's late at night...

....and thou shalt be forgiven ;-) I´d really like to see the part with "are
pattern-junkies all idiots?" turning up in either an assignment or an
employment interview *g*.

No seriously, I´m quite glad that there are also others who regard patterns
as something useful but don´t give a damn about the correct naming or
academic description. IMHO things are much overrated and most hullabaloo
about patterns lead to the old problem of management "after all was said and
done, more things were said then really done".

Cheers
Chris
 
T

tom_usenet

No seriously, I´m quite glad that there are also others who regard patterns
as something useful but don´t give a damn about the correct naming or
academic description. IMHO things are much overrated and most hullabaloo
about patterns lead to the old problem of management "after all was said and
done, more things were said then really done".

Having consistently named patterns just makes it easier for developers
to communicate design ideas - it's not rocket science (unless you are
designing software for a rocket, of course).

Tom
 
U

Unforgiven

tom_usenet said:
Having consistently named patterns just makes it easier for developers
to communicate design ideas - it's not rocket science (unless you are
designing software for a rocket, of course).

if( enemy.in_range() )
this->explode();
 
C

Chris Theis

tom_usenet said:
Having consistently named patterns just makes it easier for developers
to communicate design ideas - it's not rocket science (unless you are
designing software for a rocket, of course).



Okay, seriously I agree that consistent naming is important, however I've
heard people arguing if this is the xxx or the yyy pattern that should be
used (although they were in principle equivalent). IMHO patterns are a good
thing but unfortunately they've become a nice keyword for "wanna be
projectmanagers" which they're wielding like a hammer ;-)

Cheers
Chris

P.S.: How come you know that I'm in the top-secret rocket science biz? ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top