Saturday, October 11, 2008
SDC Day 2 - Composite WPF and WPF Data Binding
Gave two sessions on the second day at the Software Developers Network conference (aka SDC) in Netherlands. First was on Prism (Composite Application Guidance for WPF). I covered the architecture of a Prism app and each of the features of Prism (Modules, Regions, Composite Commands, and Composite Events). You can grab the slides and demos for Developing Composite Applications with Prism here: Slides Demos Second session was on WPF Data Binding, where I showed the many capabilities and how to use WPF data binding. You can get the slides and demos for WPF Data Binding here: Slides Demos
Tuesday, October 07, 2008
SDC Day 1 - SO Workflows and WPF Interop
Gave two sessions yesterday at the Software Developers Network conference (aka SDC) in Netherlands. First was on using WF as a service technology. I talked about where WF fits into a SO architecture, as well as SO tenets, WF capabilities for services, and then of course, several demos of how to use it. I showed simple use of Send/Receive activities, how to split out the context instance ID from the proxy so it can be handed off to multiple clients, and how to make callsbacks from one workflow to another with service calls. You can grab the slides and demos for Developing Service Oriented Workflows here: Slides Demos Second session was on Windows Forms and WPF interop, where I showed how easy it is to embed controls from one technology into the other, and then covered some of the limitations and things to be aware of. You can get the slides and demos for WPF in Windows Forms and Vice Versa here: Slides Demos
Friday, October 03, 2008
Connecting Applications with WCF Talk at RVNUG
I gave a talk on WCF last night at Roanoke Valley .NET Users Group. Thanks to Robin and crew for inviting me and for running the meeting. You've got a great group and facility there! The talk covered the fundamentals of WCF along with some brief coverage of the advanced capabilities including security, transactions, queued calls, callbacks, reliability, interoperability, and other aspects. A lot of material to pack into an hour and a half along with an end to end demo coded from scratch in terms of the WCF aspects (had an existing business layer and a client that I tacked on to the back and front ends respectively, but did all the service contract, data contracts, config, proxies, etc. on the fly just to show it could be done in an hour easy. If you are interested in the slides and demos from that talk, you can find them below. Slides Demos For those who attended, the little glitch towards the end of the live coding demo was simply a matter of having two connectionStrings elements in my web.config after pasting in the EF connection string for the database. This demo, like many of mine, use a music library database I generate from my music collection. You can either download and attach a DB backup from here or you can read about how to generate one of your own from your own collection here.
Prism on DNRTV
Looks like my episode on Composite WPF (Prism) went live on DNRTV. You can find it here. didn't get through as much as I would have liked due to good questions, so will definitely try to follow up with another one soon covering events and commands.
Friday, September 12, 2008
Tuesday, September 02, 2008
Monday, September 01, 2008
Custom Refactor Pro Plug-in - Convert Property
UPDATE: Thanks to some excellent feedback from Rory Becker, I changed my plug in from a Refactor provider to a Code provider. A refactoring should be structural and should not change the functionality of the code, whereas this plug in changes behavior. That just means the prompting is a little different as shown in the updated screen grab below. I also made it work for VB as well with some more help from the DevExpress folks. The code download at the bottom gives you the latest version. Something I frequently find myself doing is starting a type out with simple, auto-implemented properties in C# along these lines: public string Name { get; set; }
Then at some point I realize I want that type to implement INotifyPropertyChanged and have that property and possibly some of the others raise PropertyChanged notifications when they change. I got really tired of doing this manually, and my first way of automating it was to just create a code snippet for a property changed notification property, and I would overwrite the simple property with the property changed property.
But then I found myself needing to see if INotifyPropertyChanged was already implemented, if not add it, resolve it, see if the property already had a backing member variable, if not add it, yadda yadda... screaming for automation.
Unfortunately code snippets in VS are not that powerful, but fortunately I already use a tool that I think every developer should have on their desktop - CodeRush + Refactor Pro.
These two products are built on top of an extensibility engine called DxCore, which allows them as well as VS to be extensible based on a fairly straightforward API (that is all managed code, unlike the VS extensibility model).
In this case what I really wanted was an intelligent refactoring where I could just right click on an existing property, have it figure out if it had a member variable or not, if not add one, see if the type had INotifyPropertyChanged implemented, if not add it, add the using statement for System.ComponentModel if it was not already there, and add the PropertyChanged event with an anonymous method subscriber (so that you don't need to null check and don't have to worry about multithreaded race conditions with unsubscribing).
With a few hints and a starter project from my friends at DevExpress I got a Refactor Pro plug-in working in no time that does just that. I can invoke Refactor Pro (keystroke or a mouse click) on a simple property (auto-backing member or not) and get this:
When I invoke the conversion, it adds the INotifyPropertyChanged implementation if needed. So the following simple class:
public class Customer
{
public string Name { get; set; }
}
Becomes this:
public class Customer : INotifyPropertyChanged
{
string m_Name;
public string Name
{
get
{
return m_Name;
}
set
{
if (value != m_Name)
{
m_Name = value;
PropertyChanged(this, new PropertyChangedEventArgs("Name"));
}
}
}
public event PropertyChangedEventHandler PropertyChanged = delegate { };
}
It also adds the using statement for System.ComponentModel if not already present. If I invoke it on another simple property in that class, it just adds the expanded property syntax and leaves the type declaration alone.
The code is a little too long to list here, but you can download the plug-in code here. If there is enough demand through comments, I'll do a follow on post with a walk through of the code.
Accelerating Code Analysis and Improving Code Quality with NDepend
I've been working on a project for a customer where a fairly large pile of code has been written by an offshore vendor and I was brought in to do a code review and some clean up and verification of the logic. As I dove into the code, the smells started to become overwhelming. Trying to work through the entire code base and figure out where to focus my clean up efforts first was a daunting task. However, a wonderful tool called NDepend came to the rescue. If you haven't ever heard of this awesome tool and you have oversight responsibility for a team of developers, you should really check it out. I can't show screenshots here because the code has namespaces that reveal the client name, but you can find a number of screenshots on the NDepend site itself. Basically NDepend will do a static analysis of your code base and help you identify everything from tightly coupled code containing too many dependencies (thus the name), but tons of other code metrics including line of code count, cyclomatic complexity, and others. It has a rich interactive UI for drilling into the code from the graphical charts that present you color coded views of where you need to focus as well as a web report generated view that you can view through a browser. You can analyze the code through a number of metrics, and it comes with a powerful query language called CQL (Code Query Language) that lets you look for particular patterns that you want to focus on. I'd say this is a tool any technical lead, senior developer, or architect in charge of code quality should have in their toolbox.
Friday, August 22, 2008
Thursday, July 03, 2008
Composite Application Guidance for WPF (aka Prism) Ships!
I'm psyched that the Composite Application Guidance for WPF thingy from patterns and practices has shipped. This is a project I worked on as a part time developer for Microsoft for the last 6 months. It is something that you should really take a look at if you are building complex WPF applications and care about decoupling, testability, and maintainability. You can find some more high level info on Glenn Block's blog here, and my previous post here. You can get the bits here. The only thing I'm unhappy with is what the hell to call this thing. We called it Prism as a code name during development. For legal reasons, we could not use that as a release name. The p&p guys don't want us calling it CAG because there were some negative connotations with that acronym. It has a set of libraries in it that are collectively called CAL (Composite Application Libraries), but the thing that is shipping includes documentation, how-to's, a reference implementation app, and quickstarts, so the shipping thingy is a lot more than just CAL. Due to mainly internal politics at Microsoft, you can't call it a "product" because p&p is not a product team and therefore can't ship "products". p&p also makes some subtle distinction and says this is not a "Guidance Package", as some of their previous offerings have been called. Its a "set of Guidance", whatever that is... So I'm continuing to call it Prism for now. Its a lot easier to say in a sentence than "the Composite Application Guidance for WPF set of guidance which is not a product or a guidance package but which you get a bunch of stuff with". Anyway, check it out and expect some more detailed posts and possibly some screencasts showing how to use it.
|






| February, 2012 (1) |
| January, 2012 (1) |
| November, 2011 (4) |
| October, 2011 (1) |
| September, 2011 (2) |
| August, 2011 (1) |
| July, 2011 (1) |
| May, 2011 (5) |
| March, 2011 (4) |
| February, 2011 (2) |
| January, 2011 (3) |
| November, 2010 (4) |
| October, 2010 (1) |
| September, 2010 (5) |
| August, 2010 (5) |
| July, 2010 (6) |
| June, 2010 (8) |
| May, 2010 (2) |
| April, 2010 (2) |
| January, 2010 (1) |
| December, 2009 (3) |
| November, 2009 (2) |
| October, 2009 (3) |
| September, 2009 (3) |
| August, 2009 (2) |
| July, 2009 (3) |
| May, 2009 (3) |
| April, 2009 (2) |
| March, 2009 (1) |
| February, 2009 (2) |
| January, 2009 (2) |
| December, 2008 (1) |
| November, 2008 (2) |
| October, 2008 (5) |
| September, 2008 (4) |
| August, 2008 (2) |
| July, 2008 (1) |
| June, 2008 (2) |
| May, 2008 (2) |
| April, 2008 (3) |
| February, 2008 (6) |
| January, 2008 (3) |
| December, 2007 (1) |
| November, 2007 (1) |
| October, 2007 (5) |
| September, 2007 (1) |
| July, 2007 (3) |
| June, 2007 (8) |
| April, 2007 (2) |
| March, 2007 (4) |
| February, 2007 (1) |
| December, 2006 (2) |
| November, 2006 (9) |
| October, 2006 (5) |
| September, 2006 (3) |
| August, 2006 (2) |
| July, 2006 (4) |
| June, 2006 (5) |
| May, 2006 (10) |
| April, 2006 (4) |
| March, 2006 (2) |
| February, 2006 (12) |
| January, 2006 (7) |
| December, 2005 (2) |
| November, 2005 (15) |
| October, 2005 (6) |
| September, 2005 (7) |
| August, 2005 (3) |
| July, 2005 (10) |
| June, 2005 (11) |
| May, 2005 (7) |
| April, 2005 (8) |
| March, 2005 (6) |
| February, 2005 (2) |
| January, 2005 (6) |
| December, 2004 (3) |
| November, 2004 (5) |
| October, 2004 (2) |
| September, 2004 (5) |
| August, 2004 (13) |
| July, 2004 (6) |
| June, 2004 (14) |
| May, 2004 (17) |
| April, 2004 (12) |
| March, 2004 (8) |
| February, 2004 (10) |
| January, 2004 (14) |
| December, 2003 (9) |
| November, 2003 (13) |
| October, 2003 (3) |


Sign In
|