Timeline for Should I instantiate the state objects of a finite state machine?
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 13, 2022 at 20:27 | vote | accept | ewhiting | ||
Jun 13, 2022 at 15:40 | answer | added | Erik Eidt | timeline score: 1 | |
Jun 12, 2022 at 8:00 | answer | added | Hans-Martin Mosner | timeline score: 1 | |
Jun 12, 2022 at 5:42 | comment | added | mtj | This sounds a lot like prematurely asking about optimization, which you generally should not do. For now, do whatever is the most readable, understandable, maintainable. Only diverge from this path, if you actually measure a problem. For your example: no, you will not notice a few milliseconds for extra initialization, and a few bytes for a few objects. This may change, if you have 1000s of states and millions of instances. | |
Jun 12, 2022 at 4:56 | comment | added | Erik Eidt | There's no right or wrong, if it works. There are other considerations like efficiency/performance and readability/maintainability. | |
Jun 12, 2022 at 3:21 | history | asked | ewhiting | CC BY-SA 4.0 |