Difference between revisions of "Ways that PHP4 sucks for work on non-trivial Object-Orientated problems"
From Nick Jenkins
m (+ cats) |
|||
Line 7: | Line 7: | ||
** Contrast with PHP, where everything is a copy by default. This assumption works well if you are working with simple data types (Strings, numbers, arrays), where you want to manipulate that data. | ** Contrast with PHP, where everything is a copy by default. This assumption works well if you are working with simple data types (Strings, numbers, arrays), where you want to manipulate that data. | ||
** However, the PHP assumption becomes very annoying when working with objects. This is because with objects, you usually want to modify the original object, not a copy of it. | ** However, the PHP assumption becomes very annoying when working with objects. This is because with objects, you usually want to modify the original object, not a copy of it. | ||
− | ** To work around this, you need to use two " | + | ** To work around this, you need to use two " |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Revision as of 17:27, 10 April 2007
Ways that PHP 4 sucks for work on non-trivial Object-Orientated problems.
- No support for 'public', 'private', 'protected' data members or functions.
- Everything is public, so there is no way in PHP 4 to enforce black-box data abstraction.
- Objects are passed as copies by default, not as references by default.
- In Java, everything is an reference by default (apart from simple data types). This assumption works well when you are working with objects by default.
- Contrast with PHP, where everything is a copy by default. This assumption works well if you are working with simple data types (Strings, numbers, arrays), where you want to manipulate that data.
- However, the PHP assumption becomes very annoying when working with objects. This is because with objects, you usually want to modify the original object, not a copy of it.
- To work around this, you need to use two "