473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

if you were god.....

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
Jul 22 '05 #1
10 1330

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
Jul 22 '05 #2
"grahamo" <gr************@hotmail.com> wrote in message
news:79**************************@posting.google.c om...
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.

--
Unforgiven

Jul 22 '05 #3
"grahamo" <gr************@hotmail.com> wrote in message
news:79**************************@posting.google.c om...
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!
Jul 22 '05 #4
* 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: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #5
* Alf P. Steinbach:
* grahamo:

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


...


I apologize _deeply_ for probably answering HOME WORK questions.

Sorry, sorry, sorry.

It's late at night...

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #6

"Alf P. Steinbach" <al***@start.no> wrote in message
news:40****************@news.individual.net...
* Alf P. Steinbach:
* grahamo:

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


...


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
Jul 22 '05 #7
On Thu, 1 Jul 2004 10:01:33 +0200, "Chris Theis"
<Ch*************@nospam.cern.ch> wrote:
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
--
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Jul 22 '05 #8
"tom_usenet" <to********@hotmail.com> wrote in message
news:qv********************************@4ax.com...
On Thu, 1 Jul 2004 10:01:33 +0200, "Chris Theis"
<Ch*************@nospam.cern.ch> wrote:
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).


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

--
Unforgiven

Jul 22 '05 #9
In message <2k************@uni-berlin.de>, Unforgiven
<ja*******@hotmail.com> writes
"tom_usenet" <to********@hotmail.com> wrote in message
news:qv********************************@4ax.com.. .
On Thu, 1 Jul 2004 10:01:33 +0200, "Chris Theis"
<Ch*************@nospam.cern.ch> wrote:
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).


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

That expects the enemy to cooperate ;-)

if (in_range(enemy))
explode();

--
Richard Herring
Jul 22 '05 #10

"tom_usenet" <to********@hotmail.com> schrieb im Newsbeitrag
news:qv********************************@4ax.com...
On Thu, 1 Jul 2004 10:01:33 +0200, "Chris Theis"
<Ch*************@nospam.cern.ch> wrote:
No seriously, I´m quite glad that there are also others who regard patternsas 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 anddone, 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).


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? ;-)
Jul 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

56
by: john bailo | last post by:
I just installed mono from ximian on my redHat 9 workstation and wrote a simple program from the interesting book ado.net in c# by Mahesh Chand. mono is fun ( is there ado for linux ? ...
9
by: rick cameron | last post by:
TimeZone - the only instance you can get is one representing the local time zone DateTime - cannot represent a time before 00:00:00 1 Jan 1 CE What were they thinking? This is a serious question...
0
by: Jim Little | last post by:
In Visual Studio 2003 I was getting a "No files were found to look in" error while doing searches that included the entire solution, a file mask of "*.*" and some text with no special checkboxes...
17
by: Mike Hofer | last post by:
While I'd toyed with C, C++, and Java over the last 20 years or so, my principal language has been BASIC, QBASIC, then Visual Basic, and finally Visual Basic .NET. But lately, I've been using C#...
14
by: JustObserviing TMH MVP | last post by:
I know I'm asking for a flamewar, and I really don't mean to because I love programming in C# and VB.Net almost equally, just as I enjoyed C++ 13 years ago and COBOL and Pascal 4 years before that....
1
by: martigras911 | last post by:
Hi, The WorkOrder folder, which contains two Access files (Work Orders.mdb & Work OrdersEng.mdb) used to be resided in the F:\ server (F:\ACCESS\SHARE\ENG\Work Orders). These two files were...
0
by: U S Contractors Offering Service A Non-profit | last post by:
" Visionary Dreams " " Leaving New york City leaving to go " GOD noes were i Don't "
0
by: 2Barter.net | last post by:
Craig Oral Somerford Founder of said Non-profit given to GOD through faith watch wave to see: On "CLICK" http:// www.2Barter.net 09 mar 2007...
12
by: schoenfeld.one | last post by:
Most people don't know that there were actually 3 buildings which came crashing down on the day of 9/11. The third building, WTC 7, can be seen here ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.