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

[cgiapp] Re: ANNOUNCE: CGI::Application::Plugin::LogDispatch


On 2004-12-13, Dan Horne <suppressed> wrote:
>
>     $self->{logger} = get_logger("cms");

This breaks the principle of encapsulation of Object Oriented
Programming. A benefit of objects is that they hide wants inside them. 

Here you are going through a 'back door' rather than using the
advertised interface of methods provided by the C::A object. 

That's why someone else suggested using param() instead, and that's why
people write simple plug-ins which make simple wrappers that add valid
methods to the CGI::App object, extending the objects facade rather than
working around it. 

The issue is as much philosophical as anything. In practice, I don't
think you would run into too many 'gotchas' with this approach. It's
just not considered 'clean' and 'pure'.

The plug-ins themselves actually often break the encapsulation principle
in the same way. The difference is that the user is shielded from this.
If two plug-ins ever caused a conflict because of this, it could be
resolved by changing the plugin's internal code, rather than having to
change user level code in N pllaces. 

    Mark

-- 
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.