The WPF Must-Grok List
Posted on : 02-11-2010 | By : Christopher Estep | In : Basics
Tags: Concepts, Interviews, Learning
2
Robert A. Heinlein defined the word grok as:
Grok means to understand so thoroughly that the observer becomes a part of the observed—to merge, blend, intermarry, lose identity in group experience.
or in other words, to fully completely understand and internalize it. It’s the difference between knowing something because you have read it and truly knowing how it works and why. I would say that it’s the difference between intellect and application.
As I’ve said before, WPF is in many ways a paradigm shift in software development, especially if you’re coming from the Windows Forms world. As a result, there are a number of new (and/or different) concepts that you really have to grasp, or grok before you could ever consider yourself proficient. I’ve been working with WPF for about 2 years now and there are still things that make me stop and think. Having said that, I think the effort is certainly work making and the result of your hard work is software that is also worth making.
So for budding WPF developers, I give you a list (as opposed to a tutorial) of what I think are some of the most important concepts and methodologies that you really should master in order to get the the most out of WPF.
- Dependency Properties – It is impossible to be even remotely effective in WPF if you don’t understand them. In many ways, dependency properties are the basic nerve system of WPF. Very little functionality exists in WPF that doesn’t rely on them.
- XAML – If you don’t like it or are resistant, just suck it up and deal with it. Seriously. XAML is not only used in WPF, but in Silverlight and WF as well. Whether it’s XAML, HTML, or plain-old XML, the XML-based development methodologies are here to stay.
- Binding, binding, and more binding – I can’t even begin to stress how important it is to understand WPF data binding. You simply can’t develop with WPF without it and it takes more than a basic understanding to use it effectively. You genuinely need to understand the hows and whys or else you’ll spend more time debugging your bindings than just about anything else. Even if you actually do grok WPF data binding, you’ll still probably spend a significant slice of your debugging time fixing and diagnosing your bindings.
- Routed Events – WPF handles events differently than other technologies, introducing the concepts of “bubbling” and “tunneling” to event handling. While you can still handle events the old way, you shouldn’t. Trust me on this one. Routed events will ultimately make your life easier than you can imagine, at least as far as event handling is concerned.
- Commands – Again, you can do things the “old way” but Commanding solves a number of problems, particularly aiding in the best practice of separation of concerns and encapsulation. The command pattern is somewhat different in WPF than what you may be used to, so it’s best not to assume that you know how it works already (with WPF) which is why it’s on this list.
- Layout, Measuring, and Arranging – WPF lays out controls and children using very specific rules and principles. While a comprehensive understanding isn’t required unless you’re writing your own controls, you still need to get a handle on how measuring and arranging works and what is done during each phase. This will really help when WPF puts something where you aren’t expecting and you’ll know where to look for a solution.
- WPF Threading – Yes, I’m serious. If you’re like many programmers, you’ve avoided threading topics as being either too esoteric or more “bare metal” than you need to deal with. I get that. Business application developers have historically had no concern for threading because we typically deal with “fast enough” performance. WPF changes that, seriously. It doesn’t change the practice of “fast enough” for business applications, but it rigidly requires all updates to UI objects be made from the UI thread. Again, I realize this isn’t a problem for the vast majority of programs. But I promise that at some point when you don’t have time to study a new topic, you’ll be using some asynchronous API and will try to make a change to a UI element from another thread and WPF simply will not let you. It will happen, I assure you. Asynchronous API’s are becoming the norm and unless your applications never interact with the outside world, you’ll be using one at some point. It’s better to know what the Dispatcher is, how it works so you don’t have to take a crash course in WPF threading when you can least afford to spend the time to do so.
- Styles & Templates – Fortunately, WPF’s implementation of styles is pretty straight forward. But, like so much of WPF, it’s different than what you’re going to be used to and you absolutely must know how they work. Unlike most of CSS, WPF styles allow you to dramatically affect behavior as well as appearance and that’s why they’re so crucial. Templates (especially Data Templates) also affect behavior and appearance but in a different (though complementary) way. Both are integral to almost every WPF application.
- Triggers – While Microsoft includes them in with styles & templates, I think triggers deserve mention on their own. Yes, it’s through triggers that styles and templates can manipulate your controls, they’re important enough to require study on their own. In my mind, triggers are like declarative event handlers that can be put pretty much anywhere without having to worry about the actual event handling plumbing itself. Triggers will also be the means by which you do any animation and a variety of other tasks.
- Resources – You must understand how resources work. I can’t say it any more simply than that. Resources are such an integral part of WPF, you will use them in every single application you write and almost every single XAML file and much code as well. More than anything in WPF, resources tie your application together.
Obviously, this isn’t an all-encompassing list. There are certainly more topics that you need to know, not the least of which being the myriad of WPF controls, deployment, printing, and so forth. But I can honestly say that without knowing and truly understanding the 10 concepts I’ve outlined above, you’re doing yourself, your customers, and (if applicable) your employer a grave disservice by not being the WPF expert you could be.
And don’t misunderstand me, either. Knowing these concepts only provide the foundation for so much more you’ll have to learn through experience. My grok-list is the beginning, not the end. But if you do grok these concepts and technologies, I promise you that you’re well on your way to being the expert you want to be.
Popularity: 100%













