|
Posted by whosaid on 10/03/27 11:52
In article <ca40b2dtjr2l0cd0e2lcpvmshpu4mq8h9o@4ax.com>, timr@probo.com
says...
> nark <nark.l@home.home.com> wrote:
> >Please forgive a silly question but can you tell me why you made it a
> >"class" rather than a simple set of functions?
>
> It's fascinating that you would ask this question, and I suspect a PHP
> newsgroup is the only one in which the value of encapsulation would be
> questioned.
>
> By defining a class, he is adding only one new name to the namespace,
> instead of a whole set of names that might conflict with functions I
> already have. In addition, it allows him to hide whatever state he might
> need in the class object, instead of again polluting the namespace with
> globals.
>
> I know the PHP philosophy is to plop 100 functions into the global
> namespace where one class name would do, but I suspect PHP programs would
> be easier to read and maintain if the library were reorganized as classes
> instead.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>
Totally the reverse.
By wrapping it in a class he has made the code unnecessarily complex
and obtuse to read making understanding of the function difficult
and the code therefore harder to read and maintain.
The use of classes for small amounts of code such as used by PHP
programmers writing what are not much more than a simple series of
scripts is plain stupid and says more about the ego of the programmer
than anything else.
Anything that actually requires classes should bedone in a real reliable
language not a buggy script language like PHP.
Navigation:
[Reply to this message]
|