4 ms·
I'm not buying the c# async/await kool-aid. Async, sure, I'm down with that, but I've used the c# async stuff now, and while it makes it the app somewhat faste
by shadowmint 13y ago
I'm not buying the c# async/await kool-aid.
Async, sure, I'm down with that, but I've used the c# async stuff now, and while it makes it the app somewhat faster, it has three major downsides (that I encountered):
- Infects everything; suddenly your whole application has to be async.
- Debugging becomes a massive headache, because you end up in weird situations where the request has completed before some async operation completes, the debugger gets scared and stops working.
- It's really hard to test properly.
The only good reason for using it is that because of the infection-property back fitting async to your application is a major headache; if you might use it, you have to use it from the beginning or you get a huge backlog of refactoring and test fixes to do.
-___- 'I might use this for some performance bottleneck I don't yet know about, so better start using it now...' yeah, that's a thing: premature optimization.
- ufo 13y agoBut doing things by hand with callbacks is going to have all of those same issues isnt it? If you dont want to infect everything then you basically need to just write synchronous code instead...
- masklinn 13y agoCorrect. Same with introducing futures/deferred.
- raverbashing 13y agoThe issue I see is that with some libraries you either go 100% async or 100% sync with no middle ground.
- danabramov 13y agoThis is simply not true. You can use any C# library without using async (code rewriter). You'd still be using Tasks but there is nothing special about them (no compiler magic). They're just futures on which you can schedule continuations.
- raverbashing 13y agoI'm not talking about C#, but about libraries in other languages that support async behaviour
- angersock 13y agoPDFJS--the PDF reading package from Mozilla--is a gross offender in this regard; the mix of sync and async, and the somewhat arbitrary nature of which is which, is pretty annoying.
- localhost 13y agoOn the debugging issue, I agree that used to be terrible. See the awesome new Asynchronous Debugging feature in VS 2013: http://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Asynchronous-Debugging-in-Visual-Studio-2013 http://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Asynchr...