Swiz mandates weak encapsulation.
Posted
by Faisal
on Stack Overflow
See other posts from Stack Overflow
or by Faisal
Published on 2010-02-04T20:12:43Z
Indexed on
2010/06/11
5:33 UTC
Read the original article
Hit count: 234
I just started using Swiz, and, it seems like Swiz forces you to create classes with weak encapsulation. Swiz requires all event handlers to be public in order to mediate events.
Assume that component 'A' dispatches a few events, which I want to listen to in component 'B'. Traditionally, I'll just add event listeners on 'A' in 'B' and all the event handlers in 'B' can be kept private. However, if, I am using Swiz, I need to make all the handlers, mediating events, public.
Am I missing something here, is there a way to bypass this problem. I really, don't want to pollute the public interface of my class.
Thanks.
© Stack Overflow or respective owner