OOP导致糟糕的网站? [英] OOP leads to lousy websites?

查看:76
本文介绍了OOP导致糟糕的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个新闻组中有很多关于OOP和PHP的帖子。

通常人们只讨论哪种语言比O />更多(或更少)OOP
其他人。 OOP在网络编程环境中的优点很少得到解决。

所以让我提出这个问题:基于OOP原则构建网站

固有的稳定性低于建造的网站"在程序" 不太稳定我的b $ b意味着相同数量的编程工作的稳定性。


我倾向于认为它是真的。采取字符串处理。为了在程序上得到一个

字符串的长度,你做strlen($ s),而在OOP中你会做

$ s->长度()其中$ s是字符串类的实例。现在,如果$ s为null,则在第一种情况下
函数返回零,而在第二种情况下

您的页面会发生灾难性故障。

解决方案

s),在OOP中你会做


s-> Length()其中

s是字符串类的实例。现在,如果


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.

解决方案

s), while in OOP you would do


s->Length() where


s is an instance of a string class. Now, if


这篇关于OOP导致糟糕的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆