Live Framework CTP #8: MeshPhotoShare demo app

During the last few weeks I wrote a little meshified photo sharing application, which I want to share with you now.

It’s named MeshPhotoShare (download Version 0.1 beta 1 from here), it’s written under the use of C# 3.0, .NET 3.5 SP1, Silverlight 2 and the Live Framework CTP January SDK.

MeshPhotoShare allows you to:

  • administrate simple unsorted lists of photos: add new photos, delete old ones and modify title and description of a photo as metadata,
  • run the application from the Live Desktop or locally and offline (if you have the Live Framework Client installed),
  • share the application instance with other users over the app sidebar: those users can see and manipulate the same data as you can,
  • edit your photo collection simultaneously with other users: open the application with them in parallel and see changes that they make immediately on your application instance of MeshPhotoShare.

MeshPhotoSahre makes use of the following Mesh features: a) Media Resource for storing photo files, b) UserData for saving the photo’s metadata, c) hooks ChangeNotificationReceived on the DataEntries collection for simultaneous editing experience.

And that’s what MeshPhotoShare currently looks like:

MeshPhotoShare application

There are some issues in the current version, that mainly come from the current Live Framework release. Thus, the application freezes in Internet Explorer, because of the use of ChangeNotificationReceived. Furthermore when run locally, there may be some strange behavior and sometimes you’ll get some exception messages coming from the Live Framework. I hope that this will be fixed in the future, I will do my best to improve the app as well.

I’m happy about your comments and further discussion, thanks!

Download MeshPhotoShare v0.1 beta 1: http://www.leading-edge-dev.de/stuff/Mesh/MeshPhotoShare_v0.1b1.zip

kick it on DotNetKicks.com

C# covariance and contravariance

Hey guys. Sorry that I was not posting bigger stuff for a long time. I’ve had some personal time-eaters during the last months, but I hope it will get better soon. Today’s topic during this article is covariance and contravariance in general and especially in C#. What is it? Who needs it? How is it supported today? How will it be supported in C# 4.0? Answers have to be found…

So, covariance and contravariance are features of a programming language’s type system (not limited to C# at all). More precisely (and theoretically), they are characteristics of binary operators, which convert one type to another type. Generally if an operator changes the type in some kind, it’s called variant. If it retains the type (the type is fix), then it’s called invariant. Two types of variant operators are contravariant and covariant operators. In fact, there are other types of variance (consider dynamic typing, duck typing etc.), thus covariant/contravariant operators are just two examples for that. If an operator orders types in the way from general to more specific for any type, then it is called to be covariant. If it orders types reversely from specific to more general, then it’s contravariant.

So far the theoretical introduction. It’s pretty much saying nothing about what both terms mean in your practical coding life, isn’t it? Well… in programming languages there are two features where co- and contravariance can make sense: return type covariance and parameter type contravariance.

Return type covariance

Let’s consider the interface IClonable for a moment. It’s declared as:

public interface ICloneable
{
    object Clone();
}

If we want a class Foo to implement this interface, then it has to apply the exact same signature:

public class Foo : ICloneable
{
    public object Clone()
    {
        Foo clone = new Foo();
        // cloning implementation
        // ...

        return clone;
    }
}

Wouldn’t it be nice to have a method public Foo Clone() instead? That’s what return type covariance means. With this, the return type would be narrowed by more specific implementations or derivations. It would give type-safety to all callers of the method. Yes, this would be nice, indeed. But that’s a feature, which is currently not implemented in the C# language. The more general return type in the interface or a base class can not be narrowed on implementing or deriving classes. The same problem arises in a number of cases and on generics, as we will see later on.

Parameter type contravariance

If we got a method on an interface or base class which takes a parameter X, then contravariance is all about wanting a more general parameter in the implementation method of that interface or in a derived class. C# doesn’t support that, yet. For example, the following will not work:

class Fruit { }
class Apple : Fruit { }
class Cherry : Fruit { }
class FlavorComparer : IComparer<Fruit> { ... }

public void SortApples()
{
    List<Apple> apples = GetSomeApples();
    IComparer<Fruit> flavorComparer = new FlavorComparer();
    apples.Sort(flavorComparer);
}

FlavorComparer compares two fruits based on their flavor. Apples are fruits, so why shouldn’t they be sorted with use of the FlavorComparer? This would be nice, but Sort() needs a IComparer<Apple> and not the more general argument IComparer<Fruit>. It should be no problem for using the more general comparer, but C# doesn’t support this at the moment.

Covariance on arrays

Since the first C# (1.0), covariance on arrays is supported. Thus, one could write:

Fruit[] fruits = new Apple[10];
fruits[0] = new Cherry();

An array of a reference type can be viewed as an array of its base type or any implemented interface. That’s no problem for the compiler, it just works. But at runtime, that example would produce an ArrayTypeMismatchException and that’s what one would expect in this example. Creating apples and setting one to a cherry is no good idea.

Well, but why does it compile? That’s a historical problem. In the first version of C#, it has been designed to attract as many developers as possible and since this type of covariance worked in Java, the C# guys applied it to their language as well. Not that good idea, but that’s another story…

Covariance and contravariance on generics

Generics in C# 1.0 to 3.0 are invariant (fix). If we map the array example to generics, then the following code will not work:

List<Fruit> fruits = new List<Apple>();
fruits.Add(new Cherry());

In this case, there’s no exception thrown at runtime, but already the compiler comes up with an error message at the first line. Invariance on generics is a serious limitation of current C# versions, since it doesn’t allow many intuitively correct cases.

For example, if you have a method List<Fruit> GetFruits() on the Fruit class, which gets overridden by the Apple class, then you can’t return an instance of List<Apple>, which should be no problem intuitively. The following code on Apple is not working:

public List<Fruit> GetFruits()
{
    List<Apple> fruits = GetApples();
    return fruits;
}

The same problem arises, if we want to have a list of fruits, which should be a Union of apples and cherries, which are both fruits…

List<Fruit> fruits = new List<Fruit>();
List<Cherry> cherries = GetCherries();
List<Apple> apples = GetApples();

fruits = fruits.Union(cherries).Union(apples);

This or similar code doesn’t work as well.

C# 4.0

Having all that in mind, C# 1.0-3.0 is some kind of nerving limited in terms of covariance and contravariance. It has covariance on arrays of reference types and C# 2.0 introduced covariance and contravariance on delegates (which obviates some really annoying workarounds), but at the whole there should be better language support of those type-system features.

But a knight in shining armour is approaching: C# 4.0 arises on the horizon! But does it hold what it looks like? In fact, with C# 4.0 you have the in and out keywords, which you can define on type arguments of interfaces and delegates.

With the out keyword you can define a type parameter to be covariant. This means, that implementations of methods which return an object of this type can also return a more specific type. The standard example in this case is IEnumerable<out T>:

public interface IEnumerable<out T> : IEnumerable
{
    IEnumerator<T> GetEnumerator();
}

public interface IEnumerator<out T> : IDisposable, IEnumerator
{
    T Current { get; }
}

This allows you to write e.g.:

IEnumerable<object> list = new List<string>();

and

IEnumerable<Fruit> fruits = new List<Apple>();

It allows you to have a base type as type parameter of an IEnumerable instance and a more specific type if you assign something to it. But wait: there’s a limitation on that… out T means: no method in this interface is allowed to use T as parameter! The word „out“ makes this clear and it limits the use of those covariance to just a few interfaces. For example, this cannot be set on the ICollection<T> interface (and furthermore on IList<T>, because of IList<T> : ICollection<T>). ICollection<T> includes a method Add(T item) and since no T is allowed to be used when out T is declared, that wouldn’t work. Now, most of my own generic interfaces and many .NET interfaces as well use type parameters as in- and output, so this new type of covariance seems to be not this influencing. For example, the following code would not work:

IList<object> list = new List<string>();

But why? There’s an important aspect on that and that is the same as on the array example in the paragraph „Covariance on arrays“. Having the Add() method, one could add an instance of type object to the list and that has not to be allowed:

IList<object> list = new List<string>();
list.Add(new object());  // mustn't be allowed

Sure, that’s a big limitation, but it makes sense and is absolutely necessary!

The same comes true for the in keyword. One can define an interface with type parameter in T. With that, T can only be used as type parameter and not as return value. But this brings contravariance on the type parameters to life. Having the FlavorComparer example from above in mind? That will work, if IComparer<in T> is declared by the .NET framework. The limitation of T to be set as method parameter only is necessary due to the same aspect as for the out keyword. If IList<in T> should have been declared and one defines a variable IList<string> list and calls list.Add(new object()), then it would make no sense to iterate through all list elements as string, because the inserted object is no string and would cause problems.

So in the end, the knight’s armour is not that shiny. C# 4.0 comes with some nice covariance and contravariance features, but the out and in parameters are fairly limited (and using them together is (luckily) not allowed). Many people are annoyed about that, but I don’t share their opinion. It’s a good thing to have covariance and contravariance on type parameters separated from each other! Else this would produce heavy problems as we have seen in the examples above and in the array covariance section. My opinion is, that the language designers have done a good job here. I don’t want to have some kind of ArrayTypeMismatchException on generics and thus in/out on type parameters are a good thing.

Links:

kick it on DotNetKicks.com

Live Framework CTP #7: data handling possibilities

Just a link to a great forum’s post for today. Rajan Dwivedi answered in very detail on my question about data handling possibilities in the Live Framework. Here’s the link.

In short, you can (mainly) handle your data by using:

  • UserData
  • Attribute Extensions
  • Element Extensions
  • MediaResource
  • SyndicationLink

Read Rajan’s great answer and you will learn more about that. I hope that I’ll find some time to blog about this in the near future, but I can’t promise.

Update of the Live Framework Tools: January CTP

Already on the last Friday (January 31th), the January CTP of the Live Framework Tools for Visual Studio have been released and can be downloaded from here. There are a number of major bug fixes and improvements in this release, including (taken from here):

  • Debugging or running a Mesh-enabled Web Application which contains no changes from previous versions immediately launches the application instead of re-uploading the files.
  • Mesh-enabled Web Applications created by the Live Framework Tools now have identical offers to those created through the Azure Services Developer Portal, which are generally less restrictive.  This change removes the need for the workaround mentioned in this thread.
  • Projects created by the Live Framework Tools may now contain periods fixing the issue reported in this bug.
  • Changes to the application’s logo.png file will now be reflected in the icon that appears on the Live Desktop fixing the issue reported in this thread.
  • Error messages and diagnostics have been improved.  In certain error situations additional information can now be located in the application event log.

On ASP.NET MVC

In this article, I want to give you some information about my experiences with the Beta-version of ASP.NET MVC. During December, I had the chance to build up an application for the administration of media elements with ASP.NET MVC and thus I got a good insight in various topics.

What is ASP.NET MVC?

ASP.NET MVC is Microsoft’s interpretation of the well-known MVC architectural pattern, bringing MVC to the ASP.NET world. It is MVC for the presentation layer, not for the whole application (that should be true for most applications). Furthermore, it is not a top part of classic ASP.NET, but it’s a completely new approach for designing/creating web applications. This implies many changes and makes ASP.NET MVC very different from classic ASP.NET in many ways.

Comparison to ASP.NET „classic“

The MVC pattern follows a strict separation of concerns principle. The Model should include the business logic and is being invoked through the Controller, which is responsible for retrieving data, choosing and calling Views with that data and handling user requests. Views include only view logic and are creating/formatting the output for a user.

ASP.NET MVC tries to overcome the disadvantages of web-forms based programming by ASP.NET. Those come mainly through the purpose of ASP.NET to make web application development feel similar to win-forms based development and thus to make the access for Windows application developers more fluent. That’s a good intent, but it brings many problems to life, because we are not in a stateful Windows application, but in a stateless web environment. While classic ASP.NET developers try hard to get a good separation of concerns to work, logic is often put too much in code behind. Furthermore, ASP.NET tries to emulate stateful behavior through saving a client-based ViewState as hidden field, which can become really big and can waste page sizes. Other problems include difficult Ajax handling, missing full control over page rendering (especially when you use web-forms) and a complex page lifecycle, which is difficult to understand and to use sometimes.

I’m thinking of ASP.NET MVC as kind of „back to the roots“. For many things you have to do more handwork, where ASP.NET gives you more comfort respectively didn’t require deep knowledge of web technologies and protocols. The intent is to give you full control of the HTML markup, but it implies that you create this markup at your own. Basically, you don’t have most of the well-known ASP.NET controls. Repeater control in ASP.NET? It’s named „foreach loop“ in ASP.NET MVC 😉 . GridView in ASP.NET? Use a foreach and a HTML table in ASP.NET MVC. That sounds cruel for most developers I spoke with about this topic. In fact it’s not the whole truth. There are some so-called „helper objects“ exposed in the views, which encapsulate basic (e.g. HTML) functionality and can be used instead of the real markup. Everyone can build up his own helper methods by using standard C# extension methods and thus extend their functionality for his own needs. Currently the helper methods cover mainly basic HTML functionality like list boxes, check boxes, buttons, forms etc.. Advanced controls are missing (yet), but it’s only a matter of time when others will provide them. The community project MvcContrib has done first steps in this direction and provides a Grid control, for instance. It’s not perfect, but it’s pretty nice code and shows up how controls can look in ASP.NET MVC. The fact why you can’t use most of the classic ASP.NET controls is that you don’t have ViewState and postbacks anymore. This implies that you can’t use any controls that rely on those principles. It forbids to use event based programming as well. Thus if you want to post form values back to the server, you have to create an HTML form and a controller action which can handle the POST verb. Thankfully there is a nice data binding concept, that gives you some support on dealing with this. If you want some kind of dynamic loading as can be done by event-based programming, use Ajax for that. ASP.NET MVC is introducing many new concepts as well: URL routing, TempData/ViewData, Helper objects, data binding, validation, … these are only some topics which you have to understand, if you are starting with ASP.NET MVC.

Beside those heavy changes and differences there are similarities to ASP.NET, too. Thus you are able to use the standard ASPX markup, which is available as standard view engine in ASP.NET MVC. Anyway, you can use most core ASP.NET features like authentication, role handling, Session, Caching etc..

In the whole, ASP.NET MVC gives you a much lower level of abstraction from basic HTML, which some will like and others not. Scott Hanselman got to the heart of that when he stated:

This is a not just a different tune, but a whole different band playing all new music. Not everyone will like the music, and that’s why the world has more than one band. This is a Good Thing.

I like to think of ASP.NET MVC as the raw, acoustic version of the more heavily produced and multi-layered ASP.NET WebForms we use today.

And to avoid misunderstandings: ASP.NET MVC isn’t there to replace standard ASP.NET. Instead it makes an alternative programming model and both technologies will be developed further by Microsoft in the future.

What music do you like?

To choose either ASP.NET or ASP.NET MVC depends on what you want to do. Nick Berardi developed a nice decision table which guides you on your choice.

Following that and my own experiences you should use ASP.NET MVC, if you want:

  • test-driven development, including your UI,
  • separation of concerns through the MVC principle with all goods, that are implied through this (logic at places where it should be, nicer architecture etc.),
  • improved team development, where different team members are responsible for different parts of the UI (Models, Views and Controllers),
  • RESTful URLs,
  • multiplicity of Views (e.g. for different output devices like PC, mobile, printer, …),
  • full control over your markup, clean and tiny HTML pages.

ASP.NET should be used in case you want to:

  • be productive in a short time (RAD/prototyping),
  • develop data centric applications (ASP.NET MVC is not the best for that due to the missing data-centric controls (at the moment) and missing data source controls),
  • make use of complex web forms (includes existing 3rd party controls),
  • use the event model,
  • get a fast entrance to web application development.

My opinion

Personally I like the development in ASP.NET MVC. It gives me more freedom than classic ASP.NET and I feel more home in there. ASP.NET MVC is in my opinion a step in the right direction. The loosely coupled components give you the flexibility to exchange or extend parts of the framework as well as to fake things out and test parts of your code separately. A main point that Microsoft has done right is to include the community in the development process and to consider their needs. The open source community project MVCContrib shows this direction of actively including the community. Furthermore, ASP.NET MVC comes with jQuery, built-in jQuery support and jQuery intellisense. Microsoft promises to support jQuery and to contribute improvements back into the jQuery development in the future. That’s a huge turnaround for Microsoft, which was fighting Open Source heavily not long ago. I think, other development teams at Microsoft should follow this example. For instance, the ADO.NET team has created so much distrust while developing the Entity Framework at its current state and it’s not much caring about community needs. Guys, time to re-think!

On the other hand, there are many things for you to dislike ASP.NET MVC. Through the lower level of abstraction and the missing ASP.NET controls you could miss some kind of comfort while creating your web applications. Furthermore, there is no direct „upgrade path“ for learning ASP.NET MVC if you have developed ASP.NET so far. For beginners in web-based application development, there is a very steep learning curve, because you have to be aware of the stateless programming model and basic technologies like HTML, CSS, HTTP and so on.

One thing to mention is that ASP.NET MVC is still in development. At this time, the RC has been released and V1 will follow in February 2009. For me and many others, ASP.NET MVC V1 is not a complete framework out-of-the-box, it’s more a basic framing which doesn’t limit developers in most things. It gives them the freedom and possibilities to realize their own opinions and principles. Phil Haack got the point:

In part, you can look at v1 of ASP.NET MVC as a Framework for building ASP.NET MVC Frameworks.

That’s a thing which I can truly sign. And it’s leading the future development. In my opinion there will come developers and build up their own frameworks on top of ASP.NET MVC, making them more narrow and including their own principles. And ASP.NET MVC allows them to do this. Moreover, that is why the ASP.NET MVC developers didn’t make their framework very opinionated. At every point there are many degrees of freedom and some people are frustrated about that, because it allows everyone to create bad code. But it’s a good thing, if others come and make their frameworks on top of ASP.NET MVC really opinionated. It’s easing the way for those people and thus I’m applauding the ASP.NET MVC team. I’m really happy to see this bare framework to come out and I’m interested to see what will have been developed in spproximately one year. For now, I’m really confident of that.

kick it on DotNetKicks.com

ASP.NET MVC RC1 released

Just a short announcement: as ScottGu stated in December last year, the Release Candidate of ASP.NET MVC has been released now and can be downloaded from here.

In the RC, the major bugs have been fixed and many little improvements have found their way to the package. All changes can be viewed in the release notes.

V1 of ASP.NET MVC is planned for February 2009, so stay tuned.

Links:

Live Mesh Update 2009-01-14

First of all: sorry guys for the long period without a blog post. I have some personal things to do at the moment and I’m still planning my goals for 2009, thus I didn’t have enough time for deep inside posts on interesting stuff. Hopefully, that will change in some weeks.

Yesterday, the Live Mesh team announced a service update for the client software to version 0.9.3424.14, which integrates some general bug fixes. Along comes a bug fix for Windows 7 beta, where Live Mesh has had some problems displaying itself with Aero enabled. Some minutes ago the update came to all computer out there…

Fixes

  • Conflict-handling improved for duplicate files and folders
  • Live Mesh no longer disables Aero in Windows 7
  • Continued improvements to P2P synchronization
  • Minor usability improvements

So far for now, Matthias

Thoughts on the Live Services

After meshing for some days now, I took my 8-miles-running-lap today to think about the Live stack as a whole (I love my runs, it’s the only time to think in-depth on some topics). Thus I want to step back away from the bits and bytes for a moment and review the whole Mesh and Live Services thing. So what does it bring for developers and for consumers? What experiences are changing for them? What is it all about in my eyes? Questions, to which I try to find an answer in this blog post.

What is it about

Let’s start with the general pictures again. From a logical view, the Live Services are just one of the building blocks of the Windows Azure Services platform, as shown in our overall present Windows Azure picture…

Windows Azure Overview

Furthermore, the Live Services are providing some core services on the one hand side and a bunch of Mesh Services on the other. That’s shown by the Live Services overview picture…

Live Services Overview

So we got some core services, we got the mesh and services on it and we got applications today, which are using those services: the Windows Live applications, Office Live and Live Mesh as consumer portion of the mesh and taking advantage of the Mesh Services. At the moment, those applications are relatively distinct from each other in the sense of storage, used APIs and information sharing. For example, with Windows Live comes the 25GB SkyDrive, Office Live has its own workspace and with Live Mesh you get 5GB storage today. Those are not interconnected. But there are big things going on!

From the developer’s view, in the current Live Framework CTP you already take advantage of Windows Live functionality. Thus you are able to access your Live contacts and profiles. Furthermore, you can share data from your mesh with your contacts using various roles. In my opinion, Live Mesh will become part of Windows Live on http://windows.live.com, there earning a central stage. In return, perhaps you will be able to access your calendar, mail and other services programmatically through the Live Framework? We’ll see. Bringing all together is desirable in my eyes.

Ok, let’s continue. So what? What are the core conceptions of the Live Services? For me the whole functionality can be broken down into 2 main points:

Connecting

It’s no secret, what the Live Services and especially the Mesh Services are designed for. They bring together devices, applications, data and people, overcoming traditional barriers between them. The container therefore is the Mesh. In fact there is more than one mesh. You got a mesh of your devices, which share common information. On those devices and in the cloud you can have data and applications, which work with this data or on their own (leading us to the terms of data and application mesh). In a next version of Live Mesh you’ll be able to find applications through an application catalogue and install them on your mesh. Integrating Windows Live applications this way would be nice and I’m interested to see if this will happen soon. And with your contacts you have a mesh of people, with whom you can share your information, your data and even applications.

Thus, connecting means connecting your devices, your data and your applications, but what it really is about and what we can’t see today in Live Mesh (ok, we can see a little of it, but this is only the tip of the iceberg) is the non-egocentric perspective. It’s all about community! About sharing your photos, videos, thoughts and knowledge with your friends and like-minded people. The Live Services foundation is all about this aspect of bringing people together and making „community“ easier and more fun. In the end, it’s bringing YOU with your data/applications/devices/thoughts together with the OTHERS in a way, that doesn’t limit you (in contrast to today’s Web 2.0 platforms, which are bound on one or only a few aspects… or are you using one platform that enables you to organize your digital life with all little aspects through rich applications you wrote or which have been written and shared by others?). For me, Live Services in combination with Mesh are not only services. For me it’s a platform for a huge set of new applications, new business models (putting your favorite ad-engine into your apps is not far away!) and a new way to build up your digital life, using your mesh and the applications that fit your needs. Don’t believe me? I didn’t think so, before I got my iPod Touch (Azure on my head 😉 ) and thousands of apps through the AppStore. Small, cute applications and there is no mesh and no community aspect and no sharing over devices behind (on most). But it makes fun and costs are small. Now I’m mapping this to Silverlight, Mesh, the Live Services and the application catalogue and I see a huge potential!

Synchronizing

The second big functionality aspect when talking about Mesh and the services that come with it is synchronization. This can easily be underestimated, but it implies so much. At first, let me explain this point. As consumer, you currently have the Live Mesh application built onto the Live Services stack. You are able to create folders on your Live Desktop in the cloud and share those folders over your devices. The data is automatically hold in-sync over those devices through the Live Mesh client, which looks for changes and in case of change synchronizes data in the background. That is what you see now.

What you will see in the future, when the application catalogue and applications in your Mesh have come to life: not just data, but the applications in your Mesh will be synchronized to your devices! Thus you not only have your data everywhere, but also the apps, which work with the data, including configuration settings etc.. This leads to offline-scenarios for your mesh applications, if those are relying on data in your mesh (I don’t know if it’s planned to synchronize data of your contacts as well and there are imho some issues with that… we’ll see…). That means you can work offline with your applications and if you come online again, you’ll instantly have your data spread around your devices. I’m agog if there will be an offline-capable version of Windows Live Writer, with which you will be able to write your blog posts offline and then it publishes/synchronizes automatically, when you come online. This would need more integration of Windows Live, but as stated above, this is not far away. Ok, this offline-capability is nice, if you want to do some work where you don’t have Internet (for example in an airplane (standard-example through the PDC and later on ^^), in the train or for me at my parents, because they don’t have Internet (well, they are in fact in stone age and eating with fingers and drawing with chalk on stones etc. … sorry, I’m just joking 😉 )). But while Internet access is widely spread, this has not a heavy impact compared with the synchronization (and everywhere/everytime access for you) itself.

Instead, speed of Internet connection is a important point. For loading big chunks of information from your mesh you need a high-speed connection and even in this case you often have to wait some time, before your data is ready to work with. This drops in case you are working with your mesh data. This data is kept in sync with your computer and thereby you are able to work on your local copy of that data, leading you to instantly accessing that data without downloading it before. If you change the data, the Live Operating Environment (LOE) on your local device notifies these changes and automatically performs the synchronization process to other instances of the LOE (other devices and/or cloud).

Automatic synchronization makes a big difference for the developer, too. Instead of worrying about it, he can rely on this functionality. He can connect to the local LOE and work with the published resources. He doesn’t have to worry about network connections, data retrieval or synchronization – the Live Services are dealing with that. This makes a real difference! Let’s get Azure in mind: the developer can concentrate on the core functionality of his application, thus saving time or spending it to have fun and inspiration while realizing his ideas. Attracting the developer community is in my mind the cornerstone for the success of the Live Services.

What are the benefits

After making clear the core functionality of the Live Services, I want to emphasize (from my point of view) the benefits for consumers as well as for developers, who are programming against the Live Framework.

Consumers

  • Removing barriers: The interface barriers between your devices, data, applications and the people/contacts around you are removed. Thus you are able to interact with those from a central point.
  • Synchronizing: Data and applications everytime and everywhere on your devices! That is what synchronization with your mesh is about. Instead of just synchronizing data, you have the ability to synchronize your mesh applications as well.
  • Offline scenarios: While synchronization of applications is enabled, you can work offline with your applications (in your mesh or only mesh-enabled) which rely on data in your mesh. Instantly when you come online again, the changes will be synchronized automatically to your mesh in the background.
  • Community: Interacting with people, sharing data and taking care of your friends and contacts is made easy with Live Services and Mesh. Have access to your contacts, manage your online profiles and share information, knowledge, multimedia contents and general data as well as applications with your friends, granting them specific rights on your mesh objects. Furthermore, this brings collaboration to life.
  • Applications: Have access to many little applications through your mesh and the central application catalogue. Create instances of those applications on your mesh, synchronize these apps to your machine’s desktops or share them with friends.
  • Manage your digital life: With your data in the mesh and on all of your devices and with applications working on your mesh data, you are able to manage your digital life from a central point. Install applications that fit your needs for every purpose you want and have those applications working on all of your devices. Use services from Windows Live as well and share your life with your friends and families.

Developers

  • Easy programming: Programming with the Live Framework is made easy. You can access your data through central collections and don’t have to worry about common challenging programming tasks. You can query your data resources consistently and have the ability to use LINQ in the .NET libraries. CRUD processes on your data are no problem through a consistent resource model.
  • Consistent access: The Live Framework allows you to consistently access your mesh data, your profiles, contacts and later on other Windows Live services and Live entities with associated relationships.
  • Focusing: Many difficult tasks like network access, authentication, community connection and synchronization are abstracted by the Live Services, Live Framework as programming interface and the Live Operating Environment as a device endpoint for your mesh. Thereby you are able to focus your attention on the important things and the consumer experience of your application.
  • Cloud/client symmetric programming model: It doesn’t matter, which instance of the Live Operating Environment you are accessing. Whether it’s in the cloud or on somebody’s device – you will be able to code against it in a consistent way, thus allowing you easily to realize scenarios of your choice.
  • Business model: You’ll be able to include your favorite ad-engine in your apps to make money with your applications, as those are spread throughout the community.
  • Open access: Access to every instance of the Live Operating Environment (single devices or the cloud) and therefore to your mesh is possible with the programming language and operating system of your choice using a RESTful HTTP interface, that relies on open specifications. You can choose your favorite wire format, too (POX, ATOM, RSS, JSON), because data in the Live Framework is entity/collection-based, has no associated behavior and thereby can easily be transformed into an feed-based model. Furthermore, libraries for many languages will not be far away…
  • Scripting: The Live Operating Environment comes with the ability to compile and run so-called resource scripts. Those are similar to stored procedures in the database world. You can run a resource script on your own or let it run as trigger on data manipulation processes.
  • Mesh-enabling: No matter, if you build up a new application or extend an existing one: making use of mesh-functionality (thus mesh-enabling an application) is no problem and can easily be done with existing libraries.

CTP limitations

While the potential of the Live Services and Live Framework is big in my eyes, there are some limitations with the current Live Framework CTP, which will hopefully be solved in coming releases. The first came up with the installation of the Live Framework client, that is responsible for background synchronization of your mesh objects. At first it was not possible to install the Live Framework client in parallel to an existing Live Mesh client installation. I worked out a solution for that which works well for me, but I don’t know if there are some issues with that. The fact that there’s a separate mesh for the Live Framework instead of using the consumer mesh is a limitation as well, because you cannot access the same data as in your „productive“ mesh.

Another limitation comes with the functionality of the Live Framework client. At the moment, data synchronization is not possible, which means that files and folders from your mesh are not synchronized with devices running the Live Framework client. The same is true for your profiles and contacts, meaning that you have to connect to the cloud LOE to get access for those. Other limitations are, that you can’t get information about the status of a device and no remote access is possible (but this doesn’t count too much).

When programming against the Live Framework CTP, you are currently not able to traverse hierarchical data directly, thus you have to implement it on your own. Further „comfort functionality“ when accessing media resources is missing, too, but that’s no big deal.

Overall, with Live Services, Mesh, Windows Live and the Live Framework the fundamental stones are set for a new platform of rich applications and experiences for both consumers and developers. We’ll see how the community is reacting on this and where the whole thing will be in two years. Until then: what do YOU think?

kick it on DotNetKicks.com

Live Framework CTP #6 – .NET: WinForms Demo application

In the comments of #4, sitary requested the source code of my little WinForms application. After extending it with a login form and a little more functionality, I want to share it with you.

Currently the following things are implemented:

  • Login form for connecting to your cloud LOE.
  • Instant connection without a form, if you fill in your credentials into MyCreds.cs
  • Top-level information about several LOE objects: Devices, News, Mesh objects (TreeView structure), Contacts.
  • Tab „data“, which allows you to show MeshObjects, DataFeeds and DataEntry’s and to create, modify and delete those. If a data entry is a picture, it’s downloaded and shown in a box on the right.
  • Class library, which is extending the LiveFx’s functionality as explained in #5.

Note: It’s just implemented as „playing-around“ application for myself at the moment. That implies: no documentation, no error handling, no good design. If I got time, I’ll put a little work on that. For the moment please note, that this project isn’t reflecting my coding skills very much…

Normally, you just have to open the solution file in Visual Studio 2008. Please make sure that you’ve installed the Live Framework CTP SDK in C:\Program Files\Microsoft SDKs. Otherwise, you have to add a reference to the LiveFx .NET libraries on your own.

Again: Don’t expect too much 🙂

Sourcecode: MeshDiscoverer_current.zip

kick it on DotNetKicks.com