-
Couldn't load subscription status.
- Fork 8
Home
Welcome to the Molecule wiki!
Molecule is a component oriented framework for Pharo. His Component architecture approach provide an adapted structuration to graphic user interface (GUI) or another software application wich need Component features.
Molecule provide a way to describe a software application as a components group. Components communicate by use of services, parameters and events propagation. It is a Pharo implementation of the Lightweight Corba Component Model (Lightweight CCM). Molecule support completely transparent class augmentation into component (not necessary to add code manually), based on Traits.
Pharo 8, Pharo 9 and Pharo 10 :
Metacello new
baseline: 'Molecule';
repository: 'github://OpenSmock/Molecule';
load.Deprecated version of Molecule (1.1.x) for Pharo 6 and 7 is also available here.
This section describes Molecule principles.
All components are managed by the ComponentManager object. It maintains the list of component instances currently alive in the system. It is currently handled as a singleton. The ComponentManager class implements an API to instantiate and to remove each component, to associate them, to connect events, etc. This API is used to manage each component life cycle programmatically.
The activity of a component depends on contextual constraints such as the availability of a resource, the physical state of hardware elements, etc. To manage consumed resources accordingly, the life-cycle of a component has four possible states: Initialized, Activated, Passivated and Removed.
After its initialization, a component can switch from an Activated state to a Passivated state and conversely. When the life-cycle of a component is over, then it switches to the Removed state.
Let us details each state of a component life-cycle.
-
When a component is switched to the Initialized state, it is configured through its provided parameters. If a component depends on another component through its interfaces (used services, consumed events or used parameters), these components are associated during this state.
-
The Activated state is the nominal state of a component. When a component is switched to this state, it subscribes to each consumed events that are produced by the components that have been associated with it during the Initialized state. After this subscription step, the component is able to receive and react accordingly to any of its consumed events.
-
When a component is paused, it switches to the Passivated state. Then, the component unsubscribes to its subscribed events and all its required resources are set in waiting mode. As an example, a hardware can be set in its sleeping mode, it can also be asked to free its Graphics Processing Unit memory. The idea behind this state is to avoid consuming resources if not needed, and to be able to switch back as quickly as possible to the Activated state.
-
The terminal state of a component is the Removed state. When a component switches to this state, all of it resources are released. The ComponentManager removes that component from its list of alive components.
Let us illustrate the use of these states with the example of a GUI window handled as a component. First, the window is instantiated by the component. Then the component state switches to Initialized. When the window is displayed on the desktop, the component’s state switches to Activated. When the window is reduced and its icon is stored into a task-bar, then the component switches to the Passivated state. As the window is only reduced, it can be re-opened very quickly. Finally, when the user closes the window. The component is first switched to the Passivated, then to the Removed state.
Notes : This section is currently work in progress.