Custom components
Advanced topic
As mentioned in Simulating objects section FALL makes use of aggregation. This approach reduces dependencies between defined structures, which simplifies the process of implementing custom components.
Table of contents:
What is aggregation?
The simplest practical explanation goes like this: instead of constructing objects inside other objects, we pass them to their constructor:
rather than:
Custom component example
landingController
is constructed with hoverslamModel
object. Let’s
assume that you came up with an impressive solution that calculates suicide burn
so accurately that FALL hoverslamModel
looks like a silly toy.
All you need to know is that hoverslamModel
implements only one public method
getThrottle
.
First write your genius solution in the form of class:
Now you can construct landingController with your genius solution:
In this case the landingController uses your custom solution to control the throttle, but keeps its way of steering the rocket.
Simplicity of this approach makes it easier to develop new compatible components. Though it’s worth to mention that lack of type checking and inheritance model can be problematic and that’s exactly why I seriously consider actually implementing OOP layer on top of KOS.