InformIT has just published an interview with me where they asked me a bunch of questions related to C# 4.0 How-To. We got into the multicore future, Internet versus books, why C# programmers need to know about UAC, and a lot more. Check it out!
These arrived in the mail today. 🙂
Well, it’s finally out! Amazon no longer lists the book as available for pre-sale, and it should be shipping to purchasers today or tomorrow. If you’re a B&N shopper, you can also order it there, or grab it in stores within a few days.
From the product description:
Real Solutions for C# 4.0 Programmers
Need fast, robust, efficient code solutions for Microsoft C# 4.0? This book delivers exactly what you’re looking for. You’ll find more than 200 solutions, best-practice techniques, and tested code samples for everything from classes to exceptions, networking to XML, LINQ to Silverlight. Completely up-to-date, this book fully reflects major language enhancements introduced with the new C# 4.0 and .NET 4.0. When time is of the essence, turn here first: Get answers you can trust and code you can use, right now!
Beginning with the language essentials and moving on to solving common problems using the .NET Framework, C# 4.0 How-To addresses a wide range of general programming problems and algorithms. Along the way is clear, concise coverage of a broad spectrum of C# techniques that will help developers of all levels become more proficient with C# and the most popular .NET tools.
Fast, Reliable, and Easy to Use!
- Write more elegant, efficient, and reusable code
- Take advantage of real-world tips and best-practices advice
- Create more effective classes, interfaces, and types
- Master powerful data handling techniques using collections, serialization, databases, and XML
- Implement more effective user interfaces with both WPF and WinForms
- Construct Web-based and media-rich applications with ASP.NET and Silverlight
- Make the most of delegates, events, and anonymous methods
- Leverage advanced C# features ranging from reflection to asynchronous programming
- Harness the power of regular expressions
- Interact effectively with Windows and underlying hardware
- Master the best reusable patterns for designing complex programs
I’ll be doing a book giveaway at some point as well, once I get my own shipment. Stay tuned!
Get it from Amazon
Get it from Barnes and Noble
I recently wandered into a thrift store and as is usual in these stores I headed to the book section.(I live by the maxim that you can never own too many books.) The only thing that really caught my eye was a hardcover edition of The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography by Simon Singh. A quick perusal indicated it would be worth the shelf space.
However, I severely underestimated how much I would enjoy this book. I’m about half way through and find it so interesting and compelling a read that I feel I have to write about it.
The thing that really strikes me about this book is how entertaining and readable it is. I am not a big crypto or security guru, so I came to this book largely ignorant of of the topics and history.
The book is a wonderful blend of how encryption works with the history that surrounded its development. For such a seemingly-complex topic, Singh seems to have hit the perfect blend of history and instruction. Starting with the rudimentary Caesarian ciphers (basically, letter substitution) he builds up the techniques in the millenia-old one-upsmanship game between those who encipher and those who attempt to decipher. He starts with frequency analysis and history progresses he builds upon the previous techniques in explaining ever-more sophisticated attacks.
Surrounding this technical (yet still easy to understand) instruction is a fairly thorough narration of the history where these ciphers played a crucial role, from ancient Egypt, Julius Caesar, Mary Queen of Scots’ plot against Queen Elizabeth I, to legends of buried treasure protected by unbreakable ciphers, to the formidable German Enigma machine–
And let me be clear—he will teach you exactly how Enigma worked! It’s not that complicated, once you understand the principles that came before it.
Similarly, he explains how first the Polish and then the British cracked the Enigma as it evolved from the 1930’s to the end of the war, the mistakes the Germans made, and the things that, for example, the German Navy did to increase the security of it so that it became essentially unbreakable without external help (i.e., finding a codebook).
He discusses the Navajo code talkers (there is more to it than simply speaking an obscure language!), public key security, and finally quantum computing.
If you enjoy computer security topics, history, or just like to geek out, this is a great book to read.
Coincidentally, Simon Singh is also at the center of an unfortunate controversy in the UK surrounding some (I believe justified) comments he made about the British Chiropractic Association’s practices of encouraging procedures that could be considered unsafe. Rather than defend the practices with facts, they have decided to sue him for libel (the UK is infamous for having draconian libel laws that strongly favor accusers). You can learn more at his website.
You can also read a thorough explanation of the events at the Bad Astronomy blog.
- How to use P/LINQ (new in .Net 4!)
- Override Equals and implement IEquatable<T> correctly
- Enforce coding contracts (new in .Net 4!)
- Convert numbers to strings in arbitrary bases
- Various ways of rounding, including “snapping” to specific intervals.
- Dynamic discovery of WCF services
- Make your Silverlight 3 application run out-of-the-browser
- Speed up array access
- Easily split work among multiple processors
- Localize WinForms, WPF, ASP.Net, and Silverlight apps
…and hundreds of other topics, covering everything from the basics of C# to WPF, ASP.Net, interaction with the operating system, common application patterns and more. I cover all the new stuff that’s in both the C# language and the .Net 4 framework classes, as well as existing functionality.
Each topic begins with a brief description of when/where/why you would need to use the technique, followed by a brief explanation and source code.
I often just want a reference I can quickly dive into to remind me of how something is done. This book is my attempt to put in writing what I find valuable, both when I was learning C# and now when I just need to locate a sample quickly.
Over the next few months I’ll talk more about what’s in the book, and hopefully get back into blogging more programming topics.
I’ve been thinking a lot lately about the kind of technology and scientific understanding that would need to go into a computer like the one on the Enterprise in Star Trek, and specifically its interaction with people. It’s a computer that can respond to questions in context—that is, you don’t have to restart in every question everything needed to answer. The computer has been monitoring the conversation and has thus built up a context that it can use to understand and intelligently respond.
A computer that records and correlates conversations real-time must have a phenomenal ability (compared to our current technology) to not just syntactically parse the content, but also construct semantic models of it. If a computer is going to respond intelligently to you, it has to understand you. This is far beyond our current technology, but we’re moving there. In 20 years who knows where this will be. In 100, we can’t even imagine it. 400 years is nearly beyond contemplation.
The philosophy of computer understanding, and human-computer interaction specifically is incredibly interesting. I was led to think a lot about this while reading Robert Glass’s Software Creativity 2.0. This book is about the design and construction of software, but it has a deep philosophical undercurrent running throughout that kept me richly engaged. Much of the book is presented as conflicts between opposing forces:
- Discipline versus Flexibility
- Formal Methods versus Heuristics
- Optimizing versus satisficing
- Quantitative versus qualitative reasoning
- Process versus product
- Intellectual versus clerical
- Theory versus practice
- Industry versus academe
- Fun versus getting serious
Too often, neither one of these sides is “right”—they are just part of the problem (or the solution). While the book was written from the perspective of software construction, I think you can twist the intention just a little and consider them as attributes of software itself, not just how to write it, but how software must function. Most of those titles can be broken up into a dichotomy of Thinking versus Doing.
Thinking: Flexibility, Heuristics, Satisficing, Qualitative, Process, Intellectual, Theory, Academe
Doing: Discipline, Formal Methods, Optimizing, Quantitative, Product, Clerical, Practice, Industry
Computers are wonderful at the doing, not so much at the thinking. Much of thinking is synthesizing information, recognizing patterns, and highlighting the important points so that we can understand it. As humans, we have to do this or we are overwhelmed and have no comprehension. A computer has no such requirement—all information is available to it, yet it has no capability to synthesize, apply experience and perhaps (seemingly) unrelated principles to the situation. In this respect, the computer’s advantage in quantity is far outweighed by its lack of understanding. It has all the context in the world, but no way to apply it.
A good benchmark for a reasonable AI on the level I’m dreaming about is a program that can synthesize a complex set of documents (be they text, audio, or video) and produce a comprehensible summary that is not just selected excerpts from each. This functionality implies an ability to understand and comprehend on many levels. To do this will mean a much deeper understanding of the problems facing us in computer science, as represented in the list above.
You can start to think of these attributes/actions as mutually beneficial and dependent, influencing one another, recursively, being distinct (at first), and then morphing into a spiral, both being inputs to the other. Quantitative reasoning leads to qualitative analysis which leads back to qualitative measures, etc.
It made me think of Douglas R. Hofstadter’s opus Godel, Escher, Bach: An Eternal Golden Braid. This is a fascinating book that, if you can get through it (I admit I struggled through parts), wants you to think of consciousness as the attempted resolution of a very high-order strange loop.
The Strange Loop phenomenon occurs whenever, by moving upwards (or downwards) through the levels of some hierarchical system, we unexpectedly find ourselves right back where we started.
In the book, he discusses how this pattern appears in many areas, most notably music, the works of Escher, and in philosophy, as well as consciousness.
My belief is that the explanations of “emergent” phenomena in our brains—for instance, ideas, hopes, images, analogies, and finally consciousness and free will—are based on a kind of Strange Loop, an interaction between levels in which the top level reaches back down towards the bottom level and influences it, while at the same time being itself determined by the bottom level. In other words, a self-reinforcing “resonance” between different levels… The self comes into being at the moment it has the power to reflect itself.
I can’t help but think that this idea of a strange loop, combined with Glass’s attributes of software creativity are what will lead to more intelligent computers.
I saw this book when I bought Programming WPF a few weeks ago and it looked promising enough to buy. I’ve been doing unit testing in C# for a few years now, but I thought there were always things to learn and maybe I’d pick up a few new ideas.
It is easy to contrast this book with Beck’s Test Driven Development: By Example, and the two books definitely have a very different feel.
Beck’s book has a very evangelical feel to it, and it’s main purpose is to teach a mind set more than technical details. I believe this is important–maybe of first importance–but once you understand that, the rest of the book is a little simplistic for more experienced developers.
Pragmatic Unit Testing, on the other hand, focuses much more on the practical aspects (hmmm….I highly suspect that’s where the title comes from….) of unit testing. I liked the ideas on how to use categories and attributes to segregate tests that take too long to run on a regular basis. I also liked the section on singletons and getting around time-dependencies. The DateTime.Now problem is something I’ve had to deal with quite a bit in our server-side software that has a lot of time-dependant behavior. (In most cases, the problems were solved with refactoring the time into a function parameter.)
There are also good discussions of more mundane issues like how to deploy NUnit, where to put tests in a project, team practices, GUIs, threading, and C#-specific issues.
The discussion about mock objects (a very basic introduction) is also quite clear and understandable–more so than many resources I’ve seen on the web, which often assume you already know all about them.
Something I don’t like: the acronyms (BICEP, CORRECT, A TRIP). They kind of bug me. I like the ideas behind the acronyms and I think it’s more important and effective (for me, anyway) to internalize the principles of testing rather than remembering specific acronyms and the words they go with. YMMV.
I will probably only read Test Drive Development: By Example once, but I will definitely come back to Pragmatic Unit Testing occasionally to refresh my ideas.
Well, after a week of investigation, I’ve settled on a social network for books: Shelfari. It’s attractive, easy-to-use, easy to manipulate many books at once, they have a mobile version, and I have one friend on it (who invited me).
Goodreads.com also looked nice, and it almost won. bookwormr.com, the one I originally found was just too immature at this point. I’m also wondering what features are going to set it apart from the pack, especially when there are so many well-established sites that do the same thing.
Meanwhile, if you want to read some books that will definitely NOT make you smarter, check out 5 Books that can actually make you stupider.
I found a great site I wanted to share with everybody: bookwormr.
I’ve got 3 large books on my nightstand at the moment:
- Scotland: The Story of a Nation – Magnus Magnusson – Much of my heritage is Scottish, and I got intensely interested in Scottish history during our trip to Edinburgh last year.
- Code Complete – Steve McConnell – I’ve read this before, but it’s a good book to review every year or so and pick up new tips.
- The Complete Grimm’s Fairy Tales – there are many variations on this book. I have a very old, out-of-print edition. I read a few of these a week–they’re mostly quite short.
Those are all fairly large books and I’ve been working on them simultaneously. Meanwhile, I keep getting book recommendations from various places (blogs, podcasts, family). It’s to the point where if I don’t write them down, I’ll forget. I’ve sort-of kept track of books I want to read on my shelf, in an Outlook note, in e-mails to myself, but I was in need of a central repository for this.
So I stumbled upon bookwormr, which is (almost) exactly what I want.
It’s still in its infancy stages, but I think it shows great promise. And it is usable now, despite some rough edges. The owner seems very amenable to suggestions via the blog.
How it works:
- Search for books (it uses Amazon as its database)
- Add them to one of your three lists (already read, reading, want to read)
- You can tag, review, and rate the books.
- See what others are reading.
The author also has a wordpress plug-in and a Facebook app to go along with it. I’m going to try out both.
Features I’d like to see:
- Easier way to add multiple books at a time
- Ability to sort lists according to a ranking system of my own (the author is planning on adding the ability to sort on author, title, book rating overall)
Update: here’s my bookwormr profile.
Even if the Internet connection goes out, your computer does not become a dumb brick. There were days these last few days where I didn’t bother turning it on. Then I realized all the things I could still do.
(My home Internet connection finally came back this morning. I’m bit upset that they didn’t figure it out earlier. It turned out that the first technician grossly misdiagnosed the problem. He put in an order for a new drop to be put in. Turned out it was just a broken modem. Why didn’t they try that earlier? Worse, why didn’t I think of it earlier. To be honest, I did think of it, but didn’t push it. Now I just need to get my money back from Comcast.)
Without further ado, here’s my suggestions for what to do when the Internet goes out:
On the computer:
- Organize photos in Picasa – I have nearly 6,000 photos on my computer. Many of them need to be deleted, organized, tagged, labeled, e-mailed, etc. (Yes, e-mailed–I can queue them in Outlook until the connection comes back).
- Organize My Documents – I’ve let My Documents folder get very messy. Lots of files that don’t need to be there anymore. Others need to be filed, or re-filed.
- Organize e-mail – I’ve got hundreds of folders in Outlook. I’ve tried to keep my Inbox empty and put things into @Action, @Someday, or @WaitingFor folders before they find a permanent home, but sometimes it still gets out of hand.
- Organize and fill in information in Windows Media Player. I still have music tagged with the wrong genre…
- Program. I’ve got two major programming projects I’m working on. They don’t depend on the Internet. The Internet is NICE if you need to learn something, but there’s always plenty of stuff to do that doesn’t require it. Write unit tests, run code coverage, design graphics, do all the other stuff if you must.
- Write e-mails to family. Long ones. Your mom will thank you.
- Catch up on podcasts. I got through ten episodes of Ask a Ninja, and nearly all backlogged podcasts. Now I’ll have a flood when I sync tonight.
- Write blog entries. I use Windows Live Writer. I should have done more of this.
- Play a game.
- Better, write a game.
- Setup appointments and events in Outlook for the next year.
- Read some classic programming texts.
- General computer maintenance. Defrag your disk, delete temp files, delete old installation files you haven’t used in 5 years (yes, I have some of those…). Use DiskSlicer to find where your space is going.
- Do long-avoided projects. I have approximately 20 hours of audio I need to edit and split into tracks. I’ve been putting it off for a very long time.
Off the Computer:
- Practice the piano.
- Read books. I’ve just started Cryptonomicon by Neal Stephenson. Very good, so far. Go buy it. If you’re a geek, you’ll like it. How can you not love a 2 page diversion into the mathematics of when a bike chain will interfere with a broken spoke and fall off? Other than the geekiness, it’s a good story.
- Learn to cook a new dish.
- Do crosswords.
Or just go to the library and use the Internet. I only did this a few times, despite it being within walking distance from where I live.