ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

composition versus inheritance

I am working on a large project with multiple levels of control.  There is a top system level, an intermediate subsystem level, and a low level component.  I am interested in implementing a configuration from a file for all 3 levels.  So, I am contemplating 2 solutions.  This can allow me to edit the config file and not require a recompile of the code.  So here are the options I am thinking about to enable configuration.

 

1.  Make a parent class that is "Configurable".  Have the System, Subsystems and Components inherit from this "Configurable" object.  Have dynamic dispatch methods for Read Configuration and Write Configuration, etc.  Define a override method for these for each thing.  This only adds one class to the architecture, but it is the parent of almost everything.

 

2  Make a "Configuration" class.  Give each system, subsystem and component a child class of Configuration.  Such that each thing "has a" configuration.  This would add an additional class for every system, subsystem and component.

 

Thoughts?

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

0 Kudos
Message 1 of 1
(2,806 Views)