Ok, that’s a lie, but it’s how I felt after reading a couple of posts on Eric Lippert’s blog (Fabulous Adventures In Code).
If you haven’t read Eric’s blog, you really should, it’s fantastic. At least it is when he’s not destroying your faith that any program will ever work.
The two posts in question are;
The lock one was completely new information to me, simply because I had never investigated the IL generated by the .Net compilers or thought about it deeply enough.
Most of the event stuff I already knew, except for the two cases where an event handler could be called after it had been removed from the event (for details of the second one, see the comments where it’s pointed out this can happen even in single-threaded code).
While both instances make perfect sense when laid out in black and white, and I understand the reasons for them, it’s just more evidence that writing code is easy, writing good code is hard.
This is why a real programmer is never certain or sure about anything. When asked if a program works, or what a piece of code does, they will always respond with should, might, probably, I expect and other non-absolute terms. A programmer that tells you something WILL work is either naive, or lying.
Have a great day !