Poller
async functions always finish on a background thread
thats true. i did not pay attention of the amount of time (usually its not relevant). if something takes that long in the background and i need the value i usually go for a background operating service with signalling functionality. but i am not that much into game dev, so not 100% sure what is done for 5 seconds in background work.
60 replies
What is dependency injection and when should I realistically use it
im going to make a few assumptions here, so if i am wrong in anything please dont feel offended.
- if you ask this question it sounds like also things like SOLID are not much known. so this seems not to be a partial issue, but a more breader from i think lacking experience.(DI alone might not change much in terms of impovement for you)
- if you create code that is structured and uses DI you can propperly test your stuff. (a static function call can not be mocked, but if you inject a service (interface!!! ) you then in unit test can mock that external service call.
- using static methods/classes binds everything to that implementation. forever.
thats a small cut of how i see this.
feel free to ask if i didnt explain something clear.
17 replies