You are here: Re: Zip some folders and send by email « PHP Programming Language « IT news, forums, messages
Re: Zip some folders and send by email

Posted by Chung Leong on 11/13/81 11:52

Tim Roberts wrote:
> 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.

In economics there's an idea called "moral hazard," whereby a solution
to a social problem makes it worse because by moderating the negative
consequence it encourages the behaviors that causes the problem in the
first place. I have program in many languages and the only occasions
when I run into name collisions are in languages that have namespace,
notably C#.

> 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.

Will that improve the productivity of a programmer, that's bottom line.
The answer is likely to be no. The cost of living with the potential of
name collision is low and incidental whereas the cost of reduced
visibility is high and is afflicted continually.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация