solarpowerlog trunk
Basic Concepts

To get an overview how solarpowerlog is designed, lets take a look at some basic concepts.

"Code against interfaces, not implementations"

All base classes are designed as interfaces. This allows loosly coupled objects and also allows to easier code reuse.

For example, the connection classes are defined through IConnect. When using IConnects, the inverter simply does not need to know which is its communication method, it will just use the interface and will be fine.

Design Pattern: Factories

Usually object generation is done by factories. The Factories gets an identifier (usually a string) and return the created object.

Factories allows that new specializations of interfaces can be added to the program without the need to change any of the other classes.

For example, if you add a fancy bluetooth class, you just create a IConnect based CConnectionBluetooth, implement it and add its id-string to the IConnectFactory. Now, all the inverters can instanciate (via their comms settings) a CConnectionBluetooth without knowing actually knowing the details.