Last night, Fiona and I sat down to eat my favourite light meal, spaghetti puttanesca. I’d grated some cheese to sprinkle on top, but when I’d finished mixing the pasta in with the sauce I found that the cheese had GONE!
Fiona had taken it down to the other end of the table, next to her plate. I asked if she’d finished with it, and it turned out that she HADN’T EVEN STARTED. She’d just acquired the lock, then left the resource unavailable while she responded to a completely unrelated event.
I explained to her that it’s an elementary principle of concurrent system design that you minimise your lock phases: acquire a resource, use it and release it as quickly as possible, so that the resource can be used by other agents. But she gave me some dumb story about having had to get up to fetch drinks for the boys. Then she said that I could have had the cheese back more quickly if I’d got up to help!
I explained as politely as I could that separation of concerns is one of the most fundamental of all the principles of system design, and that for me to reschedule my own tasks and take on other agents’ responsibilities would be a gross violation of encapsulation. I explained that, instead, when she accepted the get-the-boys’-drinks interrupt, she should have relinquished her lock and passed the cheese back down to my end of the table before going swanning off off on the drinks mission.
Sadly, she was COMPLETELY IRRATIONAL and started talking as though I was some kind of selfish jerk who just wanted the cheese.
I tried to be sympathetic, but the bottom line is that she was wasting a valuable opportunity to BENEFIT FROM MY EXPERTISE and learn important architectural principles. I just don’t understand women.
[By the way, I noticed yesterday that The Reinvigorated Programmer is now just over a month old. Many thanks to all of you who have read, and especially commented on, these posts — you’re making this site what it is. I hope you’re very proud.]