May 31

Microsoft earlier today announced a new product called “Microsoft Surface”. If you haven’t checked out the online videos of it yet, I highly recommend watching them here. It is one of those products that looks and feels like it comes from a science fiction movie - but it is actually real.

Popular Mechanics also has a good article (including their own video) of how it works that you can read and watch online here.

One of the really cool things about Microsoft Surface is that the table UI experience is built entirely using WPF and the .NET Framework - which is a great statement about the power of what WPF provides.

If you are interested in learning more about programming WPF, there are two great books out there that I’ve been recommending to people:

Both books have 5 star ratings on Amazon.com. You can download the first chapter of Chris’ book for free from this web page.

read source

May 31

Today, Google is hosting a developer day for 5,000 developers worldwide. The bulk of developers will be gathering at the San Jose convention center for a keynote by Google’s VP of Engineering, Jeff Huber. At the conference Google will be outlinging their developer strategy. But the big announcement will be Google Gears, an open source browser plugin that will enable developers to create offline web applications using JavaScript APIs. As a developer, you’ll be able to make an application with the assurance that it will work offline and online across browsers.

The plugin is a 700K download for Firefox 1.5+ and Internet Explorer 6.0+ that installs three developer APIs. One API will handle the creation of data objects to store application information locally, another will be a SQLite relational database for searching the data, and the final part will enable asynchronous JavaScript so applications can sync data in the background without overburdening the browser. More info on the APIs are available at the gears website.

googreadgears.pngThe first demo of Gears will be for Google Reader, but more Google apps are expected to come. Reader will add a green download button to the user interface. When you click the button, Reader will download the last 2,000 messages to your computer, preparing your computer to work offline or under a spotty internet connection.

Downloading will take place in the background, using the asynchronous JavaScript API. While offline you can read these articles and carry out your usual sharing and tagging. When you get back online, just click the button and Reader will sync your offline activity with their server. Right now the syncing is initiated manually, but it’s easy to see that it will become more seamless as the program develops. Gears could conceivably solve the large data overhead problems of Google’s AJAX applications, pushing updates to your desktop instead of slowing down your browser.

Google is releasing opensource and early to developers to get some preliminary feedback. They are also collaborating with a host of other partners such as Opera, Mozilla, and Adobe, which will to integrate flash and Apollo into their system.

read original
Google Gears Home

May 31

Google Web Toolkit (GWT) is an open source Java software development framework that makes writing AJAX applications like Google Maps and Gmail easy for developers who don’t speak browser quirks as a second language. Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatibilities between web browsers and platforms, and JavaScript’s lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile.

GWT lets you avoid many of these headaches while offering your users the same dynamic, standards-compliant experience. You write your front end in the Java programming language, and the GWT compiler converts your Java classes to browser-compliant JavaScript and HTML.

Today just released GWT 1.4RC with more than 150 bugfixes, in addition to many new features and improvements. JavaScript produced with GWT 1.4 is about 10-20% smaller, but the most interesting that it’s becoming much more faster. Most important change in GWT 1.4 is ImageBundle, which make it easy to collapse dozens of images into a single permanently-cacheable image file, another new feature that will boost GWT performance.

For deployment enhancements, GWT RPC is no longer tied to exclusively to servlets, and we saw already Pibb which uses Python for server-side scripts. Now you can run GWT compiler with -xs option, if you need a cross-site support in your JavaScript loading module, pretty simple but always use it at your own risk. Finally lots of changes in GWT widgets including RichTextArea, SuggestBox, Splitters, and more. GWT 1.4 is going to be hot ! More changes details here. Via GWT blog.

read more
GWT Home

May 29

Google has just released a preview of Mapplets, essentially gadgets for their maps. In practical terms it allows me to see Google trends on a map, check local gas prices, consume georss feeds, or see a heatmap visualization of Zuerich Travel times.

They can be found at http://maps.google.com/preview. You can find about 30 Mapplets to add via their content directory.

So what are Mapplets? Google explains:

Mapplets are mini-webpages that are served inside an IFrame within the Google Maps site. You can put anything inside this mini-webpage that you can put into a normal webpage, including HTML, Javascript, and Flash. Google provides a Javascript API that gives the Mapplet access to services such as manipulating the map, fetching remote content, and storing user preferences.

They have also proposed some changes to KML and ATOM that would support attribution to authors and a return URL for the content hosters. Right now. You can see an example here.

This is making Google Maps a mashup platform, but they know that they don’t want to be the only data provider or the only mashup. That’s why the attribution is so important. Most mashups are fighting to be found. Google is now providing them yet another way to do that.

view original

May 29

Another great article from Scott! Must read for all of us! Chech it out here:

In Part 1 of my LINQ to SQL blog post series I discussed “What is LINQ to SQL” and provided a basic overview of some of the data scenarios it enables.

In my first post I provided code samples that demonstrated how to perform common data scenarios using LINQ to SQL including:

  • How to query a database
  • How to update rows in a database
  • How to insert and relate multiple rows in a database
  • How to delete rows in a database
  • How to call a stored procedure
  • How to retrieve data with server-side paging

I performed all of these data scenarios using a LINQ to SQL class model that looked like the one below:

In this second blog post in the series I’m going to go into more detail on how to create the above LINQ to SQL data model.

LINQ to SQL, the LINQ to SQL Designer, and all of the features that I’m covering in this blog post series will ship as part of the .NET 3.5 and Visual Studio “Orcas” release.

You can follow all of the steps below by downloading either Visual Studio “Orcas” Beta 1 or Visual Web Developer Express “Orcas” Beta1. Both can be installed and used side-by-side with VS 2005.


Create a New LINQ to SQL Data Model

You can add a LINQ to SQL data model to an ASP.NET, Class Library or Windows client project by using the “Add New Item” option within Visual Studio and selecting the “LINQ to SQL” item within it:

Selecting the “LINQ to SQL” item will launch the LINQ to SQL designer, and allow you to model classes that represent a relational database. It will also create a strongly-typed “DataContext” class that will have properties that represent each Table we modeled within the database, as well as methods for each Stored Procedure we modeled. As I described in Part 1 of this blog post series, the DataContext class is the main conduit by which we’ll query entities from the database as well as apply changes back to it.

Below is a screen-shot of an empty LINQ to SQL ORM designer surface, and is what you’ll see immediately after creating a new LINQ to SQL data model:


Entity Classes

LINQ to SQL enables you to model classes that map to/from a database. These classes are typically referred to as “Entity Classes” and instances of them are called “Entities”. Entity classes map to tables within a database. The properties of entity classes typically map to the table’s columns. Each instance of an entity class then represents a row within the database table.

Entity classes defined with LINQ to SQL do not have to derive from a specific base class, which means that you can have them inherit from any object you want. All classes created using the LINQ to SQL designer are defined as “partial classes” - which means that you can optionally drop into code and add additional properties, methods and events to them.

Unlike the DataSet/TableAdapter feature provided in VS 2005, when using the LINQ to SQL designer you do not have to specify the SQL queries to use when creating your data model and access layer.

Instead, you focus on defining your entity classes, how they map to/from the database, and the relationships between them. The LINQ to SQL OR/M implementation will then take care of generating the appropriate SQL execution logic for you at runtime when you interact and use the data entities. You can use LINQ query syntax to expressively indicate how to query your data model in a strongly typed way.


Creating Entity Classes From a Database

If you already have a database schema defined, you can use it to quickly create LINQ to SQL entity classes modeled off of it.

The easiest way to accomplish this is to open up a database in the Server Explorer within Visual Studio, select the Tables and Views you want to model in it, and drag/drop them onto the LINQ to SQL designer surface:

When you add the above 2 tables (Categories and Products) and 1 view (Invoices) from the “Northwind” database onto the LINQ to SQL designer surface, you’ll automatically have the following three entity classes created for you based on the database schema:

Using the data model classes defined above, I can now run all of the code samples (expect the SPROC one) described in Part 1 of this LINQ to SQL series. I don’t need to add any additional code or configuration in order to enable these query, insert, update, delete, and server-side paging scenarios.


Naming and Pluralization

One of the things you’ll notice when using the LINQ to SQL designer is that it automatically “pluralizes” the various table and column names when it creates entity classes based on your database schema. For example: the “Products” table in our example above resulted in a “Product” class, and the “Categories” table resulted in a “Category” class. This class naming helps make your models consistent with the .NET naming conventions, and I usually find having the designer fix these up for me really convenient (especially when adding lots of tables to your model).

If you don’t like the name of a class or property that the designer generates, though, you can always override it and change it to any name you want. You can do this either by editing the entity/property name in-line within the designer or by modifying it via the property grid:

The ability to have entity/property/association names be different from your database schema ends up being very useful in a number of cases. In particular:

1) When your backend database table/column schema names change. Because your entity models can have different names from the backend schema, you can decide to just update your mapping rules and not update your application or query code to use the new table/column name.

2) When you have database schema names that aren’t very “clean”. For example, rather than use “au_lname” and “au_fname” for the property names on an entity class, you can just name them to “LastName” and “FirstName” on your entity class and develop against that instead (without having to rename the column names in the database).


Relationship Associations

When you drag objects from the server explorer onto the LINQ to SQL designer, Visual Studio will inspect the primary key/foreign key relationships of the objects, and based on them automatically create default “relationship associations” between the different entity classes it creates. For example, when I added both the Products and Categories tables from Northwind onto my LINQ to SQL designer you can see that a one to many relationship between the two is inferred (this is denoted by the arrow in the designer):

The above association will cause cause the Product entity class to have a “Category” property that developers can use to access the Category entity for a given Product. It will also cause the Category class to have a “Products” collection that enables developers to retrieve all products within that Category.

If you don’t like how the designer has modeled or named an association, you can always override it. Just click on the association arrow within the designer and access its properties via the property grid to rename, delete or modify it.


Delay/Lazy Loading

LINQ to SQL enables developers to specify whether the properties on entities should be prefetched or delay/lazy-loaded on first access. You can customize the default pre-fetch/delay-load rules for entity properties by selecting any entity property or association in the designer, and then within the property-grid set the “Delay Loaded” property to true or false.

For a simple example of when I’d want to-do this, consider the “Category” entity class we modeled above. The categories table inside “Northwind” has a “Picture” column which stores a (potentially large) binary image of each category, and I only want to retrieve the binary image from the database when I’m actually using it (and not when doing a simply query just to list the category names in a list).

I could configure the Picture property to be delay loaded by selecting it within the LINQ to SQL designer and by settings its Delay Loaded value in the property grid:

Note: In addition to configuring the default pre-fetch/delay load semantics on entities, you can also override them via code when you perform LINQ queries on the entity class (I’ll show how to-do this in the next blog post in this series).


Using Stored Procedures

LINQ to SQL allows you to optionally model stored procedures as methods on your DataContext class. For example, assume we’ve defined the simple SPROC below to retrieve product information based on a categoryID:

I can use the server explorer within Visual Studio to drag/drop the SPROC onto the LINQ to SQL designer surface in order to add a strongly-typed method that will invoke the SPROC. If I drop the SPROC on top of the “Product” entity in the designer, the LINQ to SQL designer will declare the SPROC to return an IEnumerable result:

I can then use either LINQ Query Syntax (which will generate an adhoc SQL query) or alternatively invoke the SPROC method added above to retrieve product entities from the database:

Using SPROCs to Update/Delete/Insert Data

By default LINQ to SQL will automatically create the appropriate SQL expressions for you when you insert/update/delete entities. For example, if you wrote the LINQ to SQL code below to update some values on a “Product” entity instance:

By default LINQ to SQL would create and execute the appropriate “UPDATE” statement for you when you submitted the changes (I’ll cover this more in a later blog post on updates).

You can also optionally define and use custom INSERT, UPDATE, DELETE sprocs instead. To configure these, just click on an entity class in the LINQ to SQL designer and within its property-grid click the “…” button on the Delete/Insert/Update values, and pick a particular SPROC you’ve defined instead:

What is nice about changing the above setting is that it is done purely at the mapping layer of LINQ to SQL - which means the update code I showed earlier continues to work with no modifications required. This avoids developers using a LINQ to SQL data model from having to change code even if they later decide to put in a custom SPROC optimization later.


Summary

LINQ to SQL provides a nice, clean way to model the data layer of your application. Once you’ve defined your data model you can easily and efficiently perform queries, inserts, updates and deletes against it.

Using the built-in LINQ to SQL designer within Visual Studio and Visual Web Developer Express you can create and manage your data models for LINQ to SQL extremely fast. The LINQ to SQL designer also provides a lot of flexibility that enables you to customize the default behavior and override/extend the system to meet your specific needs.

In upcoming posts I’ll be using the data model we created above to drill into querying, inserts, updates and deletes further. In the update, insert and delete posts I’ll also discuss how to add custom business/data validation logic to the entities we designed above to perform additional validation logic.

Mike Taulty also has a number of great LINQ to SQL videos that I recommend checking out here. These provide a great way to learn by watching someone walkthrough using LINQ to SQL in action.

read original

May 29

Dion Almaer from Ajaxian.com has written quite good post which showed us what was going on into the Ajax community into the recent month. Here is their post:

We realize that it is an incredible tough job to keep up on what is happening in the Ajax community as it is so broad. We aim to bring you a few posts a day to take some of the burden off of you, but what about broader terms?

We are starting a new monthly roundup that aims to summarize what was important in the preceding month, based on our opinion, but more so on what you, the community, thought of the postings (rating and page views).

We are going to experiment with formats, but by splitting up the content, you can also get a feel for the ajax library landscape over time. Please let us know what you think, and if there is anything else that you would like to see.

Although it is a bank holiday in the US (memorial day), we realize that: a) some geeks don’t care and are working / browsing. b) most of our audience is not in the US. So, for you, we have the first roundup:

High Level / Big News

The big recent news is the emerging talk about the new platform wars of Silverlight, Apollo, JavaFX, and how the Open Web fits into all of this. Episode One may be the browser wars, but maybe Episode Two is the plugin wars?

The press has gone a little nuts on Silverlight and JavaFX. Both are just name changes, and we have known about WPF/E and F3 for quite awhile now. I couldn’t help by have a little fun myself.

On the Ajax front, a very interesting paper was released on a trusted implementation of cross domain access, which will be huge for mashup developers, and we are seeing more and more usage of dtrace to debug apps for Ajax, or Rails.

Browsers and Standards

Alex Russell thinks that the future of HTML is more important than any other worries on the Ajax side, and we agree. Everyone is watching the new W3C group, and although the group has taken on HTML 5 from the WHATWG, we wait to here how it will get tweaked. The group has been a little quiet.

Ajax Librarys

The core Ajax libraries are flourishing. They are getting more and more lean, mean, and solid. It becomes harder and harder to choose between then, and we are getting abstractions on top, such as Ext JS that are providing even more functionality.

Dojo

Dojo has announced a new 0.9. If you are watching this closely you will see that this is a big deal. This isn’t a slightly different Dojo. This is a revolutionary Dojo. The biggest complaint on the library has been the feeling that it is too bloated (it is incredible comprehensive). Do widgets need to be abstract enough to grok SVG and HTML (when the community is only using the HTML ones)? Does the remoting support need to bundle every funky transport layer? No. And, the Dojo team has realized this and has taken things into their hands and has revamped the framework as a lean, mean, beast that checks in at roughly the same size as Prototype. There is now ONE dojo.js instead of having you package, or grab, one of many.

Dojo is being reborn as we speak, and the results are exciting to see.

Prototype
Prototype chucks along as a fantastic, solid, “I just want to add a bit of Ajax guys, not boil the world” Ajax library. Version 1.5.1. was released, and it gets faster and cleaner than ever.

jQuery

jQuery seems to be going from strength to strength. Maybe that is why idiots decided to DOS the project… they don’t like success. The simple plugin architecture is allowing people to add functionality easily to the library without bloating it. Somehow the implementation has resulted in many more plugins in the community than elsewhere.

GWT

I was asked a lot of questions on GWT at JavaOne (no surprised based on the conference). It seems to be picking up steam, and many Java programmers are enjoying the choice.

Mootools

Moo always has a nice little following that produces a lot of content. This month was no exception.

Conclusion

As the month comes to a close, we are looking forward to seeing the new platforms solidify over the summer, as frameworks go from alpha to beta to live.
The Ajax Experience Call for Papers Closed, and we are once again amazed at the community who made our choices incredibly tough.

Ben and I sat down and went through them all with the first pass acting as a “lets mark the must-haves first and then go back” walk through. Once we were done with that we already had chosen more content than we could fit in.

We can’t wait to see you on July 25-27 in San Francisco.

As always, if you see anything that you feel the community would enjoy seeing, please email us and let us know so we can cover it on the site.

read original

May 28

Partial Methods

One feature that you may have not heard of yet is a feature called partial methods. This is some of the work that I did in the last coding milestone a few months back. Partial methods are methods that enable lightweight event handling. Here is an example declaration:

partial class C
{
static partial void M(int i);
}

There are a few notable things here:

1. Partial methods must be declared within partial classes

2. Partial methods are indicated by the partial modifier

3. Partial methods do not always have a body (well look at this more below)

4. Partial methods must return void

5. Partial methods can be static

6. Partial methods can have arguments (including this, ref, and params modifiers)

Now suppose that I make a call to C.M.

partial class C
{

static void Main()
{
C.M(Calculation());
}
}

Since M has no body, all calls to C.M are removed at compile time as well as the evaluation of the arguments. So the above program is equivalent to:

partial class C
{

static void Main()
{
}
}

In this sense, partial methods are the distant cousins of conditional methods which also sometimes remove the call and the evaluation of the arguments. But partial methods go even further. When a partial method has no body then the partial method is not even emitted to metadata.

So far this might seem a little confusing. C# now allows users to declare methods for which the calls, the evaluation of the arguments, and the method itself are not emitted. Fortunately, the story doesn’t end there. Partial methods allow users to define a body for the method so that the method, the calls, and the evaluation of the arguments are emitted.

partial class C
{
static partial void M(int i); // defining declaration
static partial void M(int i) // implementing declaration
{
}
}

In the code above, we see that there is a difference between a defining declaration of a partial method and an implementing declaration of a partial method and the difference is whether or not the method has a body. These definitions don’t have to be in the same partial class declaration. There may only be one defining declaration and if a defining declaration exists then there may be an implementing declaration.

Why Partial Methods?

So how are these partial methods used? The common scenario is to use them to do lightweight event handling. For example a tool that generates code may wish to have hooks for users to customize what code is run. For example, imagine that a tool generated a bunch of code for a class representing a customer. It might look like this:

partial class Customer
{
string name;

public string Name
{
get
{
return name;
}
set
{
OnBeforeUpdateName();
OnUpdateName();
name = value;
OnAfterUpdateName();
}
}

partial void OnBeforeUpdateName();
partial void OnAfterUpdateName();
partial void OnUpdateName();
}

If the user doesn’t add any implementing definitions then this code is equivalent to:

partial class Customer
{
string name;

public string Name
{
get
{
return name;
}
set
{
name = value;
}
}

}

No extra metadata for things that are not used and no extra instructions for useless operations. On the other hand if the user listened to the OnUpdateName “event” like this:

partial class Customer
{
partial void OnUpdateName()
{
DoSomething();
}
}

Then the original definition is equivalent to:

partial class Customer
{
string name;

public string Name
{
get
{
return name;
}
set
{
OnUpdateName();
name = value;
}
}

partial void OnUpdateName();
}

Comparing Partial Methods to the Alternatives

At this point, it is sensible to ask why not just use subclassing and virtual methods? Of course, this would also work but it does have the drawback that the calls, the methods, and the evaluation of the arguments will still be emitted even if the virtual methods are not overridden. So in a system like Linq to SQL that has thousands of little events it allows these events to be very lightweight so that the user only pays for those events that she uses.

A Few Fine Points

Consider the following program…

partial class C
{
static void Main()
{
int i = 3;
C.M(i = 5);
Console.WriteLine(i);
}
}

What does it write to the console? 3, 5, …?

Actually, it is impossible to tell from just this code. If there is no implementing declaration then the program will display 3 because the i = 5 will never be evaluated, but if there is an implementing declaration then the program will display 5. The same is true for conditional methods. So if you want a side-effect to occur make sure you do not cause the side-effect to occur as an argument to a partial method. Of course, the same trick can be used to hide expensive calculations.

partial class C
{
static void Main()
{
C.M(VeryVeryExpensiveCalculation());
}
}

If there is no implementing declaration then the very very expensive calculation will never be performed.

Now what about attributes, how does those work?

partial class D
{
[W]
[return:X]
partial void M([Z]int foo)
{
}

[Z]
[return:W]
partial void M([Y]int foo);
}

What attributes are actually emitted on M? W and Z are the attributes on M; X and W are the attributes on the return type; Y and X are the attributes on the type parameter; Z and Y are the attributes on the parameter.

read original

May 28

Jared here again. For previous articles in this series please see

Thus far in the series we’ve only lifted variables that are declared in the same block/scope. What happens if we lift variables in different scope? The answer is that one closure class will be created for every unique scope where a lifted variable is declared and all of the variables in that scope that are lifted will be placed in that closure. Once again, examples speak best

    Sub Scope1()       Dim x = 5       Dim f1 = Function(ByVal z As Integer) x + z       Console.WriteLine(f1(5))       If x > 2 Then           Dim y = 6           Dim g = 7           Dim f2 = Function(ByVal z As Integer) z + y + g           Console.WriteLine(f2(4))       End If   End Sub

The code will end up looking like so …

    Class Closure1       Public x As Integer

       Function Lambda_f1(ByVal z As Integer)           Return x + z       End Function

   End Class

   Class Closure2       Public y As Integer       Public g As Integer

       Function Lambda_f2(ByVal z As Integer)           Return y + z + g       End Function   End Class

   Sub Scope1()       Dim c1 As New Closure1()       c1.x = 5       Console.WriteLine(c1.Lambda_f1(5))       If c1.x > 2 Then           Dim c2 As New Closure2()           c2.y = 6           c2.g = 7           Console.WriteLine(c2.Lambda_f2(4))       End If   End Sub

There are a couple of items to take away from this example.

  1. Only two closure classes were created even though three variables were lifted. The number of closures only depends on the number of scopes of all of the lifted declared variables.
  2. The closures are created at the begining of the scope they are associated and not at the begining of the method. This will be more important in the next part of the series.
  3. Each lambda instance is attached to the closure associated with the scope the lambda is declared in.

The next twist is what were to happen if the lambda “f2″ were to also use the variable “x”. As it’s currently written there is no association between Closure1 and Closure2 therefore there is no way for it to access the lifted variable. The answer is two fold. Firstly to reduce clutter I pasted the closure classes as if they were separate entries. In fact Closure2 would appear as a nested class of Closure1 in the real generated code.

Secondly if x were used inside of “f2″, the real use would be “c1.x”. That’s (almost) no different than “someOtherVar.x”. Therefore the instance of c1 will be lifted into Closure2.

Dim f2 = Function(ByVal z As Integer) z + y + g + x

Woud result in the following definition of Closure2 …

    Class Closure2       Public y As Integer       Public g As Integer       Public c1 As Closure1

       Function Lambda_f2(ByVal z As Integer)           Return y + z + g + c1.x       End Function   End Class

In deeply nested lambdas and scopes this type of lifting will continue recursively.

read original

May 23

Nice article which I found on dotnetslackers.com explaining the basics of Silverlight and its usage. Check it out here:

Silverlight is Microsoft’s new Flash Killer but it will be so much more! Learn all about the present and future features of Microsoft’s new web front end.

What is Silverlight?

Silverlight is a browser plug-in that that extends the web development experience far beyond the limitations of plain HTML and JavaScript. Being a Microsoft product, you might expect it to work best (or only) on Windows and Internet Explorer. So you may be pleasantly surprised to know that it works equally well on Windows and on the Mac, and it also works equally well on the Firefox and Safari web browsers. Since Silverlight is a client side technology, it doesn’t matter what backend server software or platform you’re running - even Apache/Linux will do just fine.

Version 1.0

Silverlight version 1.0 - scheduled for release this summer - is very comparable to Adobe Flash. It delivers high performance multimedia and animation capabilities that can blend seamlessly with HTML. It’s capable of playing a variety of audio and video file formats, such as MP3, WMA, and WMV. It handles streaming quite well, so media can start playing immediately without having to wait for the entire file to download.

Silverlight’s user interface is defined with a subset of XAML - an XML format shared with Windows Presentation Foundation (WPF). This facilitates vector based animations, a claim that goes beyond Flash’s current capabilities. Silverlight’s compiled object model can be navigated via JavaScript for seamless interaction between embedded Silverlight components and the page that hosts them.

When users encounter a Silverlight 1.0 enhanced web page for the first time, they’ll be prompted with the quick & easy installation that’s only about a 1.2 megabyte download.

You can download the beta version of Silverlight 1.0 now.

Version 1.1

While the multimedia and animation capabilities of Silverlight 1.0 are certainly great for graphic designers, Silverlight version 1.1 (currently in alpha) starts to provide the kind of business oriented functionality that the majority of web developers need.

Probably the most exciting feature of version 1.1 is the built-in cross platform subset of the .NET Framework. While you can still mix in as much (or as little) JavaScript as you’d like, you’ll now have the option of running your own fully compiled .NET code within IE, Firefox, or Safari. Those developers who hate JavaScript should be thrilled to know they can now write their client side code in C#, VB.NET, or any other .NET language. This .NET code can interact with the browser’s object model so it can manipulate the page’s HTML in addition to interacting with any Silverlight user interface that may be embedded in the page. You’ll now be able to replace slow performing JavaScript code with fully compiled .NET code that could easily execute hundreds of times faster.

A variety of useful classes are included in Silverlight 1.1 for working with cutting edge technologies like LINQ, generics, multithreading, and invocation of Windows Communication Foundation (WCF) web services. There’s also support for XML manipulation, networking, I/O, collections, globalization, and JSON serialization.

ASP.NET support is also provided for things like personalization, profiles, role membership, and invocation of ASMX web services. On a related note, the next release of ASP.NET is expected to include a variety of tools for easing Silverlight development, including built-in controls that make it easy to embed Silverlight content.

Unfortunately there are currently no definite plans to include any significant number of controls in Silverlight 1.1 - not even a basic button control is currently in the mix. They do at least provide a control class that can be used to build your own controls, and alternately it’s not terribly difficult to make basic controls using XAML and some custom code - but certainly we’d prefer not to have to write such basic code. Luckily there are several controls available in the separate Silverlight 1.1 Alpha SDK download.

Since Silverlight 1.1 is still only in alpha, its uncertain exactly what other functionality may ultimately make it into the release version. The current download size for this far more functional version of Silverlight hovers at around 4MB.

Future Versions

From my conversations with Silverlight mastermind Scott Guthrie and his merry band of genius underlings, they’ve got a lot of mouthwatering functionality planned for upcoming versions of Silverlight. General themes include a rich set of built-in controls, data binding support, XLINQ, RSS, Xml Serialization, Opera support, and improved layout management. And that’s just for starters.

In general the vision is to transform Silverlight from its current 1.0 state of multimedia powerhouse into a highly productive business tool capable of powering rich applications of virtually every kind.

Even with all this extra functionality, Silverlight’s team has a long term secret goal of keeping the download size under 5MB. Shhhh! Don’t tell anybody!

Development Tools

Currently the lack of polished tools for developing Silverlight applications is its biggest hindrance. The next version of Visual Studio (codenamed Orcas) is expected to ship with rich Silverlight support. However, the current beta version of Orcas clearly still needs a lot of work before achieving this goal. If you’re brave enough to be tinkering with the Orcas beta then you might as well download the Silverlight Tools Alpha add-on to try out its Silverlight development capabilities.

Microsoft’s new Expression suite of products is currently closer to being in a finished state. They are presently more polished and less buggy than Orcas. Specifically, Expression Blend is probably the most valuable Expression product for Silverlight development. However, be forewarned that the Expression suite is intended more for graphic designers than software developers. Therefore Visual Studio-oriented developers should expect a significant learning curve.

Summary

Silverlight is a brilliant idea that still has a ways to go before it reaches its potential. Nevertheless, it should definitely be on every web developer’s radar. It’s a distinct possibility that Silverlight could be the future of web development. Imagine a world where web developers no longer deal with HTML, and instead write rich, compiled .NET code that runs everywhere as ubiquitously as HTML does now. If Microsoft plays its cards right, this will happen.

References

view original

May 22

Sum up of not-to-miss articles and topics provided weekly by Scott:

One of the things I’m going to try and start doing is a weekly blog post of useful/interesting links on .NET related topics that I’ve found on the web. Below is this week’s version:

ASP.NET

  • Storing Binary Files Directly in the Database using ASP.NET 2.0: Scott Mitchell has a good article that shows how to upload and store images within a SQL database, and then serve them out dynamically from within a web application (very useful for photo albums). You could combine this article with Rick’s above to enable an optional “Save As” option that allows site visitors to save high-resolution versions of images or other file types.

Visual Studio

  • Debugging SQL Server 2005 Stored Procedures in Visual Studio: Scott Mitchell published another great article on how to debug SPROCs using Visual Studio 2005. You can use this approach to set a breakpoint within a SPROC in your database, and then hit it like a normal debug breakpoint when debugging an ASP.NET application that calls it.
  • Using Visual Studio Macros to Increase Productivity: Dan has a nice post describing some of the Macros he has created to manage large projects in Visual Studio. The Visual Studio macro recorder and editor are two features that not enough developers take advantage of (myself included). Whenever you find yourself repeating a task a number of times, I’d highly recommend creating a macro within VS to automate it for future uses.

Silverlight

  • Silverlight 1.1 Alpha Layout System and Controls Framework: One of the features missing in the Silverlight 1.1 Alpha that we shipped at MIX is support for layout management. This is a powerful feature of WPF, and makes it much easier to position and control UI on a page (I’ll post more about this in the future). Dave Relyea from the Silverlight UI team posted a cool sample on his blog that provides a sample implementation of layout management that works with the 1.1 Alpha and includes both Stack and Grid layout manager support. He also then shipped a number of cool custom controls including buttons, labels, textbox, and border controls. Very cool stuff.
  • Silverlight Toolbar Example: A nice sample from Vivek that describes how to create an animated toolbar where the buttons expand when you hover over them. You might also want to check out the “Office UI Ribbon” sample on the www.silverlight.net sample gallery web-site that demonstrates how to build a really cool toolbar within the browser.

WPF

.NET General

  • NDepend 2.2: Scott Dorman has written up a great post on NDepend - which is a .NET utility that enables you to perform code analysis on your .NET projects. This can be useful especially with large projects that you’ve inherited. NDepend also supports a SQL-like query language that enables you to define your own code rules/analytics to search a code base with.
  • Dynamic Language Runtime (DLR) ported to Mono: One of the announcements we made at MIX was that we are shipping a new “dynamic language runtime” framework library for .NET that makes it much easier to build dynamic languages on top of .NET (both the full .NET Framework and Silverlight). We are also shipping four dynamic language implementations of our own: IronPython, IronRuby, Javascript and Dynamic VB. We shipped the source code to the DLR and IronPython as a CodePlex project with a permissive license. This article on O’Reilly describes how someone has already taken the code and got it up and running on Mono. Miguel de Icaza was up in Redmond this week at a compiler dev lab we held and JasonZ and I got a chance to take him out to dinner last night. You can read about Miguel’s trip on his blog here.


read original