On Jul 17, 2010, at 3:27 PM, Rafael Cerioli wrote:

> Ok, ok busted :  I'm not much experienced ! That's precisely why I was 
> writing to that list in the first place : trying to get knowledge more 
> concrete than my intuitions, I thought that was the point. 

Yes, but you pushed back whenever people tried to give you advice.  I 
understand that it's frustrating not understanding why they are giving that 
advice, but sometimes that's the nature of experience -- it's hard to explain.

Multi-threaded programming is hard to do correctly.  The problems encountered 
are sometimes subtle and non-obvious.  They might crop up only intermittently 
and, perhaps, only under certain rare circumstances.  Debugging those problems, 
even when you can somewhat-reliably reproduce them, is often hellishly 
difficult.


> If I understood you correctly,  as an inexperienced programmer I should avoid 
> threading as much as possible, and I should do so because experienced people 
> told me to without giving an explanation (except that "you'll get into 
> trouble").

Frankly, I think that most experienced programmers think that even they, the 
experienced programmers themselves, should avoid threading if they can.

> Or I do not, and I might learn some interesting yet expensive lessons about 
> threading. 

True.  Experience has to be gained somehow.  The thing is, there truly are 
cases where threading is necessary to get decent application behavior.  So, why 
not wait and learn those hard lessons while working on those cases instead of 
gratuitously using threading in the cases where there are alternatives, like 
asynchronous APIs, that are recommended by the community you solicited for 
advice.


> Is there no reason understandable by young programmers  about why we should 
> avoid threading and NSURLConnection ?

There's nothing (to my knowledge) specific to NSURLConnection that makes it 
particularly nasty to combine with threading.  It's just that there's a nice, 
convenient asynchronous API, so you can just sidestep the issue, so that's what 
most folks here recommend.

> Or at least a good piece of documentation ? (would you say  Threading 
> Programming Guide is a good one ? )

The Threading Programming Guide and Concurrency Programming Guide have some 
good stuff in there.  They address some of the pitfalls, but don't quite 
illustrate the truly nasty, subtle nature of problems sometimes encountered in 
the real world.  I don't have a specific guide or document to point you to.  I 
almost think that blog postings recounting personal debugging horror stories 
would give a better sense.  Or perhaps some of the "What is wrong with this 
piece of code?" type of programming challenges you sometimes find out there.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to