UBus

UBus

Introduction

Unity consists of many components that are standalone in their architecture (Panel doesn't depend on Launcher or Places, for instance) however actions on one component may well effect another component.

This problem has been historically solved in Unity by having lot's of controller objects listening to signals from the views, as well as a global state object that has a view over the entire system. Although this works, it leads to tangled code where there shouldn't be, and complex tests as to test one component you need to fulfill the interface for the global state, which might require you to create another component.

What we want is to be able to call actions/send signals to other components without having to have hard-coded dependencies between them. What we want is D-Bus inside Unity!

Use case

  • PanelHomeButton wants to show the places when it's clicked. Rather than having something outside of it listening to this signal and then passing it on to the Places view, the button can just send a "Show" event to the Places object. This eases testing considerably too, as we can simulate a mouse-click event on the button and just listen on the message bus that the button tried to call the correct method on the Places. We wouldn't need the Places or anything else running for this.

Architecture

API

Unity/Architecture/UBus (last edited 2010-11-19 14:05:46 by 93-96-182-51)