> restrictions in this regard, and I often find myself using public
> properties in such situations. I just find it hard to justify them
> within development of the framework itself.
When you find yourself using public properties, is that just a matter
of convenience or is there some sort of benefit? For example, are you
trying to save the overhead of calling a method?
Do you draw a distinction between personal code and professional
(non-ZF) code when using accessors?
So far, it seems like I should just be using magic methods to create
accessors, use them in my code so I don't have to search my code for
changes if I decide to wrap a property in business logic, define
non-magic methods when I want to add business logic, and minimize the
need for accessors by assigning as much responsibility to objects as
possible. Does that sound like the best approach for code that I
would be creating for others in a professional capacity?
-Ed
没有评论:
发表评论