[sugar] [PATCH] (partial) AP palette patch

Tomeu Vizoso tomeu
Thu Apr 10 03:31:12 EDT 2008


On Thu, Apr 10, 2008 at 12:53 AM, Eben Eliason <eben.eliason at gmail.com> wrote:
>  >  What do you mean here?
>  >  +            self.props.icon_name = icon_name
>  >  +            # This breaks style guidelines; we should store a reference
>  >  +            self._palette._icon.props.icon_name = icon_name
>
>  I'm accessing the private _icon member of the palette class, rather
>  than keeping a reference to it to use for this purpose.  It was a
>  quick hack.

This is not breaking style guidelines, but encapsulation, which is a
basic concept when designing object-oriented APIs.

Related links:

http://en.wikipedia.org/wiki/Information_hiding
http://en.wikipedia.org/wiki/Separation_of_concerns
http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29
http://en.wikipedia.org/wiki/Coupling_%28computer_science%29

I think we should only push hacks like this to master repositories in
cases of emergency when refactoring is not an option (very close to
release date).

Also, if you have felt the need to do such a thing, means that our API
has a problem somewhere that should be solved ASAP.

Tomeu



More information about the Sugar-devel mailing list