If you have ever used a component system for any application or a computer hardware device, you will most likely understand what a component Defaults. These are basically codes that replace default values with the given ones. Default values are usually those that we set during installation or when a program is uninstalled. They do not really provide any value or advantage to users. They can however be easily changed by using component Defaults. This article is going to give you information on how to change these defaults.
A component def has two parts. The first part is a collection of generic values or class definitions that are related to the application or hardware environment. Here is a simple code that returns all the possible combinations with the given class definitions replacing each one on the line by their respective component defaults. Of course, component def definitions inside the collection are uniques.
The second part is another collection of component behaviors that make up the component runtime. These behaviors typically describe component states and it is through these behaviors that the user or developer can create custom component behaviors. When dealing with component runtime, there are two types of behaviors that exist: the user-defined component behaviors and the hardware-defined component behaviors.
User-defined component behaviors are the ones that allow users to define component behaviors that depend on the values that they place on the component attributes. For example, you can easily define component behaviors that update the time according to the configured date times, so that if there are changes made on the component instance, its state should be updated accordingly. Another great example would be updating a component whenever a new file is saved in its local storage. As soon as this file is saved, component behaviors should update their corresponding subcomponents as well.
Hardware-defined behaviors, on the other hand, are only applicable for standard component setups. For example, when designing a game console, component def will not let you define the component behaviors that update game consoles. They depend instead on the system’s capabilities, which are defined by game console manufacturers. If you have chosen to use one particular manufacturer’s game console, then you might find that the other component implementations in your system do not work as expected because of hardware restrictions. To work around such issues, component defects for these components must be rewritten with regard to the specifics of the system’s capabilities.
While there are cases when both types of behaviors may overlap, a specific separation is always required between the two. In most cases, component behaviors will stay consistent between component subcomponents. However, when this situation arises, the behaviors will have to be specified for each component individually. This makes it a lot more complicated to deal with, especially if you want to reuse some behaviors from one component to another component.
To illustrate the difference between component def and component runtime, imagine a component with an On button and an On/Off button. The component runtime can change these buttons in order to trigger different actions, like switching the game mode between Story and Player modes. This is something that would be very difficult to achieve in component-defined code. So when defining your component behaviors, make sure you keep them as simple as possible.
One last thing I’d like to discuss is the difference between component and function-based components. As you may have noticed already, component-defined functions tend to be more tightly bound than their function-based counterparts, leading to more robustness and a shorter lifetime. However, a component that produces output streams can behave more flexibly and be more loosely bound. Due to this, many of the benefits of component-defined behaviors, namely flexibility and maintainability, are negated when dealing with component streams. Keep in mind that any time your application creates or receives a value of any component, it will be transformed into an abstract, function-based component that will be tied to a specific component’s lifecycle, regardless of how you use the component.