Design Strategy Guidelines for Determining Machine System Functionality

This question is for the project. A project takes an electrical system and determines its function programmatically. Now that I am defining a system, I include a significant amount of interaction, which forces the system to configure itself accordingly. Example: a system opens and closes electrical contactors when certain events occur. Since this system is located on an airplane, it relies on air / ground logic and thus includes two different behaviors depending on where they are located.

I give all this explanation to demonstrate the level of difficulty that this application contains. As I continued in my project, I used the use of if / else constructs as a means of extrapolating the correct configurations in this electrical system. However, the deeper I go into coding, the more the if / else constructs are required. I feel like I have reached the point where I am inefficiently programming this system.

For those who have been involved in such projects before, I ask: I follow a well-known path (when it comes to identifying EVERY possible scenario that can happen), and I must continue to persist ... or I can use some other strategies to complete the task determining the behavior of a real system.

At the moment, I have little experience working with delegates, but I wonder if I can use some observers or another "cocoa -ey" to test scripts instead of endless if / else blocks.

+3
source share
2 answers

Since you are trying to simulate a real-world system, I would suggest creating a specific object-oriented design that defines well the is-a and has-a relationships and applies a good old-fashioned object-oriented design and applies it to destroy the real system into a functional decomposition.

, , .

, , ElectricalEvent, , ElectricalContactor GeneralElectricEvent SpecializedElectricEvent, isKindOfClass.

+1

, . , , .

, :

, , .

0

Source: https://habr.com/ru/post/1728703/


All Articles