Introducing Sharp Corners
• CommentsEvery language, no matter how well-designed, has its “corners.” These are the Dark Places that every programmer eventually runs into. I define such a “corner” as a situation where the language has surprising results. Corners are discovered as a programmer moves from one phase to the next in language mastery; e.g., as a programmer who has an “intermediate” skill in the language becomes “advanced,” he will discover corners during that transition.
Most modern languages are easy to learn and contain few if any surprises at the beginner and intermediate level. It is when one begins to push the boundaries of the language that one finds the corners. Corners are a valuable learning experience. Languages are based on logical rules, defined by the language specification; when a programmer begins learning a language, he seldomly begins with the spec. As time goes on, the programmer develops a “feel” for the language based on experience rather than the language spec; internally, he develops an assumed set of rules for the language.
Eventually the programmer will extend their assumptions and realize that his assumed rules are not the same as the language specification (in many cases, in fact, there is a drastic difference). At this point, the good developer will explore this newly-uncovered corner and discover the actual rule being used by the language. When the developer discards their previously-held assumptions and embraces the language rule, he takes another step towards language mastery.
“Corners” are slightly different than “warts.” A “wart” is usually a holdover from an earlier revision of the language that is mainained only for backwards compatibility. The “recommended way” of programming a given language avoids the warts (since they have been replaced with a new and better way of accomplishing the objective). However, corners are the result of the language’s underlying logic and cannot be avoided.
There are a few programmers who do read (and understand) language specifications. Most, however, follow a natural process of discovering and exploring corners.
On my blog, I hope to build up a small collection of corners for the C# language (hence the name “Sharp Corners”). The intention is to help educate any C# programmer on their way to language mastery.
Of course I must end with a reference Jon Skeet’s famous C# Brainteasers page, which is like a collection of guru-level C# corners. Mine will probably not be that complex. :)