ExerC#ising Your Mind
Foreword to C# Brain Teasers by Steve Love
Life.
It’s a puzzle.
As is much of what we find within it.
And that includes programming languages. You might think that unlike the natural languages we speak and write, the formal languages we design would be regular and unsurprising, designed with singular purpose and fit that purpose like a glove — no looseness or uncomfortable seams — free of inconsistencies, dark corners, byways of history, and quirks of compromise. You might think that… but you might be disappointed.
Even the simplest languages hold surprises. The rules of chess might be simple, but the subtlety is in their play and interaction. That’s where the learning is. Add in the evolving and diverse needs of technology and we find that the quarter century C# has been with us is more than enough time to add subtleties to the subtleties, darkness to the corners, and a fair few compromises. C# has seams from straddling the past, present, and future, and looseness from being general rather than single purpose. History happens.
While some things can be learned by being told the rules, others need more engagement. Sometimes you learn most by wrestling with a puzzle rather than having the answer handed to you on a plate or in a listicle.
And that’s what you have here. Puzzles. Brain teasers. Problems with thoroughly worked solutions — solutions that shed light on those dark corners and offer rationale where you might only have glimpsed oddity. The book may be short, but it’s bigger on the inside. However much you already know about C#, you will emerge from this book wiser. Your brain will not only be teased — it will be surprised, delighted, confounded, and enlightened.
In short, your mind will be exercised.
Enjoy the workout.
Over to Steve.
