Archive for June, 2010

Exceptions Part 3: Why do we need ‘finally’ blocks?

June 28, 2010 8 comments

See the Contents Page for this series of articles

C# programs compile to an intermediate language (IL). If you want to dig deeper into exception handling, IL doesn’t seem very enlightening at first, because it also has the keywords try and catch. It’s like opening a TV and inside it… there’s a little TV. That’s no kind of explanation!
Read more…

Exceptions Part 2: Why do we need to catch them?

June 24, 2010 6 comments

See the Contents Page for this series of articles

Last time we established that an exception is the way a function unambiguously produces no value – or no side-effect, which amounts to the same (no)thing. To take the best known example from mathematics, the function f(x) = 1/x has no value if x is zero. If you’re asking what anything divided by zero is, well… you shouldn’t be asking. Just don’t ask.

But by catching an exception, you are saying “I expect this”. So to be entirely rigorous about it, isn’t it wrong that we ever try to catch these things? Maybe, like in mathematics, we should never attempt to evaluate them in the first place.
Read more…

Categories: Uncategorized Tags: ,

How to make jQuery tabs play nicely with Sammy.js

June 22, 2010 4 comments

jQuery tabs are very easy to use. In the HTML you do something like:
Read more…

Categories: Uncategorized Tags: , ,

Exceptions Part 1: What is the Purpose of Exceptions?

June 22, 2010 5 comments

A few months ago I wrote some long comments on an Eric Lippert blog post and ever since I’ve been meaning to distill them into something more coherent.

But I can’t! If anything my rambling notes get longer and longer. Exceptions simply aren’t that simple. Of the four big commercial development languages (C++, Java, VB.NET, C#) there are similar keywords for exceptions but significant differences in how they work. Then there are the “lightweight” platforms, JavaScript in the browser and Objective-C on Apple’s iOS, which again have the same keywords but not the same attitude to when exceptions should be used.
Read more…

Categories: Uncategorized Tags: