android - 下通过消息方式实现界面解耦有什么优势
伊谢尔伦
伊谢尔伦 2017-04-17 13:04:45
0
2
689

模块和界面解耦是App规模成长到一定规模后必须要走的一条路
对于解耦的原理,现在貌似通过消息机制进行相互调用很流行

始终没想明白,通过消息方式解耦,和传统的通过抽象ID(比如一个URL,一个URL对应一个界面)进行调用有什么优势吗?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
巴扎黑
  1. I think it is similar in your case. If an ID can represent an interface or the call of an interface element
  2. ReactiveCocoa has several classic examples. When elements on an interface have multiple dependencies, ReactiveCocoa’s writing method is still very comfortable. For example, when two events are triggered, an interface will be updated. You We need to write a logic to monitor these two IDs
  3. You don’t need to write callbacks, blocks, etc. when doing various asynchronous things. You can use events directly. Please correct me. It’s not that you don’t need to write logic, but this way seems more direct
刘奇

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template