模块和界面解耦是App规模成长到一定规模后必须要走的一条路
对于解耦的原理,现在貌似通过消息机制进行相互调用很流行
始终没想明白,通过消息方式解耦,和传统的通过抽象ID(比如一个URL,一个URL对应一个界面)进行调用有什么优势吗?
巴扎黑2017-04-17 13:06:45
怪我咯2017-04-17 13:06:45
Relatively speaking, the scalability and flexibility of messages are better than the traditional abstract ID. Moreover, the logic related to different interfaces can be controlled within the minimum scope, as long as the corresponding observer or consumer is implemented. Avoid sharing of static objects. Moreover, data exchange between different threads is not prone to exceptions.