Timeline for Unique physical objects (Hardware drivers) in C++
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 22, 2019 at 17:21 | comment | added | MrBit | @LieRyan, I'm not writing a library for public use. I'm making a service. It's only for personal use for now. | |
Jul 22, 2019 at 3:59 | comment | added | Lie Ryan | If you're writing drivers for public use, you can't necessarily assume there's going to be only one instance of this hardware in the system. If you know that your code is only going to be used for your particular scenario and is not intended to be made public, then feel free to use Singletons object. | |
Jul 21, 2019 at 18:06 | answer | added | gnasher729 | timeline score: 3 | |
Jul 21, 2019 at 13:29 | comment | added | Nick Alexeev | @MrBit "What is the best way to deal with classes like that?" My short answer [or terse, or closed form answer] to that is: "Deal with this using dependency injection. Same way as with non-unique dependencies." | |
Jul 21, 2019 at 11:12 | comment | added | Hans-Martin Mosner | Singleton classes aren't inherently bad. It is still useful if you put all the functions related to this hardware into one class, for example to separate it from the bus connection used and the communication protocols being run over the radio link. | |
Jul 21, 2019 at 10:06 | history | asked | MrBit | CC BY-SA 4.0 |