Note that there are some explanatory texts on larger screens.

plurals
  1. POWasn't it .NET 4.0 TPL that made APM, EAP and BackgroundWorker asynchronous patterns obsolete?
    primarykey
    data
    text
    <p>I have 2 kinds of C# WPF app projects: </p> <ul> <li>based on .NET 4.0 that I cannot migrate to .NET 4.5 </li> <li>based on .NET 4.0 that I can migrate to .NET 4.5</li> </ul> <p>All of them should spawn 2-10 long-running (days) processes which can be cancelled and re-launched by users. </p> <p>I am interested to follow the best design practices. First of all, now, I am interested to disambiguate about <code>BackgroundWorker</code> usage though, I hope, my question should be valid about other asynchronous patterns. </p> <p>I see (contradicting) concurrent points of view about </p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/ms228963.aspx" rel="nofollow noreferrer">Asynchronous Programming Model (APM)</a> </li> <li><a href="http://msdn.microsoft.com/en-us/library/wewwczdw.aspx" rel="nofollow noreferrer">Event-based Asynchronous Pattern (EAP)</a> </li> <li><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker</a> </li> </ul> <p>asynchronous patterns: </p> <ul> <li><p>A) .NET 4.5 made them obsolete </p> <ul> <li>named as such in the book By Joseph Albahari, Ben Albahari "C# 5.0 in a Nutshell: The Definitive Reference" in sub-chapter "<a href="http://books.google.ru/books?id=t1de8nSVYnkC&amp;pg=PA601&amp;lpg=PA601&amp;dq=%22The%20Framework%20employs%20other%20patterns%20for%20asynchrony%20which%20precede%20tasks%20and%22&amp;source=bl&amp;ots=24skTvKo4H&amp;sig=R546MsYR4mO7EdUeCfQVHaSNCYs&amp;hl=en&amp;sa=X&amp;ei=93uAUdzvA4Ot4ATe0oGQAQ&amp;ved=0CCwQ6AEwAA#v=onepage&amp;q=%22The%20Framework%20employs%20other%20patterns%20for%20asynchrony%20which%20precede%20tasks%20and%22&amp;f=false" rel="nofollow noreferrer">Obsolete Patterns</a>" while its previous edition ""C# 4.0 in a Nutshell: The Definitive Reference" did not </li> <li>MSDN article <a href="http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx#BKMK_Threads" rel="nofollow noreferrer">"Asynchronous Programming with Async and Await (C# and Visual Basic)"</a> tells: </li> </ul></li> </ul> <blockquote> <p>"The async-based approach to asynchronous programming is preferable to existing approaches in almost every case. In particular, this approach is better than <a href="http://msdn.microsoft.com/en-us/library/vstudio/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker</a> for IO-bound operations because the code is simpler and you don't have to guard against race conditions. In combination with Task.Run, async programming is better than <a href="http://msdn.microsoft.com/en-us/library/vstudio/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker</a> for CPU-bound operations because async programming separates the coordination details of running your code from the work that Task.Run transfers to the threadpool" </p> </blockquote> <ul> <li>B) They (or, at least, <a href="https://stackoverflow.com/a/12415691/2031316"><code>BackgroundWorker</code>) are not obsolete in .NET 4.5</a> </li> </ul> <p>I am still in doubt:</p> <ol> <li>Are those patterns (first of all, BGW) obsolete in .NET 4.5 ? </li> <li><p>If they are obsolete in .NET 4.5 why aren't they obsolete in .NET 4.0?</p> <p>2A) Do I understand incorrectly that .NET 4.5 new features are still "easy" implementable/reproducible in .NET 4.0? </p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload