Skip to content

Examples

The following examples demonstrate the application of SOLID principles in creating reusable components. Each example focuses on a specific component type, illustrating how to implement interfaces, dependency injection, and/or null object patterns to adhere to SOLID design principles.

These examples are intended to be overly verbose for clarity and educational purposes. In practice, components may be simplified based on specific project requirements.

Contents

  • Digital Output Component - Injecting the actual hardware variable into the component
  • Solenoid Bank Component - Parsing a WORD into multiple Digital Output components
  • Digital Input Component - Injecting the actual hardware variable into the component
  • Cylinder Component
    • Single Output - Using an Interface to inject a Digital Output component
    • Dual Output - Modifying the interface and the component without changing the implementation of the objects that use it
    • Dual Output with Sensor Feedback - Extending the interface to include sensor feedback while being mindful of SOLID principles