You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Adapting Solaar code or even starting to work on it is hard, and you likely introduce a bug. As is, a lot of hardware is required to verify functionality.
Describe the solution you'd like
Aim for an architecture, that's easy to test, maintain and extend.
It should be possible to implement a FakeDevice, which e.g. behaves like an MX Master 3S and supports hardware independent implementation and testing of new features, while ensuring, that existing functionality still works. Final tests require the actual hardware.
Aim for a three layered architecture, consisting of
Presentation Layer
Business Logic
Database Layer
The business logic contains the most relevant code, we care about. It can be covered by unit tests, when applying the dependency inversion principle (DIP). The business logic should depend on abstractions (an interface), not on a specific implementation. This is achieved by explicitly passing an implementation which satisfies the interface, rather than hard coupling different components. This results in composition over inheritance.
It enables simple tests, without mocking and patching and simply passing a fake instead.
The (work in progress) gives a first insight on the proposed architecture. Parts of the code already satisfy the proposal, others need quite some work to move from inheritance to composition.
(Work in progress)
Describe alternatives you've considered
Stick with the untestable big ball of mud, as it was months ago.
Is your feature request related to a problem? Please describe.
Adapting Solaar code or even starting to work on it is hard, and you likely introduce a bug. As is, a lot of hardware is required to verify functionality.
Describe the solution you'd like
Aim for an architecture, that's easy to test, maintain and extend.
It should be possible to implement a FakeDevice, which e.g. behaves like an MX Master 3S and supports hardware independent implementation and testing of new features, while ensuring, that existing functionality still works. Final tests require the actual hardware.
Aim for a three layered architecture, consisting of
The business logic contains the most relevant code, we care about. It can be covered by unit tests, when applying the dependency inversion principle (DIP). The business logic should depend on abstractions (an interface), not on a specific implementation. This is achieved by explicitly passing an implementation which satisfies the interface, rather than hard coupling different components. This results in composition over inheritance.
It enables simple tests, without mocking and patching and simply passing a fake instead.
The (work in progress) gives a first insight on the proposed architecture. Parts of the code already satisfy the proposal, others need quite some work to move from inheritance to composition.
(Work in progress)
Describe alternatives you've considered
Stick with the untestable big ball of mud, as it was months ago.
Related tickets
Relevant books
https://www.cosmicpython.com/book/chapter_01_domain_model.html
Information
The text was updated successfully, but these errors were encountered: