> >> All that extra code for absolutely no benefit! It is 
> possible to define an
> >> interface (as in API) without actually using the term 
> "interface", so IMHO
> >> the term "interface" is totally redundant and a waste of time.
> >
> > While I agree that Interfaces are mostly a lot of extra 
> code, I have to
> > also say that they are there primarily to enforce a 
> contract between the
> > user of the interface and their classes that claim to implement the
> > interface. If someone creates a class that "Implements" an 
> interface,
> > then when I have to go edit or use the class, it had better 
> damn well
> > implement what it says it does :)
> 
> "enforcing a contract" is a lot of maningless gobbledegook. 
> The simple fact 
> is that it is possible to have an interface without ever 
> using the term 
> "interface". Nothing extra is added by using the term 
> "interface" (except 
> for effort) so there is absolutely no advantage in doing so. 
> That is why I 
> say that the term "interface" is a waste of effort as 
> absolutely nothng is 
> gained.

So if the only real benefit is to be some kind of required template for methods 
in 'extended' classes, why wasn't it "implemented" (excuse the pun) to be 
something like this (with interface as a keyword like abstract is or final or 
static):

class Template 
{
    private $vars = array();

    interface public function setVariable($name, $var)
    {
        $this->vars[$name] = $var;
    }

    interface public function getHtml($template)
    {
        foreach($this->vars as $name => $value) {
            $template = str_replace('{' . $name . '}', $value, $template);
        }

        return $template;
    }

    interface public function notYetCreatedMethod($foo) {}

    interface public function notYetCreatedMethod2($bar) 
    {
        return true;
    }

    public function someNotRequiredMethod ($fee)
    {
        return $fee + $fo;
    }
}

So now it would seem that the four methods are 'required' to be in extension 
classes and can be defined or not defined just like an abstract class right? I 
have to agree with Tony. This whole "interface" business just seems redundant 
and a waste of code.


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

Reply via email to