In general, PD recommends creating components for “logical functions”. As an example, please see the below component structure for a milk tanker system. By following this method, you can use a broad range of physical components such as pumps and valves. You can even use a combination of them, without having to change any program code. We have made a demo-project PD_17604-02 that implements the described component structure.
Using methods to reduce the number of program lines
Sometimes you find that a method becomes so large that you find it difficult to read. In that case, you have the option to create methods within the component, that you can call from your “too large” method. An example is a functionality used in many places. Another example is to make a method for each state in a state machine. In the end, remember that you can make a supervisor/servant-connection from one component to another. As a result, you can get access to the methods and data in another component.