Async all the way – No way!

I was just reading an article by Stephen Cleary on best practices in async code.

I haven’t fully composed my thoughts on this topic, but this has been on my mind for a while, so I will publish it anyway, and probably update it at some point in future.

Anyway, one thing mentioned by Stephen is that mixing synchronous and asynchronous code causes problems, and so he advises on “async all the way”. While I agree that when writing your code with the new async await style, it is necessary to make far more of your code async than you first intended, I have found that a pitfall for me, at least at the beginning, was to make too much of my code async.

At least in Windows Forms, not all code should be, and even can be, asynchronous. Be very careful when writing async code, especially if you are new to it. The temptation to make everything async is one that is best not yielded to. In my arrogant opinion anyway. Use it/don’t use it…

Advertisements

About Jerome

I am a senior C# developer in Johannesburg, South Africa. I am also a recovering addict, who spent nearly eight years using methamphetamine. I write on my recovery blog about my lessons learned and sometimes give advice to others who have made similar mistakes, often from my viewpoint as an atheist, and I also write some C# programming articles on my programming blog.
This entry was posted in Programming and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s