in reply to Re: InsideOut - even tighter coupling
in thread InsideOut - even tighter coupling

However, good OOP code encapsulates all member variables with accessor/mutators. Great OOP code uses that encapsulation internally. There are few instances where direct access to private members are needed internally. In 9 out of 10 cases using an accessor/mutator internally will suffice. This practice allows your objects to be as flexible with regard to implementation internally as they are to external objects.

The moral of this story. When writing your Class, treat your class as you would an external class. It all comes back to the Golden Rule: Treat others as you want to be treated. hmm... It even works for programming =]

This approach leads to a more flexible Object Model, and when implementations change you will find yourself typing less code.
( Because we all know that programmers are lazy =] )

  • Comment on Re: Re: InsideOut - even tighter coupling

Replies are listed 'Best First'.
Re^3: InsideOut - even tighter coupling
by Aristotle (Chancellor) on Oct 13, 2003 at 17:45 UTC
    This practice allows your objects to be as flexible with regard to implementation internally as they are to external objects.
    Indeed. In particular, it makes a subclass author's life much easier when an object doesn't rely on its own implementation structure any more than absolutely necessary.

    Makeshifts last the longest.