Saturday, November 12, 2011

One of the primary goals for CSLA 4 version 4.3 (the next version we’ll be creating) is to improve the performance of the MobileFormattter that is used for Silverlight and Windows Phone applications. This is made all the more important, because it will also be used in WinRT applications in the future.

Sergey (a CSLA dev team member, and Magenic colleague) has been doing some heavy research into this area, and we’d originally thought to do the changes as part of the 4.2 release. It turns out that doing a really great job of optimization will require some breaking changes – at least for people who aren’t using managed backing fields. So we are deferring the bigger changes until 4.3.

In the meantime, Sergey has blogged about how to improve performance of MobileFormatter in 3.8 and 4 (4.0, 4.1, or 4.2). These are changes you can make to your CSLA codebase now if you want some of the performance benefits without waiting for the “big change” that’ll come in 4.3.

Saturday, November 12, 2011 12:41:27 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, January 18, 2011

csla_logo1_32I am pleased to announce the release of CSLA .NET version 4.1 with support for .NET, Silverlight and Windows Phone 7 (WP7).

You can download CSLA 4 version 4.1 at http://www.lhotka.net/cslanet/download.aspx

Although there are numerous new features in version 4.1, the primary focus of this release is Windows Phone 7. With CSLA 4 version 4.1 you can now author business classes that run unchanged across the entire .NET platform:

  • Windows Phone 7
  • Silverlight
  • WPF
  • ASP.NET MVC
  • ASP.NET Web Forms
  • WCF services (SOAP and REST)
  • asmx web services
  • Windows Forms

The ability to reuse your business layer on .NET, Silverlight and WP7 is incredibly powerful, enabling you to extend your application to users on Windows, the web, and now the phone.

You can learn how to use CSLA 4 to build scalable, flexible, and maintainable applications through the Using CSLA 4 ebook series. This ebook series is currently a work in progress and will be finished in the first half of 2011.

Tuesday, January 18, 2011 7:30:40 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
 Saturday, December 11, 2010

I have a WP7 device: the HTC HD7.

I’ve had it for a while now (since launch date in the US), but wanted to wait a little before blogging about it to really get a good feel for what I do and don’t like.

Also, by way of disclaimer, I’m coming to WP7 from Windows Mobile 6.5, so I can’t compare and contrast to other modern phones like iPhone or Droid.

In short, I really like Windows Phone 7, but there are better devices than the HD7 (unless you are on T-Mobile).

Coming from an older phone like I did, the new WP7 phone OS is remarkable. Wonderful. Truly a joy to use! And the HD7 has enough cpu, graphics and memory to make it fast and very enjoyable.

My only real issue is that the HD7 device’s camera button is so hard to push that it is almost impossible to take a good picture, which makes the camera nearly useless. That’s not the fault of WP7, that’s the fault of some HTC engineer with overdeveloped finger muscles or something…

The WP7 user experience is smooth and intuitive. It is loosely based on the Zune HD user experience, but Microsoft clearly learned a lot from the Zune HD about what did and didn’t work, and the phone’s user experience is consistently pleasant and easy.

One of the most touted features of the phone are the the “live tiles” on the home page. And they are nice. I’ve got mine customized to show phone, people, email and weather on the very first page, with messages and a few other commonly used items further down. There are a few other apps I’ve used now and then that I haven’t put on the home page, because it is just as easy to get to them using the voice navigation.

The cool thing though, is that the weather status and my wife’s Facebook status are shown on that front page through the live tiles, so the most important information is always right there Smile

I’ve downloaded some free and commercial apps from the Marketplace. That’s a seamless experience, and includes seamless updates of the apps as they become available. My only quibble with the Marketplace is that it doesn’t seem to filter between apps, music, videos, etc. So sometimes searching for an app can be tedious because it seems that a lot of songs use the same words in their titles, so it can take some time to sift through the songs to find the app you want…

In terms of apps, there are only three apps I am missing at this point:

  1. Bing (I want the voice-prompted navigation that comes with the Bing app – the built-in Maps app is ok for maps, but horrible for actual driving navigation)
  2. TripIt (the mobile web access is OK, but a smart client experience would be a lot better)
  3. EverNote (here the smart client (with offline caching of notes) is really important, and the web interface is a poor substitute – enough so that I’m considering migrating back to OneNote where I can share everything on my SkyDrive)

In terms of phone features, the only thing missing is tethering and/or using the phone as a wifi hub. My 6.5 phone did both of those things and I used them constantly, so losing this ability is a serious drawback. If I wasn’t such a Microsoft loyalist the lack of tethering would probably have prevented me from getting this phone – but as it is I’ve chosen to live with the pain.

On the other hand, the way WP7’s “hubs” integrate together is wonderful. The People and Pictures hubs, for example, automatically pull data from Facebook, Live, Outlook and so forth – automatically bringing together nearly all the information I care to see about everyone I interact with. This type of automatic data integration is amazingly useful, and directly increases my productivity from a business and inter-personal perspective.

And of course the fact that the phone is a Zune device (and so can use my beloved zune.net subscription) is just icing on the cake. While I still carry my Zune HD when traveling because it has enough memory to hold all my songs, I do have a couple Smart DJ playlists synced to the phone for times when I’m sitting somewhere and just need a little music. I always have the phone, but don’t always have the Zune HD.

Finally, there’s Netflix. The high-res screen on the phone makes watching video content reasonably enjoyable. Not comparable to a TV or even laptop screen of course, but certainly workable. So again, when I’m sitting somewhere and feel like a little diversion there’s always Netflix content available.

Would I recommend that someone get a WP7 device? Absolutely – WP7 is a joy to use!

Would I recommend the HD7? Probably not, but if you are on T-Mobile you are kind of stuck… And really, other than the stupid camera button, it is a perfectly decent phone (I really like the large screen and overall form factor).

Saturday, December 11, 2010 4:17:17 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [13]  | 
 Friday, December 10, 2010

Apparently music subscription services are struggling to gain traction

http://www.zdnet.com/blog/bott/more-itunes-alternatives-can-a-subscription-music-service-ever-succeed/2770?tag=nl.e539

I can understand that, because I was an anti-digital-music person for a long time. My thought was that I had no reason to pay for a music subscription when radio was free.

Of course radio isn’t free, and over time (as I’ve gotten older?) I find the DJ dialog and commercials on radio to be increasingly annoying. To the point that radio costs way too much – there’s less music than drivel and I just can’t take it.

The other alternative is to buy CDs, rip them and create your own collection. That way you “own” the music. And certainly compared to buying digital MP3s it is better to buy the CD. I’ve “purchased” digital music several times over the years, and several times I’ve had the originating company go out of business and so the DRM locked me out of my “purchase”. And I’ve had hard drive failures, and so lost my “purchase”.

Sure, a CD can get scratched, but if you buy a CD, rip it and then only use the digital copy, you always have the pristine master source, even in the case of hard drive failure.

However, a CD costs around $12, and zune.net costs $15/mo. So I can buy around 12-13 CDs each year, or I can spend the same money to have access to a few hundred thousand songs. Even over my entire lifetime, at 12 CDs per year I’ll never get a collection the size I have access to via zune.net.

So radio is out (because it just sucks), and buying CDs isn’t really cost-effective.

But there are streaming services like pandora and last.fm and others. They are free, or at least cheaper than zune.net, so why not use them?

I used to use pandora, but it started getting pretty flaky with its song selections. Lately I’ve been using last.fm because they came with my xbox gold subscription (and zune.net didn’t until recently). I like last.fm, they do a good job and they stream to my xbox and my Windows Phone 7.

However, streaming services don’t work when I’m on an airplane, in a hotel (you never get good bandwidth in a hotel), in northern Minnesota camping or fishing, etc. Basically they are for city people who don’t travel, not for people like me who travel and/or spend a lot of time in rural areas.

So how does zune.net differ from things like radio, CDs or streaming services?

For about $15/mo you get this:

  1. Access to several hundred thousand songs via streaming
  2. 10 free purchases (DRM free) each month (basically I get to “buy” for free almost an entire album every month)
  3. Smart DJ, which does what pandora and last.fm do: creating a themed “radio station” drawing music from my personal library plus the entire zune library (those hundreds of thousands of songs)
  4. The ability to sync Smart DJ playlists to my zune device or Windows Phone – so that music is available when I’m entirely offline

So think about this. For just over the price of a CD I get (more or less) a CD’s worth of music I actually own each month. I figure that’s $10 of the $15 covered each month right there.

But more importantly, for my other $5/mo I get unlimited streaming just like pandora or last.fm – and in a form that works when I’m entirely offline like on an airplane or sitting on a lakeshore in far northern Minnesota where there’s no cell coverage, much less Internet.

(it is this pure offline feature that even iTunes doesn’t have – and why zune.net is (for me) the ultimate solution)

In the end, yes, I understand the arguments against paying a subscription fee for music. But when compared to the alternatives, it has become clear to me that none of those arguments really hold water. The zune.net service is pretty much the perfect way to consume music.

Windows Phone | WP7 | Xbox | Zune
Friday, December 10, 2010 10:59:08 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [6]  | 
 Wednesday, October 27, 2010

The first WP7 app built by Magenic is now in the WP7 app marketplace: GuestList.

This app allows you to easily check in attendees at an event, using EventBrite as the backend service. You create your event in EventBrite, users register through their web site, and as they arrive at your event you get the attendee list on your phone, and easily check them in right there.

Chris Williams (Microsoft MVP and author of an upcoming WP7 developer book) did the development on this project, with assistance from Donn Felker (author of a similar app for Droid). Anthony Handley (from our Magenic Studios group) created the user experience flow and look and feel.

Very exciting stuff!

Wednesday, October 27, 2010 2:25:56 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [2]  | 
 Wednesday, September 01, 2010

Good news on the WP7 front:

Windows Phone 7 – Released To Manufacturing

And we know that the dev tools are planned for release in just a couple weeks – so this is all coming together fast.

Wednesday, September 01, 2010 2:47:02 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 

Lessons learned getting CSLA 4 to build and run in WP7.

  • Obviously WP7 is based on SL3, so SL4 specific code won’t work (which caused most of my initial build issues).
  • Human error plays a big role – I created several new projects for WP7, and even though they shared existing code files (via file linking), I forgot to set things like the assembly names and default namespaces – obviously that caused issues with serialization between client and server. Never underestimate the ability of the human to overlook simple things…
  • Don’t underestimate the impact of the tiny screen. While WP7 can run code from a full-screen app (the same business objects, etc), it is amazing how the need to fit into a tiny screen can impact the way you build your application!
  • VS10 doesn’t support signing assemblies, but you can do it by manually editing the csproj file.
  • VS10 doesn’t support resource files, but you can manually add a resx to the main project, then drag it into the Properties folder, then set the file’s properties (custom tool, etc) so it works correctly.
  • WP7 appears to throw different exceptions from .NET/SL for various things. There are a number of cases where I’m having to catch and rethrow exceptions to get the expected exception type – which is something I don’t need to do in .NET/SL. Since my unit tests often check for expected exceptions (testing failure conditions), I’m seeing a lot of these issues and having to tediously address them one by one.
  • VS10 crashes “for no reason” on some WP7 code. I have the same code in .NET, SL and WP7 and can walk through code in the debugger, but sometimes WP7 crashes Visual Studio – I assume this is due to the beta state of the tools.
Wednesday, September 01, 2010 12:24:12 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, August 10, 2010

I started by getting the CSLA 4 codebase (from Silverlight) to compile in WP7.

As an aside – working with WP7 is really a smooth experience. The emulator works quite well, and the debugging experience is comparable to working with Silverlight. I can see where it would be hard to debug/test things requiring touch or other device hardware, but for basic app development the process is quite enjoyable.

Then we got UnitDriven running in WP7 so I could run my unit tests.

Then I spent some quality time fighting with reflection. Over the years, as .NET has evolved alternatives for reflection, CSLA has adopted those alternatives; dynamic methods and now lambda expressions. The specific things CSLA is doing can’t be easily done using the DLR, or I’d consider using that approach.

But WP7 is based on Silverlight 3, which predates the cool stuff in Silverlight 4. That means that the lambda expression concepts used in CSLA 4 wouldn’t build in WP7 – so I basically put TODO comments in their place to get the codebase to compile. Then I went back through and dug up the older 3.x code and tried to just plug it in, replacing the TODO comments.

That turned out to be a little harder than I expected. As part of replacing reflection, we enhanced the functionality of some of the code in CSLA 4, and the 3.x code didn’t handle all the same scenarios. I don’t want my WP7 code to be incompatible with the .NET/SL implementations though, so this basically meant rewriting the 3.x reflection code to support the CSLA 4 functionality.

After a few hours of work all my dynamic method calling unit tests now pass (except for the one that proves that dynamic method invocation is faster than reflection – obviously that one has no meaning in WP7 at the moment). That’s a relief, as it means that essentially all the core functionality of CSLA 4 now works.

With the notable exception of the data portal. It isn’t clear yet what’s failing, but it appears to have something to do with type resolution. I know that Silverlight and .NET don’t work the same in this regard, and I’m beginning to suspect that either I need to revert some other code back to 3.x, or that WP7 doesn’t act the same as Silverlight 3 or 4.

In any case, this is all very encouraging. I am now quite confident that we’ll be able to take CSLA 4 business classes from Silverlight and run them in .NET or on WP7 without change. Just think about building a business class and knowing that it can be used to create Silverlight, ASP.NET MVC, WP7, WPF, WCF, Web Forms, Windows Forms and asmx interfaces! Too cool!!

Tuesday, August 10, 2010 7:02:49 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [3]  | 

I am working on CSLA 4 for Windows Phone 7. Of course I want to get all my unit tests (or most of them anyway) running on WP7.

When we created CSLA .NET for Silverlight it was long before Silverlight 2 shipped, and there was no workable unit test framework for Silverlight. Even today, it is tricky to test async methods and features with mstest in SL. Perhaps most importantly however, I wanted to have the same exact unit test code running in .NET and Silverlight – and that’s a level of parity that is hard to achieve.

So Justin created UnitDriven and we donated it to the community through codeplex: http://unitdriven.codeplex.com.

And I have a few hundred unit tests for CSLA that rely on UnitDriven, so it isn’t a trivial thing to think about switching to something else – so it is important that UnitDriven work on WP7 too.

Fortunately Justin was able to get this done in an evening. It turns out that the only major change required was to the UI, because obviously the WP7 form factor is very space constrained compared to a full-size screen.

The end result is that there’s a preview release of UnitDriven that works on WP7 – you can download it from codeplex.

Most of my CSLA unit tests are passing at this point, which gives us some confidence that UnitDriven is working as expected. There are some UI issues still, especially with long test names and some scrolling issues.

But if you are looking for a way to write unit tests for your WP7 Silverlight code, and especially if you want to use the same unit test code on .NET, Silverlight and WP7, then UnitDriven is something you should consider.

Tuesday, August 10, 2010 1:22:31 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, March 16, 2010

Hopefully this can save someone some time. I spent a couple hours setting up a virtual machine and installing the Windows Phone 7 dev tools, only to find that the phone emulator won’t run in a virtual machine. It turns out that this is because the emulator is a virtual machine and you can’t run a virtual machine in a virtual machine.

Tuesday, March 16, 2010 10:45:59 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [6]  |