Skip navigation

Category Archives: Uncategorized

I have taken a bit of a hiatus from the usual blogging over the past few months. Between the birth of my daughter and other personal matters, I haven’t had the time or energy to really produce content at a level I’d feel is acceptable. I’ve spent the time re-evaluating my activities outside of work. My gift and my curse is that I love what I do for a profession. I have been tweeting consistently, and in my absence from the blog, I’ve presented at two code camp type events so I feel that might give me some “karma points” for the silence here.

Anyway, I’ve been waiting for something inspirational that I just HAD to blog about. And Ayende provided a perfect topic to act as kindling for my flame. It’s a simple scenario (and one we’ve probably seen a dozen times).

public class Prisoner
{
    public virtual bool CanBePutInIsolation() { ... }
    public virtual bool IsEligibleForVacations() { ... }
    public virtual bool CanSendToWork() { ... }
    //Other code here
}

What we see here is a domain object with view logic embedded. Basically the functions above provide hooks for the UI to decide whether certain elements should be enabled like so:

commandUI

In WPF, the solution is simple, embed the logic into an ICommand.CanExecute() request. But the Command Pattern extends beyond just WPF. WPF just makes the pattern a more mainstream concept. So if you find yourself putting a bunch of logic on your domain objects for the explicit purpose of enabling/disabling your UI, don’t. Wrap it in a command either freestanding, or on a ViewModel.

Mix ‘09 just ended today. Microsoft announced some amazing stuff there. I’ve got some samples I’m working on to share with you, I just didn’t have enough time to finish them for a zero-day release. What am I excited about from Mix?

Silverlight 3

Silverlight 3 has a lot of features that make it compelling not only as a Flash alternative in web scenarios, but the new out of browser experience presents a good case for using Silverlight as your default client framework. And the cross platform capabilities are just the icing on the cake. There are more goodies to talk about with Silverlight 3 as well, like:

RIA Services

I’m extremely excited about the scenarios enabled by the RIA Services Framework. RIA services acts as an application service layer between your UI and your application tier. There is a lot to talk about with this, but I like what I see, and so should the EF naysayers. I can’t do it justice here, but I do have a full post in the works about it. While you’re waiting, there’s a Hand’s On Lab for Ria.

Azure

There’s a lot to talk about with Azure from the announcement that SQL Data Services will support standard ADO.NET (and other TDS capable clients), to Windows Azure supporting PHP and Full-Trust code and beyond. I’ll save that info for my other blog.

Blend 3

There is not enough I can say about Blend 3! The WPF team has always talked about the Designer-Developer Workflow. Blend 3 takes it to another level. The most compelling feature of Blend 3 is Sketchflow. The best description I can give of Sketchflow is a digital storyboard for mocking up an application that happens to produce a working application. Trust me you’ve got to see this! There are a metric ton of other new features in Blend (and that’s just what’s in the Preview), but Sketchflow is the most intriguing to me.

So that’s what I’m excited about from Mix ‘09. What has you buzzing?

There’s a new oxymoron going around call Static Reflection. The basic gist is that by using expression trees you can do things that appear to be dynamic but in reality are checked at compile time. Like for instance, getting the name of a property for firing an INotifyPropertyChanged.PropertyChanged event. My colleague, Jon Fuller, showed me his code for Method Guards and my first comment was that this would be a great tool for implementing INotifyPropertyChanged. He informed me that he already went there and showed me that code as well.

I wasn’t too happy with the idea of wasting your sole base class on NotifyPropertyChanged so I suggested that we use extension methods instead. After a bit of finagling with the framework (Events don’t like to be fired from outside their declaring class), here is the result:

        public static void SetProperty<T>(this INotifyPropertyChanged source, 
						Expression<Func<T>> propExpr, 
						Expression<Func<T>> fieldExpr, 
						T value)
        {
            source.SetProperty(propExpr, fieldExpr, value, () => { });
        }

        public static void SetProperty<T>(this INotifyPropertyChanged source, 
						Expression<Func<T>> propExpr, 
						Expression<Func<T>> fieldExpr, 
						T value, 
						Action doIfChanged)
        {
            var prop = (PropertyInfo)((MemberExpression)propExpr.Body).Member;
            var field = (FieldInfo)((MemberExpression)fieldExpr.Body).Member;
            var currVal = (T)prop.GetValue(source, null);
            if (currVal==null && value==null)
                return;
            if (currVal==null || !currVal.Equals(value))
            {
                field.SetValue(source, value);
                var eventDelegate =
			(MulticastDelegate) source.GetType().GetField(
				"PropertyChanged",
				BindingFlags.Instance | BindingFlags.NonPublic).
				GetValue(source);
                Delegate[] delegates = eventDelegate.GetInvocationList();
                var args = new PropertyChangedEventArgs(prop.Name);
                foreach (Delegate dlg in delegates)
                {
                    dlg.Method.Invoke(dlg.Target, new object[] { source, args });
                }
                doIfChanged();
            }
        }

Now you can use a strongly typed NotifyPropertyChanged declaration without using your base class

    public class PersonStaticReflection : INotifyPropertyChanged
    {
        private string _firstName;
        private string _lastName;
        public string FirstName
        {
            get { return _firstName; }
            set { this.SetProperty(() => FirstName, () => _firstName, value); }
        }
        public string LastName
        {
            get { return _lastName; }
            set
            {
                this.SetProperty(() => LastName,
                                 () => _lastName,
                                 value,
                                 () =>
                                     {
                                         // do something useful here
                                     });
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }

For those concerned, you can statically cache the PropertyChanged field in a dictionary mapped to the object type so that you only have to reflect on it one time.

I guess I should give you some background before I go much further. The application we’re discussing here is called “Flow”. The name is metaphoric in several ways. The first metaphor is Flow as in a flow of thoughts or stream of consciousness. The second reference is to the work of Mihály Csíkszentmihályi, who has written a lot of books about the concept of “Flow” – a state of total immersion in one’s activities.

Stream of Consciousness

My first impetus in designing “Flow” was dissatisfaction with my browsing experience. I wanted an application that would capture my stream of consciousness as I browsed the web – creating a mind map if you will. For an example of what I mean, read one of Jeff Atwood’s posts and open a new tab for every link in the post (to keep it fair only use the self-referencing links you can also skip any links that you know are dupes). Then do the same for each tab you’ve opened. Once you’ve done that you’ve got a pretty good approximation of how my browser looks at the end of a given day.

image

Totally lost in my tabs is a good way to trace my path through coding horror. Imagine that my tabs represent a lengthy night of researching for a term paper, or digging into news on a company for deciding whether to invest my life savings in an IPO, or case research that could make sure that a defendant doesn’t get off on a technicality.

This idea really hit home with me and I started typing about it. 4 hours and one thousand words later, I had a vision for what for lack of a better term I called a Streamcatcher. Shortly after doing this, I received a newsletter from Infoq.com pointing to an article about stream-oriented User Interfaces (was it really back in July when I first started doing this). My jaw dropped. It was as if someone had read my vision and written an article about it. Further research revealed that the idea of a Stream-oriented UI has been around for quite a while now.

I started making a basic object model for an application that could visualize your browsing history as a graph of nodes and stumbled across a WPF panel for displaying a graph of objects. The next weekend I had a prototype browser that built the graph as you browsed.

Anyway enough blabbing from me. Here is the original prototype I made so that you can get a picture of where we’re going. Ignore the ribbon. It doesn’t do anything. I was just experimenting with it and never bothered to take it out. Also the network graph component that I’m using will expire in 30 days after you first use the app, making the application useless. There is no way to save your graph. Right now it’s just a prototype. I’ll be uploading the code to the Codeplex project and starting the new codebase there as well.

http://cid-2221dc39e0c749a4.skydrive.live.com/embedrowdetail.aspx/WPFSamples/FlowSetup.zip

To get started, place your mouse over the green dot and click on the button that appears. That will take you to google.com to start searching. An interesting search term is “flow psychology” (no quotes). I posted a video showing how flow works in an earlier post.

Now if you’ll excuse me, I have 40 tabs of Coding Horror to read.

Yes I know it’s February already, but this should show even more how big the start of this year has been for me. First and foremost is the big announcement that the new year brought.

MVP_FullColor_ForScreen

First and foremost, I’ve been named an MVP in Client App Development (for my community contributions with WPF). This is an incredible honor for me. In addition to the title, being an MVP provides me an opportunity to have better interaction and feedback with Microsoft especially with regards to my specialization. According to the program guidelines, the award is for my past activities and I am not required to do anything else.

However, I want to leverage this opportunity to the fullest and will continue my community contributions going forward, both with regard to WPF and Silverlight as well as with Windows Azure.

USAltNET

Second, as an organizer for our local Alt.NET User Group, Indy Alt.NET, I’m excited about a few recent developments with the group. Chief among those being named an official INETA group – something that surprised me seeing that there was already an INETA group in the Indianapolis area. We are coming on our first anniversary and have seen our attendance stabilize at around 25 per meeting. With almost a year under our belt we have sat down and started a few initiatives.

One major decision will be to incorporate as a non-profit organization (an idea we had thrown about for a while but were too busy with day to day operations to act upon). This action will allow us to apply for grants and begin some community outreach initiatives that we are all excited about. It will also make us more attractive to potential sponsors as certain donations to us will be tax deductible.

Another initiative has been a marketing and sponsorship drive. We are trying to grow organically, but we have noticed that we have a chicken or egg scenario. Therefore, we are pushing our growth on multiple fronts. So far we are getting good feedback from our efforts.

Our biggest initiative about which we are all very excited is planning for a local conference. More on that later 😉

SEP-logo

But wait there’s more! I just finished my first year with my current employer, Software Engineering Professionals. Management announced a number of initiatives here that are pretty exciting for me. I can’t necessarily talk about them right now, but it reaffirmed my decision to come here. I can honestly say that I have grown dramatically since I’ve been here. It is an amazing place to work, and I’m excited to see what the future has in store.

SEP-logo

Finally, my family is counting the days until our latest addition is expected to arrive.

Like I said, this year is starting off with a bang…and there’s more to come. I’ll keep you posted with new developments.

I’ve put a summary of the buzz around Windows Azure on my blog. Will be creating more content soon. Working on an Azure Based twitter aggregator to feed the sections of AzureCoding.Net Maybe with some sync thrown in for good measure. I’ll be posting back here with the UI related stuff. For the most part, you might want to start looking there for my Cloud Topics and here for everything else.

I am head over heels about Azure and the Live Services. I love it so much that I’ve gone ahead and registered http://www.azurecoding.net Depending on your pronunciation of Azure, you might chuckle at the name. So what are my goals for the site? I want Azure Coding .NET the place to go for news, articles, tutorials, and discussions about Windows Azure and the Live Services including Live Framework, SQL Services, and the .NET Services (we might even talk a little bit about how “Oslo” fits into the picture). I’m going to fire off the first few volleys with some in depth talks about Live Framework, and .NET Services.

Like desktop Windows development, there are too many specialty areas within the cloud development ecosystem for one person to be a master of them all. So I’ll be bringing some friends along. No matter how compelling the topic is, a website is only as good as its community. I will definitely look for ways to engage the community. Look for more on that later!

Okay…I couldn’t live blog the whole thing…there’s a lot to take in…but here’s the gist. Mesh takes care of a LOT of complex stuff so you don’t have to be concerned with it.

3:00 Introduction:
       
Mesh is a concept whose time has come
        It takes the Windows platform to the next level
        Allows windows to take advantage of the cloud and the many devices a user has
        This talk mostly about Mesh Architecture
3:04 Agenda
       User Experiences
       Concepts
       Architecture
       Planning and Deployment
       Implementation
       Operations, Experiences, Lessons learned
       Future
3:05 Quick Demo Using Mesh
3:10 Key Capabilities
        Provisioned State (Accounts)
        User-data storage (including replication and synchronization)
        Communications and presence (P2P when possible…fall back to relay when not)
        Notifications (Single channel for asynchronous push)
3:13 Provisioning in the Mesh
        Identity is provisioned during web signup
        Device provisioned during software installation
        Device claim – relationship between user and device established
3:14 REST in the Mesh
        Common metadata for all resources (Uri, LastUpdateTime, Etc.)
        Resource lives within collection (scope for grouping resources and tracking changes)
        Both resources and collections are represented as feeds and items
        Links allow navigation from one resource to another.
3:17 Provisioned State Services
        Account Service is a “Facade” for accessing accounts, devices, and apps.
        The client provides a local cache.
3:18 Folder Synchronization in the Mesh
        Items in data feed represent files (files are the resource)
        A data feed mapping tells Mesh that a given device wants to synchronize with a given feed
        Permission scope defined on mesh object for sharing feeds
3:21 Understanding FeedSync in the Mesh
       Bi-directional replication provided through schema and semantics.
3:23 Getting really deep into how Mesh client is implemented using the Live Framework
3:27 Architecting the Mesh Services for Scalability
       Primary scenarios for scalability concerns
       Startup
       Resource change (initiator)
       Resource change notification (recipient)
       Content replication
          This can take advantage of P2P scenario
3:31 Scale-out strategy
       Partition by user, device, and mesh object
       Use soft state to minimize i/o load
       leverage http semantics for caching, change notification, and incremental state transfer
3:35 How to Partition resources
       Every resource has a stable canonical URI based on its resource identifier
       Mapping a resource id to its home DC requires a lookup in a replicated database
3:37 General Design Principles
       Use commodity hardware
       Partition for scaling out
       Loose coupling across roles
3:38 Deployment
        2 Dual Core sockets
        8 GB RAM
        2TB HDD
        Windows Server
        New machine come on line…fabric is copied to it and it joins the cloud
3:43 Scale Unit Layout

Decided to do an Azure Hands On Lab. From my first steps with it, I’m impressed. Of course I’ve written what amounts to hello world…but from the Cloud 😉 Remember you can download the SDK from http://www.Azure.com now!

Well I have a night, a breakfast, and a flight standing between me and PDC 08. I’ve been totally excited about going since I conned convinced the job to send me (back in August I think). This is my first development related conference. There’s going to be a LOT of stuff to see, learn about, and interact with…and that’s not including the actual conference sessions.

A number of the WPF Disciples will be at the PDC (this will be the first time I’ve met many of them in person…save one). And we’ve planned some social events as well as shop talk events (although it might be difficult to distinguish the two).

I’ve entered Flow into the PDC Show Off contest…so if you’re at PDC, please be sure to come support me. Even if I don’t win, it will still be a great event to see what other people out there are doing with Technology.

I will live blog from the Keynotes and the sessions I attend. I will also provide a daily recap. In addition you can follow my Tweets (can’t believe I was the first to get that name), where I’ll inevitably be posting a quick OMFG reaction to things I learn. If you’re going to the Conference, look for me…I’ll have a (limited) supply of Brownie Point Badges to hand out…they will most likely come in useful at a later point in time.