Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: tony@xxxxxxxxxxxxxxxxxxxxxxxx ("Tony Marston")
- Date: Wed, 10 Oct 2007 00:33:51 +0100
""Nathan Nobbe"" <quickshiftin@xxxxxxxxx> wrote in message
news:7dd2dc0b0710091106n7f6f6c20i4997cd1fc606ffb4@xxxxxxxxxxxxxxxxx
On 10/9/07, Tony Marston <tony@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
""Nathan Nobbe"" <quickshiftin@xxxxxxxxx> wrote in message
news:7dd2dc0b0710091015g7c29be93h671aa51bb125198e@xxxxxxxxxxxxxxxxx
On 10/9/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
Why would I use an interface? :)
because inheritance is not always optimal.
I have never found a prolem when using an interface was the only
solution,
or even ANY kind of solution. The fact that your designs need it speaks
volumes of the problems with your designs.
im not the one whose been defending my designs in this conversation; you
are.
But you are the one who keeps saying that your approach, where all member
variables are hidden, is far superior. I'm just saying that I do share that
opinion.
there are plenty of situations where the interface is the more elegant
approach, thats why its here; and thats why it was added in php5.
There's your problem, then. You are wasting your time trying to implement
fancy design patterns just because design patterns are supposed to be
"cool".
i dont recall reading any suggestions to use design patterns because they
are cool.
But you are the one who pointed out that interfaces are used in design
patterns, therefore they *must* be OK. I am saying that I have never seen
any advantages from using interfaces, and I don't waste my time with design
patterns.
infact the advice ive read is to only use them when they make sense.
My point is that interfaces do not make anysense to me at all. I can access
all my class methods without them, so what benefit do they give?
Loader class, Controller Base class, Front Controller - I have none
of that crap in my code, so I don't encounter the problems you have. When
I
see code like "$this->load->library('email') " I just thank my lucky
stars
that I don't have to maintain it. I think some serious refactoring is
long
overdue.
id have to say code igniter is quite a bit more popular than radicore.
maybe youre the one who has some refactoring to do.
Perhaps you are trying to implement something from another language and
expecting PHP to be just like that other language, which is always a
stupid
mistake. PHP is different, therefore the solution will be different. I
suggest you learn how PHP works and design accordingly, and stop trying
to
force it into emulating another language.
well php has certainly gotten its influence from a number of other
languages.
where do you think the additional features in php5 got their inspiration
from?
Some of those features were implemented just because some a*sholes who are
more familiar with other languages keep saying "I can do so-and-so in
language X, and I want to do exactly the same thing in PHP". Language X has
interfaces, so PHP *must* have interfaces, Why? What purpose do they serve?
What benefits do they bring?
btw;
heres the definition of implement from dictionary.com
im·ple·ment
<https://secure.reference.com/premium/login.html?rd=2&u=http%3A%2F%2Fdictionary.reference.com%2Fbrowse%2Fimplementation>
/n. '?mpl?m?nt; v. '?mpl??m?nt, -m?nt/ Pronunciation Key - Show Spelled
Pronunciation[n. *im*-pl*uh*-m*uh*nt; v. *im*-pl*uh*-ment, -m*uh*nt]
Pronunciation
Key - Show IPA Pronunciation -noun 1.any article used in some activity,
esp.
an instrument, tool, or utensil: agricultural implements.
notice the use of article; ie data; ie; you are wrong about member
variables
not being part of a classes implementation.
if a variable local to a function can be considered part of its
implementation; then a variable local to a class can be
considered part of its implementation; its that simple.
Implementation is still an activity or a procedure. A lawnmower is a tool
which implements lawnmowing, and it acts upon a lawn. However, the lawn is
not part of the implementation, it is the subject of the implementation. An
object may contain both variables and operations, but the data is not part
of those operations, it is the subject of those operations.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
.
- Follow-Ups:
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: "Nathan Nobbe"
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: "Guillaume Theoret"
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- References:
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: Robert Cummings
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: "Nathan Nobbe"
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: Robert Cummings
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: "Nathan Nobbe"
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: Robert Cummings
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: "Nathan Nobbe"
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: Robert Cummings
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: "Nathan Nobbe"
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: "Tony Marston"
- Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- Prev by Date: [PHP] Re: Something you can do with AJAX + PHP as well
- Next by Date: Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- Previous by thread: Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- Next by thread: Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- Index(es):