POV-Ray : Newsgroups : povray.off-topic : Design patterns Server Time
7 Sep 2024 11:21:43 EDT (-0400)
  Design patterns (Message 2 to 11 of 11)  
<<< Previous 1 Messages Goto Initial 10 Messages
From: Gail Shaw
Subject: Re: Design patterns
Date: 5 Jul 2008 03:17:00
Message: <486f1fec@news.povray.org>
"Darren New" <dne### [at] sanrrcom> wrote in message
news:486eda2e$1@news.povray.org...
> Is it me, or is the GoF book "Design Patterns" really over-hyped? Every
> time I hear it mentioned, it's along the lines of "wow, isn't it great
> they teach you all these tricks?"  When really, all they're doing is
> naming stuff that everyone does, most of which predates OO programming
> to start with.

I haven't read it, though I have read some other books on patterns, so this
is just my take.

Firstly, having standard names for things makes communication easier. System
designer can just say "I want you to use a Abstract Factory" and in theory
the developer nows exactly what to do.
I've seen patterns described as 'documented good practices'. They're
probably more useful for the average developer than for the gurus because
they show something that does work (if used in the right circumstances)


Post a reply to this message

From: Warp
Subject: Re: Design patterns
Date: 5 Jul 2008 04:40:34
Message: <486f3381@news.povray.org>
There really *are* design patterns which might sound obvious to you
and me, but are not all that obvious to many programmers who are starting
to dig into OOP.

  One example I like (and which name I rather ironically cannot remember
now) is the design pattern which you can use to create primitives and
unions of primitives, so that the union itself is a primitive (thus
allowing a union to contain other unions, containing other unions,
thus forming a whole hierarchy of primitives).

  For example, let's assume that you have three primitives: Line, rectangle
and circle, and you also want to be able to make compound objects containing
any amount of those (so that you can, for example, transform all of them
as if they were one single primitive). Of course it would be nice if such
a compound object could contain other compound objects as well. Thus this
compound object should be a primitive itself.

  Hence the inheritance hierarchy would be something like this:

Primitive
  '--> Line
  '--> Rectangle
  '--> Circle
  '--> Union
         '--Contains: List of <Primitive>

  In other words, if that was drawn as an UML diagram, there would be
a "contains" arrow from 'Union' back to 'Primitive', making the hierarchy
recursive.

  This is a simple idea and might be obvious to some, but it certainly
might not obvious to the new OO programmer.

  The book Design Patterns is full of tidbits like this, making it
potentially quite useful to someone.

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v8
Subject: Re: Design patterns
Date: 5 Jul 2008 05:03:51
Message: <486f38f7$1@news.povray.org>
Warp wrote:
>   There really *are* design patterns which might sound obvious to you
> and me, but are not all that obvious to many programmers who are starting
> to dig into OOP.
> 
>   One example I like (and which name I rather ironically cannot remember
> now) is the design pattern which you can use to create primitives and
> unions of primitives, so that the union itself is a primitive (thus
> allowing a union to contain other unions, containing other unions,
> thus forming a whole hierarchy of primitives).

It's called Container or Composite or something like that. (Also related 
to the Decorator pattern - although that does the same thing for a 
different reason.)

>   This is a simple idea and might be obvious to some, but it certainly
> might not obvious to the new OO programmer.

Many good ideas seem obvious *after* somebody told you. ;-)

For example, (A*B)^2 - 4*(A+B) = (A-B)^2. Obvious once you know, but 
DAMN... I've have never thought of it!

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Gail Shaw
Subject: Re: Design patterns
Date: 5 Jul 2008 05:07:00
Message: <486f39b4@news.povray.org>
"Orchid XP v8" <voi### [at] devnull> wrote in message
news:486f38f7$1@news.povray.org...
>
> Many good ideas seem obvious *after* somebody told you. ;-)

Which is as good a reason as any to make the patterns known. So we don't get
novice programmers who just don't know the tried and trusted ways
reinventing the wheel, usually badly.


Post a reply to this message

From: Paul Fuller
Subject: Re: Design patterns
Date: 5 Jul 2008 07:56:23
Message: <486f6167$1@news.povray.org>
Orchid XP v8 wrote:
> For example, (A*B)^2 - 4*(A+B) = (A-B)^2. Obvious once you know, but 
> DAMN... I've have never thought of it!
> 
Well that is true for some values of A an B - But probably not as many 
as you think.

Whereas (A+B)^2 - 4*(A+B) = (A-B)^2 is true a few more cases.

Unless you have redefined the * and + operators :)


Post a reply to this message

From: Orchid XP v8
Subject: Re: Design patterns
Date: 5 Jul 2008 08:28:48
Message: <486f6900$1@news.povray.org>
>> For example, (A*B)^2 - 4*(A+B) = (A-B)^2. Obvious once you know, but 
>> DAMN... I've have never thought of it!
>>
> Well that is true for some values of A an B - But probably not as many 
> as you think.
> 
> Whereas (A+B)^2 - 4*(A+B) = (A-B)^2 is true a few more cases.
> 
> Unless you have redefined the * and + operators :)

NAAAAARGH!!! >_<

Why must every point I make be compromised by flawed typing?!

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: somebody
Subject: Re: Design patterns
Date: 5 Jul 2008 11:27:09
Message: <486f92cd$1@news.povray.org>
"Paul Fuller" <pgf### [at] optusnetcomau> wrote in message
news:486f6167$1@news.povray.org...
> Orchid XP v8 wrote:

> > For example, (A*B)^2 - 4*(A+B) = (A-B)^2. Obvious once you know, but
> > DAMN... I've have never thought of it!

> Well that is true for some values of A an B - But probably not as many
> as you think.
>
> Whereas (A+B)^2 - 4*(A+B) = (A-B)^2 is true a few more cases.

Still, not true for as many cases as

(A+B)^2 - 4*A*B = (A-B)^2


Post a reply to this message

From: Chambers
Subject: Re: Design patterns
Date: 5 Jul 2008 17:39:10
Message: <486fe9fe$1@news.povray.org>
Warp wrote:
> Primitive
>   '--> Line
>   '--> Rectangle
>   '--> Circle
>   '--> Union
>          '--Contains: List of <Primitive>

I was doing that before I knew what "Design Patterns" were.

>   The book Design Patterns is full of tidbits like this, making it
> potentially quite useful to someone.

Actually, I think it would be extremely beneficial to me, just for the 
standard terminology.  While there are patterns I don't know, more 
important to me is being able to communicate with other people the ideas 
in my head.

...Chambers


Post a reply to this message

From: Chambers
Subject: Re: Design patterns
Date: 5 Jul 2008 17:44:14
Message: <486feb2e@news.povray.org>
Orchid XP v8 wrote:
>>> For example, (A*B)^2 - 4*(A+B) = (A-B)^2. Obvious once you know, but 
>>> DAMN... I've have never thought of it!
>>>
>> Well that is true for some values of A an B - But probably not as many 
>> as you think.
>>
>> Whereas (A+B)^2 - 4*(A+B) = (A-B)^2 is true a few more cases.
>>
>> Unless you have redefined the * and + operators :)
> 
> NAAAAARGH!!! >_<
> 
> Why must every point I make be compromised by flawed typing?!
> 

Because you don't type enough?

I recommend you spend *more* time on these forums, and tell your boss 
you're improving your work skills :)

...Chambers


Post a reply to this message

From: Paul Fuller
Subject: Re: Design patterns
Date: 6 Jul 2008 00:16:52
Message: <48704734@news.povray.org>
somebody wrote:
> "Paul Fuller" <pgf### [at] optusnetcomau> wrote in message
> news:486f6167$1@news.povray.org...
>> Orchid XP v8 wrote:
> 
>>> For example, (A*B)^2 - 4*(A+B) = (A-B)^2. Obvious once you know, but
>>> DAMN... I've have never thought of it!
> 
>> Well that is true for some values of A an B - But probably not as many
>> as you think.
>>
>> Whereas (A+B)^2 - 4*(A+B) = (A-B)^2 is true a few more cases.
> 
> Still, not true for as many cases as
> 
> (A+B)^2 - 4*A*B = (A-B)^2
> 
> 
> 
Now we're on to something.  Give this a few more iterations and we'll be 
proving something worthwhile :)


Post a reply to this message

<<< Previous 1 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.