[dba-VB] TPL - real life project experience note

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Sun Sep 4 15:27:45 CDT 2011


Hi Gustav --

Thank you for your question - yes, the final result/experience is positive
- the application is now up&running 24x7x365 on customer's system - no
runtime errors, no memory leakage...

Although it took quite some efforts to make it working like that - be
prepared to spend one-two weeks of intensive development - just to learn and
master TPL development and catch and fix all kinds of "race conditions". It
happened I have had to write a tiny "framework" on top of TPL - that handles
initialization of TPL tasks, keeping and reporting status, logging, running
tasks asynchronously (main usage scenario) or synchronously (used for
testing) etc. This "framework" is not yet ready for sharing - maybe I will
share it "one fine day" if anybody proposes a composite sample task to be
split into, say dozen of subtasks to be run in parallel, which I can
implement using mentioned above tiny "framework" and publish for
reviewing...

BTW, I have started to read "Professional Test Driven Development with C#:
Developing Real World Applications with TDD"  by James Bender and Jeff
McWheter
(http://www.amazon.com/Professional-Test-Driven-Development-Applications/dp/
047064320X) and do agree with review you can find on Amazon - "It is one of
the best development books I have ever read and I highly recommend it" (I
personally do try to follow TDD approach for almost five years now - and it
works well for me amd my customers' projects (strict deadlines, "bad coding
habits", inertia etc. do disturb me to follow TDD "fanatically") but I have
never seen such a good, concise and practical book for .NET C# TDD
development - I second almost every word of it - I wish I had written one
like that :))

Thank you.

--
Shamil
 
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: 4 ???????? 2011 ?. 17:55
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] TPL - real life project experience note

Hi Shamil

Thanks for sharing this. 
I assume your experience is positive? You didn't tell - except between the
lines!

/gustav


>>> shamil at smsconsulting.spb.ru 03-09-2011 02:51:05 >>>

Hi All --

Just wanted to share my experience in using .NET 4.0 Task Parallel Library
(TPL):

http://msdn.microsoft.com/en-us/library/dd460693.aspx 

I have recently developed and released to a customer an advanced WinForms
project/application having running dozen of parallel tasks

- getting data from external data sources/web services and local lookup
databases,
- coordinating data,
- CRUD-ing results into MS SQL 2008 back-end and log file,
- displaying progress on WinForm...

I have used .NET 4.0 C# and TPL - the following classes:

- System.Threading.Tasks.Task
- System.Collections.Concurrent.ConcurrentBag<T>
- System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>
- System.Threading.Barrier
- C# lock statement

and 

- System.ComponentModel.BackgroundWorker to activate and run the main thread
"talking to" WinForms UI via Invoke.

TPL and related data structures and classes help to significantly simplify
coordination of the parallel tasks execution, still programming of
coordinated parallel tasks' execution is rather advanced activity - plan
one-two weeks of "learning by doing" if/when you'll find you wanted to use
TPL in your projects...

Thank you.

--
Shamil






More information about the dba-VB mailing list