开发者

Concept of GUI's - Centralized or decentralized

Since a few months I've been learning Erlang, and now it was time to do some basic GUI.

After some quick research I saw there was an interesting library called 'wxi' (based on Fudgets of Haskell) which uses a different ap开发者_高级运维proach on GUI's. No central loop, every widget processes it's own events and handles it's own data.

What do you guys think about this? It looks like it kind of can be efficient in languages such as Erlang, and it's an interesting approach.

William van Doorn


In conventional apps, a process (or thread, if you want to be picky) owns the state of the UI and handles events via a message loop. Since Erlang processes are extremely lightweight, wxi's approach is a very logical and natural extension of the conventional model.

This approach has signification ramifications for UI and app design. For instance, a complex download-manager control that has animation, I/O, etc., can be bundled as a completely independent process (with sub-processes handling its component UI pieces) that interacts with the parent UI through message-passing. Such a control could even crash due to a connection problem or internal bug, and the parent control, acting as a supervisor, would indicate that an error occurred and simply start a new copy of the control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜