Causes and Measures for spaghettifying codes and models

This post discusses the causes and measures for spaghettifying codes and models.

Causes

The cause of spaghettified code and models is that the realization of functional requirements is the design perspective. Therefore, spaghetti code and spaghetti models are created as a result of creating code and models without understanding the architecture and components.

Causes include the following.

  • The priority is to meet functional requirements.
  • No time for design review of non-functional requirements.
    Or no design skills.
  • Lack of time to analyze current state of architecture and components.
    Or lack of architecture or component specifications.

Measures

Functional requirement specification measures

It is recommended that measures for functional requirement specifications take software specifications into account.

Example: Describe functional requirements by function = component as shown below.

BeforeWhen the sensor value X becomes equal to or more than the abnormality judgment threshold Y, it is judged as abnormal and relay Z is turned off.
AfterDiagnostic specification: An abnormality is judged when the sensor value X is equal to or greater than the abnormality judgment threshold Y.
Relay specification: Add “Sensor value Z is abnormal” to the OFF condition of relay Z.
Software Measures

For software measures, it is recommended that components have an interface section and that interface variables be defined by component.

Example: This example shows a file configuration as a file by component and interface variables as global variables.

  • Provide an Input/Output processor as an interface part in the component.
  • Input writes the interface variable to be input into a variable with the prefix removed.
  • Output writes the variable to be output to an interface variable prefixed with the component name (abbreviation).
OSS-ECAL English
error: Content is protected !!