Re: If design patterns are not supposed to produce reusable code then why use them?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/12/30 Tony Marston <tony@xxxxxxxxxxxxxxxxxxxxxxxx>:
> I have recently been engaged in an argument via email with someone who
> criticises my low opinion of design patterns (refer to
> http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that
> design patterns are merely a convention and not a reusable component. My
> argument is that something called a pattern is supposed to have a recurring
> theme, some element of reusability, so that all subsequent implementations
> of a pattern should require less effort than the first implementation. If
> design patterns do not provide any reusable code then what is the point of
> using them?
>
>
>
> I do not use design patterns as I consider them to be the wrong level of
> abstraction. I am in the business of designing and developing entire
> applications which comprise of numerous application transactions, so I much
> prefer to use transaction patterns (refer to
> http://www.tonymarston.net/php-mysql/design-patterns-are-dead.html and
> http://www.tonymarston.net/php-mysql/transaction-patterns.html ) as these
> provide large amounts of reusable code and are therefore a significant aid
> to programmer productivity.
>
>
>
> What is your opinion? Are design patterns supposed to provide reusable code
> or not? If not, and each implementation of a pattern takes just as much time
> as the first, then where are the productivity gains from using design
> patterns?
>
>
> --
> Tony Marston
> http://www.tonymarston.net
> http://www.radicore.org
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Hello Tony and everyone else (is it too late to say Happy New Year and
back to work?).

I think there seems to be a bit of a chicken and egg issue with your
comments of design patterns.

Design patterns are not blue-sky, out-of-the-box, (insert some other
marketing-speak here) concepts.

They are standardized descriptions of the purpose of code commonly seem.

They are not blocks of code to be reused.

They are nothing to do with code reuse per se.

They are to show you that the there are ways of standardizing your
approach to a problem based upon others experience. They are there to
act as templates for how you should be thinking.

Do they make you a better programmer? That depends. Do you have to
play with others? Is it easier to say we use the MVC, Active Record,
Registry and Factory Patterns? If the other members of your team do
NOT know these terms, then it is easy enough to read about them and
learn what they are for and then see how they've been implemented.
They give a common base.

Consider the alternative. I used to work on ICL System 25 running dmfx
with a 4GL style language which was converted to C before compilation
(and for the life of me I can't remember its name - it was over 20
years ago!).

The code I had to maintain was written by developers who used to write
in assembler macros. That whole argument about goto in modern
languages ... well, let's just say that THAT argument certainly didn't
exist for them.

The name that I heard for this style of coding was called "ladder
logic". No structure or common style that a newbie like me could see.

New programs were bastardised from old programs. Not cleanly, just
cobbled and a few goto's thrown in to bypass the unrequired bits. Why?
Cause only the original programmer knew what was going on and they'd
died a decade ago. Literally!

Jump forward through procedural and OOP and maybe AOP.

We all learn from the previous generation ("standing on the shoulders
of giants"). So. If they'd used design patterns back when I started
out, I'd've been able to understand the code better and faster.

I'd probably take just as long to write it, but I'd've been able to
describe it clearer and easier.

Design patterns are tools to help solve a problem. The solution MAY
involve some coding.

If you follow a design pattern, then others will be able to follow your code.

Design patterns are for community development. And probably for the
non-developer interviewers who want to see if the dweeb sat in front
of them knows his (reading from script) "Active Record" from his
(reading from script again) "Active Record" (No, sorry, just said
that, ...) "MVC" (wasn't that a chain of music shops in the UK?)...

Having said that, a real programmer only knows not to use Pascal!
Pretty much everything else is up for grabs.

Regards,

Richard.

P.S. I know nothing.

-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux