> I am working on some code right now that is a maze of
> objects.  Objects that
> call Objects that call Objects and that inherit from more
> objects.

> To me it looks like spaghetti code only instead of a bunch
> of includes it is
> objects.

> The application isn't rocket science but lets say it a
> mid-large
> application.  Are there any type of recommendations for
> things like how many
> objects do you keep drilling down into from a controller
> page.

Nope. The purpose of an object is for it to be a "black box", so if a
calling page creates or references one it should have no idea what is
inside that object -- what other objects it references or inherits
from. This encapsulation means that if you don't like the way the
object is currently constructed, you can change its internal
componentns -- you can add new objects or remove what you perceive to
be redundant objects without affecting the calling page one iota. This
is the reason that you're also not supposed to "reach through" an
object to manipulate one of its internals. Factories and service
locators are sort of an exception because their sole purpose is to
create, maintain and return objects which the factory ultimately
doesn't utilize or care about.

What you're looking at may be well formed OO or it may indeed be
spaghetti if the original author did a bad job of encapsulating his
objects. The real test for non-spaghetti in an OO application is that
each object can be used by another object or calling page without
knowing anything about its internal structure. Beyond that there's a
fair amount of debate about when to create another sub-object.


s. isaac dealey     434.293.6201
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235465
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to