[Adium-devl] A thorny design problem

David Smith catfish.man at gmail.com
Mon Nov 10 19:51:16 UTC 2008


	In my ongoing project to get contacts in multiple groups working and  
simplify the implementation of the offline group, I've been attempting  
to make visibility of a contact depend on where it's being displayed,  
rather than being inherent to the contact. With visibility now being  
recalculated on request instead of cached, this is simply a matter of  
changing the visible property to also take a 'container' argument.

	However, this introduces a nasty issue: Part of the visibility logic  
is shared (handling 'always visible', for example) and part isn't  
(handling 'show offline' differs between the offline group and regular  
groups for example). If I duplicate the shared logic it violates Don't  
Repeat Yourself, with all the expected maintenance headaches that  
brings. If I leave the visibility logic in one place and add special  
cases for each type of container, that makes it difficult to extend,  
and violates encapsulation.

	The ideal solution seems to be something like our message filter  
system, where containers can enable/disable/add conditions for  
visibility, but I haven't figured out a good way to do that. Anyone  
have any thoughts on a good solution to this?

							David




More information about the devel mailing list