Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- From: tony@xxxxxxxxxxxxxxxxxxxxxxxx ("Tony Marston")
- Date: Tue, 9 Oct 2007 18:51:00 +0100
""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.
What's the problem that's outlined? I'm too lazy to go and look :|
/**
* CI_BASE - For PHP 4
*
* This file is used only when CodeIgniter is being run under PHP 4.
*
* In order to allow CI to work under PHP 4 we had to make the Loader class
* the parent of the Controller Base class. It's the only way we can
* enable functions like $this->load->library('email') to instantiate
* classes that can then be used within controllers as $this->email->send()
*
* PHP 4 also has trouble referencing the CI super object within
application
* constructors since objects do not exist until the class is fully
* instantiated. Basically PHP 4 sucks...
*
* Since PHP 5 doesn't suffer from this problem so we load one of
* two files based on the version of PHP being run.
*
* @package CodeIgniter
* @subpackage codeigniter
* @category front-controller
* @author Rick Ellis
* @link http://www.codeigniter.com/user_guide/
*/
-nathan
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". 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.
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.
--
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
- References:
- 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
- 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
- Prev by Date: Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
- 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):