News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jeff Moore's Blog:
Let Your Properties be Properties
May 10, 2007 @ 07:11:45

In a recent post to his blog, Jeff Moore advocates the philosophy that, in your OOP application development, you should "let your properties be properties".

Some times there are some ancillary methods to deal with unsetting, checking for existence, setting via an array, or dealing with references in PHP 4. They can really clutter up the definition of a class. That's not good.

[...] I think the idea is to make the class extensible. But PHP is really ok with just setting new properties on a class. So why not just do this?

He argues that getters and setters in a class are less useful than just setting the property yourself. Using the property name as part of the interface, though (like getting the $obj->foo value with $obj->getFoo) is stil clean enough to be useful.

0 comments voice your opinion now!
properties class oop setter getter object properties class oop setter getter object


blog comments powered by Disqus

Similar Posts

Hasin Hayder's Blog: My book on OOP-PHP5 has been published

International PHP Magazine: Poll Question: What is the Top Mistake That PHP Coders Commit?

Stubbles Blog: My wishlist for PHP6, pt4: static initializers

Evert Pot's Blog: Creating a Gopher server with PHP and InetD

David Goodwin's Blog: Book Review: Object-Orientated Programming with PHP5 (Hasin Hayder, Packt)


Community Events





Don't see your event here?
Let us know!


composer application introduction package laravel update language release security community voicesoftheelephpant symfony library version series opinion framework tool interview podcast

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework