Friday, July 23, 2010

Silverlight TV: Understanding the Value of Prism

I was recently interviewed on the Silverlight TV show hosted by John Papa and the episode went live today.

http://channel9.msdn.com/shows/SilverlightTV/Understanding-the-Value-of-Prism-Silverlight-TV-37/

In the interview, we discuss some of the motivations for adopting Prism:

  • Managing large projects
  • Distributed teams
  • Packaging functionality for different deployments per customer
  • Separation of concerns for maintainability
  • Testability
  • Extensibility

I quickly walk through the features and how they manifest themselves in your solutions. I also discuss a little of what the team is working on in Prism 4 – specifically the MVVM pattern and using MEF for modularity.

Check it out and let me know what you think!





Friday, July 23, 2010 12:59:18 AM (GMT Standard Time, UTC+00:00)
Comments [3]  | 


  Thursday, July 15, 2010

San Diego Connected Systems/Architect SIG – Slides and Demos

Last night I spoke to a great crowd at a joint meeting of the San Diego Connected Systems and Architecture SIGs. I talked about WCF RIA Services and focused on the internals of what is going on with deferred execution queries, metadata for entities, and the services under the covers, as well as exposing OData, SOAP, and JSON endpoints and consuming them.

Here are the slides and demos.





Thursday, July 15, 2010 2:18:29 AM (GMT Standard Time, UTC+00:00)
Comments [0]  | 

Los Angeles .NET Users Group Slides and Demos

I gave a talk on Monday evening at the Los Angeles .NET Users Group on WCF RIA Services, MVVM, and MEF. I was insanely ambitious thinking I could cover all those in one talk, but it was a fun talk nonetheless. It was a very interactive crowd with a lot of great questions about Silverlight in general, RIA Services, Entity Framework and other broader technology topics.

Here are the slides and demos.





Thursday, July 15, 2010 2:10:03 AM (GMT Standard Time, UTC+00:00)
Comments [0]  | 


  Sunday, July 11, 2010

Interview on the Silverlight Show

In conjunction with the 10 part series on WCF RIA Services in am part way through writing for the Silverlight Show, I also did a short interview with them about RIA Services, Silverlight in general, and my background. You can find that interview here: http://www.silverlightshow.net/items/SilverlightShow-Interview-Featured-Article-Author-Brian-Noyes.aspx





Sunday, July 11, 2010 2:32:28 PM (GMT Standard Time, UTC+00:00)
Comments [0]  | 


  Thursday, July 08, 2010

Windows to Mac transition – Not for me

Not too long ago I made the plunge and bought a MacBook Pro, the first Mac I have ever owned. I did so for two reasons. First and foremost, I am starting to develop applications for the iPhone and iPad (two devices I can’t live without), and developing on a Mac is the only choice thanks to the closed platform and development tools approach of Apple. Secondly, I thought it would be interesting to see what computer life is like on the other side of the fence. I’ve heard so many stories of how great the Mac is, I thought I would try to experience it first hand.

So for the last month I have tried using my MacBook Pro as my primary machine – not booting to Windows, but running Mac OS X and using Parallels to get to the Windows apps I can’t live without.

After a month, I’m switching back to my Dell Latitude E6500 as my primary machine and my MacBook Pro will just be used for reason #1 – developing for iPhone/iPad.

When I tweeted (@briannoyes) that I was switching back, I got a lot of “why??” questions, so I thought I would share my experience for others who are pondering a similar change.

Some important caveats up front:

  • I am first and foremost a Windows developer and software architect. That is my profession and my passion and what I have been focusing on for almost two decades.
  • I have dozens of Windows applications that I used at least once a month and at least 20 or so that I use every week. While I realize there are many equivalent Mac programs for many of those, I don’t want to have to buy all of those, and for many there is not (i.e. Windows development tools).
  • I don’t just work on one machine and have no intention of switching all of my computing to Apple. While I love my iPad and iPhone, I have a Windows 7 desktop machine in my home office that I use when not traveling, and when traveling (75%+ of my time) I often carry a second laptop for various reasons and that one would certainly be a Windows machine.
  • From a performance perspective, my point of comparison and what I have switched back to is a 6 month old Dell Latitude E6500 that is maxed out. My MacBook Pro has slightly better hardware specs (i7 processor), but same 256 GB SSD drive and 8 GB memory.
  • I was afraid of using Boot Camp to boot to Windows directly because of witnessing and hearing about numerous projection issues when running Windows through Boot Camp on Mac Books. A significant majority of my professional work involves projecting (teaching, consulting, presenting at conferences and user groups). I can’t travel with a machine I can’t trust will project anywhere through any projector with no issues.
  • I’ve been using Office 2010 for a while, so that is my standard of comparison for routine business tasks (email, writing, presentations, spreadsheets).

So what did I like:

  • General user experience is very nice at the OS level.
  • iTunes runs much smoother on the Mac than on Windows
  • Parallels integration with the Mac OS is very smooth and seamless
  • Er… ummm… OK, nothing else jumping out that I found superior to anything I do on Windows 7.

What I did not like:

  • Built in apps (email, calendar, etc.) had no where near the functionality or user experience of Office 2010. Office 2008 for Mac is not as good either, and I still have to co-exist with several Windows PCs. Worrying about file conversions and potential data loss is just not worth it.
  • A lot of my Windows apps could not run from the shared Mac OS folders, so had to move things onto the virtual C: drive a lot to get things to run, aggrevating file synchronization issues and leading to duplicate files and drive usage.
  • Keyboard lacks many common keys that PC keyboards have (Del, Home, End, PgUp, PgDn, etc). You have to use the Fn key to get other keys to do those things, and you have to use the Fn key to get the function keys to act as function keys instead of volume, etc shortcut keys. These keys are all way too important to me as a coder to have to use the extra key to get to them, especially since I also work a lot on PCs and have to switch my brain back and forth. Likewise the differences of what the Control, Alt/option, and Command keys do in Mac vs Windows (in parallels) drive me bonkers trying to keep straight. Many a wasted minute thinking I copied things to the clipboard and I didn’t or getting things to select correctly.
  • Perf: even though the Mac had a better processor and equal memory / disk, everything felt a lot more sluggish on it, and I’m not just talking about the Windows apps running in Parallels. Copying files to external USB drives (which I had to do a lot for syncing files between machines) was significantly slower than on PC.
  • File synchronization: I use Dropbox to sync files between my machines, but the difference in file systems led to some oddities that that were annoying at best and could lead to data loss if not closely managed. Syncing with external drives also took closer attention than I wanted to give it. I don’t want to have to think at all about moving files around, and from PC to PC I don’t.

So bottom line, I decided I can’t live on a Mac as my primary machine for the reasons outlined above. I am convinced that if you only have to use one machine and are willing to invest in getting all the apps you need as Mac apps, and can live 80% or more of your computer life using Mac apps, then it is a nice platform. That is just not me, so I am happily back in my comfort zone on all Windows 7 machines + a MacBook Pro as an iPad/iPhone development box.





Thursday, July 08, 2010 4:55:03 PM (GMT Standard Time, UTC+00:00)
Comments [3]  | 


  Monday, July 05, 2010

WCF RIA Services Part 3 – Updating Data

The third part of my series on WCF RIA Services went up a few days ago, you can check it out here:

http://www.silverlightshow.net/items/WCF-RIA-Services-Part-3-Updating-Data.aspx

This one starts off with a quick coverage of one important aspect of querying that I did not have room for in Part 2 – expression trees and deferred execution, and what they can do for you with RIA Services. I show how you can formulate a query on the client side based on the expression tree returned by a query method and that is what executes on the server side.

Then I get into the way updating (insert, update, and delete really) works in RIA Services. I discuss the way the domain context caches data and tracks its changes, and then only sends the modified entities back in a batch when you call SubmitChanges on the domain context. I also talk a little about the async API of the domain context, which I then followed up on with this post:

http://www.softinsight.com/bnoyes/2010/06/29/QueryingWCFRIAServicesAndHandlingAsyncResults.aspx

Enjoy!





Monday, July 05, 2010 7:23:02 PM (GMT Standard Time, UTC+00:00)
Comments [6]  | 


  Tuesday, June 29, 2010

Querying WCF RIA Services and handling async results

I had a good question in the comments of Part 2 of my series on WCF RIA Services that I thought I would answer here so more could find the information.

To paraphrase the question: “How can I retrieve a set of entities into my client and process them when the retrieval is complete?

I didn’t go into detail on the latter part of this in the article because of space limitations. But basically the answer is that you can be notified of the completion of any async operation (Load and SubmitChanges primarily) that you call on a RIA Services domain context. There are really two programming models, but I’ll just show one for now as the other is very similar.

When you call DomainContext.Load, RIA services executes the retrieval in the background and the call is non-blocking to the calling thread. But often you need to get those results, do some processing on them, and then move on to make another query or do something else.

An easy way to handle things is to use an overload of Load (and SubmitChanges) that takes a callback delegate that will be called when the async work is complete. This model is slightly different than the two other familiar async patterns in .NET: BeginXXX/EndXXX method pairs and XXXAsync/XXXCompleted method/event.

In the RIA Services async pattern, you can pass an Action<XXX> delegate to the async method you are calling, and that target method will be executed when the async operation is complete. It will pass you results and any error information if applicable.

In the case of a Load call, the code would look something like this:

private void RetrieveAndProcessTasks()
{
    TasksDomainContext context = new TasksDomainContext();
    EntityQuery<Task> query = context.GetTasksQuery();
    Action<LoadOperation<Task>> completeProcessing = delegate(LoadOperation<Task> loadOp)
    {
            if (!loadOp.HasError)
            {
                ProcessTasks(loadOp.Entities);
            }
            else
            {
                LogAndNotify(loadOp.Error);
            }

    };
    LoadOperation<Task> loadOperation = context.Load(query.Where(t=>t.EndDate > DateTime.Now),completeProcessing,null);
}

private void ProcessTasks(IEnumerable<Task> entities)
{
    // Do what you need to do
}
private void LogAndNotify(Exception error)
{
    // Log the error and notify user if appropriate
}

Before calling Load on the domain context, you set up an Action<LoadOperation<T>> delegate to point to a handling method with the signature void TargetMethod(LoadOperation<T> op). In this example I do that with an anonymous method that checks whether there are any errors, and if not hands off to a processing method the entities that were returned. If there is an error, it hands off the Exception to a handling method as well.

Then it is just a matter of calling Load and passing that delegate as a second argument (the first is always the EntityQuery you want to execute), and a final argument that is an arbitrary state object, similar to the Begin/End signatures of the original .NET async pattern.

Unfortunately there is no easy way to shield you entirely from the async nature of service calls in Silverlight if you want to do something other than data bind to the results immediately after the load occurs.





Tuesday, June 29, 2010 8:10:25 PM (GMT Standard Time, UTC+00:00)
Comments [4]  | 


  Friday, June 25, 2010

Part 2 of my WCF RIA Services article series is up – Queryng Entities

AS I’ve mentioned in a previous post, I’m writing a 10(+?) part series on WCF RIA Services on the Silverlight Show site. The second article is now available here:

 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx

This article shows goes into more depth on defining query methods in your domain service and how to execute them programmatically on the client.

So check it out!





Friday, June 25, 2010 5:39:37 PM (GMT Standard Time, UTC+00:00)
Comments [2]  | 


  Saturday, June 12, 2010

WCF RIA Services Part 1 published

I’ve published the first in a series of ten articles on WCF RIA Services over on the SilverlightShow. This one just runs through the key concepts and a simple end to end demo. Future articles will dive into the specifics of all the various capabilities of WCF RIA Services. You can find the full article here:

http://www.silverlightshow.net/items/WCF-RIA-Services-Part-1-Getting-Started.aspx





Saturday, June 12, 2010 8:14:25 PM (GMT Standard Time, UTC+00:00)
Comments [5]  | 

NOVA Code Camp: Separate Your Concerns with MVVM

I gave a talk today at the NOVA Code Camp on the MVVM pattern in WPF and Silverlight.

Some of the key highlights and takeaways are:

  • MVVM is based on the Presentation Model pattern
  • MVVM is all about separation of concerns and loose coupling
  • The ViewModel’s responsibility is to offer up state to the view in the way the view wants to see it
  • The ViewModel contains and manipulates state
  • View.DataContext = ViewModel is the relationship between view and ViewModel
  • The View data binds properties on elements to properties on the ViewModel
  • The View elements fire commands via data bindings on command properties on the ViewModel to manifest behavior in the ViewModel
  • Parent ViewModels can contain child ViewModels to allow the views to compose via DataTemplates
  • ViewModels can contain logic that manipulates the state including loading/updating state, validating state, computing values, and other kinds of logic that is not readily accessible in the model

A good source of info and examples on MVVM is the upcoming Prism 4 release, which already has public drops that include the MVVM QuickStart and a future drop will contain a more complicated MVVM Reference Implementation (bigger sample).

You can grab the slides and demos here:   Slides    Demos





Saturday, June 12, 2010 8:05:12 PM (GMT Standard Time, UTC+00:00)
Comments [9]  | 











Ads by Lake Quincy Media









Sign In
Copyright © 2006-2007 Brian Noyes. All rights reserved.
Advertise on this site through Lake Quincy Media
designed by NUKEATION STUDIOS