问题描述
这个新闻组中有很多关于OOP和PHP的帖子。
通常人们只讨论哪种语言比O />更多(或更少)OOP
其他人。 OOP在网络编程环境中的优点很少得到解决。
所以让我提出这个问题:基于OOP原则构建网站
固有的稳定性低于建造的网站"在程序" 不太稳定我的b $ b意味着相同数量的编程工作的稳定性。
我倾向于认为它是真的。采取字符串处理。为了在程序上得到一个
字符串的长度,你做strlen($ s),而在OOP中你会做
$ s->长度()其中$ s是字符串类的实例。现在,如果$ s为null,则在第一种情况下
函数返回零,而在第二种情况下
您的页面会发生灾难性故障。
There has been a number of threads in this newsgroup concerning OOP and PHP.
Usually people just debate on which language is more (or less) OOP than
others. The merit of OOP in the web-programming context is rarely addressed.
So let me pose this question: Are websites built based on OOP principles
inherently less stable than those built "procedurally?" By "less stable" I
mean stability for the same amount of programming effort.
I''m incline to think it''s true. Take string-handling. To get the length of a
string procedurally, you do strlen($s), while in OOP you would do
$s->Length() where $s is an instance of a string class. Now, if $s is null,
in the first case the function just returns zero, whereas in the second case
your page fails catastrophically.
这篇关于OOP导致糟糕的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!