Scott Hanselman

Learning WPF with BabySmash and Back to Basics - Making Assumptions and When to Turn to Books

July 19, 2008 Comment on this post [12] Posted in BabySmash | Back to Basics | Windows Client | WPF
Sponsored By

NOTE: If you haven't read the first post in this series, I would encourage you do to that first, or check out the BabySmash category. Also check out for more developer info on WPF.

BACKGROUND: This is one of a series of posts on learning WPF. I wrote an application for my 2 year old using WPF, but as I'm a Win32-minded programmer, my working app is full of Win32-isms. It's not a good example of a WPF application even though it uses the technology. I'm calling on community (that's you, Dear Reader) to blog about your solutions to different (horrible) selections of my code. You can get the code Post your solutions on your blog, in the comments, or in the Feedback and we'll all learn WPF together. Pick a single line, a section, or subsystem or the whole app!

image I hung out with Chris Sells at the Mall Food Court today. He had trouble finding a parking spot and I felt bad. But I didn't REALLY start feeling bad until I started showing him the code for BabySmash.

He had a number of ideas for ways to make BabySmash better, but what was interesting was that he was using his own book as reference. He'd say, "oh, we did that in Chapter 4" and "ya, that does suck, check out this call out where I explain why." After this happened about four or five times he said (I think in jest, but you can never tell with famous dudes. ;) )

"Did you invite me here to read my book to you?"

After I picked my ego off the ground, unfolded it, dusted it off, and smoothed it out, I said, "I don't think so."

Chris had a really good point. It turned out that even though I have a three WPF books at my house, I haven't read them all deeply and thoughtfully. I hadn't even made it though the first few chapters. Mostly I skipped around, looking for answers to my specific questions.

Through my questioning, Chris noticed that I had some fundamental misunderstandings about some the basics of WPF. Things I thought worked one way, worked another or in reverse. Some concepts that were WPF 101 I had overlooked completely because I hadn't least made it through ~5 chapters and cemented the fundamentals.

I am not saying that we need to read every book all the way through, but I did learn a useful lesson. Don't assume you know how it works. Just a few hours of covering the fundamentals would have saved me a lot of time.

In the last post I said I was starting to grok WPF. Looks like less than I thought. I had left pretty significant gaps in my understanding by skipping around and assuming "oh, this works like that."  Those gaps in my knowledge led to some interesting directions in BabySmash. I'll post about some of those things I learned from Chris soon, but suffice it to say, I completely misunderstood how events moved around a WPF application.

Thanks Chris for setting me straight! Sorry about the parking!

OK, page one, "Hello, WPF."

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
July 19, 2008 4:51
a library/framework developer will try to deliver abstractions that let you focus less on the technology you're using and more on the solution you're trying to build. however, abstractions are always leaky to a varying extent, so sooner or later you'll need to know what's really going on. done properly, your existing win32 knowledge will be invaluable when working with WPF. it's just that breaking old ways of thinking and undoing the brain damage that excessively low-level systems work induces can take a lot of time and a lot of hard work (my first language was C and i have only recently recovered).

it takes a lot of personal courage to react to Sells's comments the way you did. a lot of people, myself included, would probably be very tempted to become defensive and angry.
July 19, 2008 5:07
I have three WPF books as well, and have made it various pages into each. You use them like a reference, because that is basically what they are. They all say these are the parts and pieces of WPF, but none of them say how they all should fit together. None cover how you should structure a WPF application. And unlike you, not all of us can have lunch with Chris Sells to have him tell us what we are doing wrong.
July 19, 2008 5:21
Scott, the book you linked to is the 2005 edition, whereas there is another edition available that was published in 2007.

July 19, 2008 5:24
What's really comforting is hearing that he uses his own book as a reference. I was at client site recently and did the exact same thing (yes, with my WPF book.) I was a little embarrassed that I didn't just remember. :-D

@Mike I know that I am hocking my own wares, but I'd like your opinion on our book. Our focus was on how to structure WPF applications. Feel free to contact me through my blog.
July 19, 2008 8:21
For the love of all that is holy, do not let this episode discourage you from the work you’re doing with BabySmash/WPF. With the sheer breadth of development technologies, most developers start new projects in the state you’ve chosen to put yourself in. They have to leverage knowledge they’ve gained in other domains, and use it to become productive with unfamiliar technologies. For the most part, an employer/client is not going be thrilled by the proposition of waiting patiently while a developer dives into books and solidifies his conceptual understanding. Your approach is a great simulation of that reality.

Besides, ask yourself this: when would the WPF concepts have had more meaning to you? When you read them in a book before ever having written a line of XAML, or after you have experimented with the technology, taken it for a test drive, and actually applied it? Getting to be “book smart” in a technology without ever having lived in it, is a trap that a lot of people in the IT industry fall into. The kind of folks you talk about who whiteboard for money.

I’m a Chris Sells fan, but I hope he didn’t have any malice behind his teasing. That’s another problem we have in IT. Some of the smartest developers on a team will not speak up or assert their ideas, for fear that they may be wrong. Or worse, they worry that they will be called out by some pecksniff who will ridicule them. So they don’t feel safe taking that risk, and the project is poorer for it. (Here's hoping Chris Sells is not that kind of bullyragger, lurking behind a pleasant author's personna).

I want you to continue down the path you’re on now. I give you big props for sharing your experience as a learner, rather than a pundit. And I hope more people follow your lead. We’ve got enough material that reads like product documentation. Let’s get more stuff out there about what it's like to learn in the real world.
July 20, 2008 1:02
I find Chris's voice very soothing, so I would have invited him solely for that purpose... I wonder if he'll release an audio-CD version of his book? :)

Do you have the book 'WPF in Action' from Manning Press? [1] I just purchased it because it's 35% off if you buy it from the Manning site (for a limited time?). I love reading dead-tree books, but the PDF versions are much more portable and you can pickup the PDF version for only 18 bucks (for a limited time?).

I can't really comment on the quality of the book yet, because I've just started it. I've usually been quite impressed with Manning Books in the past and I have ordered quite a few: Nhibernate in Action , Jquery in Action, ASP.NET MVC in Action, Silverlight 2 in Action, etc.

Whew... I really have a LOT of summer reading ahead of me!!! Can anyone recommend a device to read these PDFs on outside in a lawnchair? Does the Amazon Kindle read standard PDF documents or is it proprietary? I guess I could use my laptop, but that is so bulky (17") and battery life is terrible.

July 20, 2008 1:08
Answered my own question on the PDF reading ability of the Amazon Kindle...

Short answer: Not natively.
Long answer: There are PDF to proprietary format converters offered by Amazon and other 3rd parties. Not sure on the exact limitations.

I guess I'll just save up for a lighter notebook computer.
July 20, 2008 2:29
"Don't assume you know how it works."

I'd say that is true about half of the things that you blog about and are on your podcast. :)

Don't feel bad, I'd say that it is true about half of the things that I blog about and talk about with my peers.

Thanks for the awesome posts.
July 20, 2008 2:47
Jay - Heh, are you saying half the stuff I blog about is an assumption? :) I think that EVERYONE can say that about nearly everything they say. "Strong Opinions, Weakly Held," right?
July 21, 2008 21:25
"Did you invite me here to read my book to you?"

That's a pretty awesome quote.

You did say all along that you were just making it work based on your existing body of coding platform knowledge, so conceptual gaffs were pretty much inevitable. The fact that you've taken that as the jump-off point to figure out how it really should be done (as you've said you would from the outset) is the key difference between what you're doing and someone who just adopts the latest technology to their own way of doing things. (then usually pronounces that the new technology sucks)
July 24, 2008 4:09
I agree that understanding the 101 level stuff about an API is a good place to start, but the fact that you went off in some interesting/wrong directions with BabySmash may say more about the API design than it does about your approach to it.
July 26, 2008 1:04
While I've read a lot of blog posts heralding the end to books, I *love* reading programming books front to back. As you mentioned, its an excellent way to lay the foundation for knowledge on a particular topic. I can learn a lot about JavaScript by reading blogs, but nothing will prepare it for you like David Flanagan's JavaScript: The Definitive Guide.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.