Some stuff about Web and .NET development
RSS icon Email icon Home icon
  • Silverlight 3 : first impressions

    Posted on August 23rd, 2009 Thibaut 1 comment

    Silverlight Having recently started my initiation to Silverlight by completing the workshops of MSDN Silverlight coach and making my first app with this technology, here are my impressions of Silverlight (some specific to version 3 and other ones more general), from a Web/ASP.NET developer point of view :

    • RIA have a much nicer feeling than traditional web apps (even the AJAX-enabled ones), which is faster, smoother, really a better user experience
    • Productivity seems, at first sight, much higher than with ASP.NET. There’s no loss of time with cross-browser compatibility and such concerns. What you see is what you get everywhere. Beyond of that, I was able to get really fast a nice version of my app. For example, a DataGrid comes, in its simplest form (drag & drop from the toolbox) with alternating colors, mouse over effects, column sorting and column resizing. Also, you find interesting controls in the standard toolbox, such as charts, widely used in business apps
    • One of the first thing I wanted to do is create a button. Where’s my Id property ? And the Text one ? Well, it’s actually Name and Content respectively… Name replaces Id in Silverlight, while the Content property allows you, for some controls, to specify other things than text (you can put a video in a button if you want, or a calendar, which is the big difference compared to ASP.NET where you’re limited by the available XHTML tags. As the UI in Silverlight is vector graphics, you’re just limited by your imagination)
    • Some conventions (or habits) are no longer respected. OnFocus and OnBlur events become GotFocus and LostFocus. What about the “On” prefix convention for events ? There’s no more DataSource but an ItemSource, the Margin property is not the same as the CSS one (left, top, right, bottom in Silverlight compared to top, right, bottom, left in CSS). These are little details, among other ones of the same kind, that makes the adaptation time higher than what it would be by taking into account the habits of web and ASP.NET developers
    • There’s no designer in Visual Studio 2008 for XAML edition. After some investigation on the web, it seems that it’s going back with Visual Studio 2010 but in the meanwhile, you gotta use Expression Blend
    • Another big difference is that the code behind of a XAML file (equivalent to the ASPX file in ASP.NET), be it in C# or VB, is executed client side. It’s some never-seen for ASP.NET developers, having associated C# with server side execution. Of course, you must develop accordingly : you’re not gonna open a DB connection with client side code, for example
    • As a consequence with the client side execution of C# (or VB) in Silverlight, ADO.NET has been thrown away. So forget DataSets, DataReaders etc and get used to WCF, .NET RIA Services, …
    • The designer/developer cooperation goes even further with Silverlight, providing separated tools (Expression Blend for the designers and Visual Studio for the developers), allowing to work simultaneously on the same project files and get an instantaneous result from one’s work
    • Silverlight 3 is a milestone release and according to me, the first version that could really be used to develop a full application based on it. A lot of improvement has been done since its first release (that time where the code behind had to be written in Javascript seems far away…)

    Conclusion

    Globally very positive. After a little time of adaptation, I was able to develop a nice looking app with little coding. The result is fast, feels smooth, it’s a real pleasure to use such a web application. This technology has a great potential, most certainly for business apps where too much time is lost dealing with browser concerns (and where SEO isn’t needed). I would most certainly go with Silverlight for these kind of applications by now…

    Don’t hesitate to share your impressions and return of experiences, I’d be interested to hear from you ;)

    Share/Save/Bookmark

  • The little-known <wbr /> tag

    Posted on August 16th, 2009 Thibaut 5 comments

    The <wbr /> tag (word break), little-known but very useful, tells the browser “insert a word break here if you wish”. Consider for example that you have a long text (ie a URL or alphabet letters) to put in a zone which width cannot be extended. So we have the following code :

    XHTML :

    <div class="fixedWidth">

        abcdefghijklmnopqrstuvwxyz

    </div>

    CSS :

    div.fixedWidth

    {

        width : 50px;

        overflow : hidden;

        border : 1px solid red;

    }

    Result :

    abcdefghijklmnopqrstuvwxyz

    Now using <wbr /> :

    <div class="fixedWidth">

        abc<wbr />def<wbr />ghi<wbr />jkl<wbr />mno<wbr />pqr<wbr />stu<wbr />vwx<wbr />yz

    </div>

    Result :

    abcdefghijklmnopqrstuvwxyz

    Emphasize is put here on the amount of inserted <wbr /> tags (every three letters actually) to illustrate the browser behaviour, which decides when to effectively insert a word-break, in opposition to the <br /> tag, which always inserts one.

    This tag is not XHTML valid (maybe the reason why you won’t find it in the Visual Studio intellisense) but widely implemented by browsers anyway. Results shown here are not screenshots but direct interpretation of the tag, so you get immediately an idea if your browser supports it. For more information about its support, you can take a look at the compatibility table. So, in some cases, instead of using ugly CSS hacks, rather use <wbr /> and you’re done !

    Share/Save/Bookmark

  • Silverlight : goodbye XmlDocument, hello XDocument !

    Posted on August 15th, 2009 Thibaut 2 comments

    SilverlightI just started my initiation to Silverlight and noticed while following the workshops of the MSDN Coachs program that a class XDocument was used to parse some Xml. So I thought at first “what’s that new class ? Why didn’t they use XmlDocument ?”.

    Well, simply because it’s gone ! The reason of that, found on the forums of the official Silverlight website, is that because Linq to Xml is the recommended way to work with Xml in Silverlight, so System.Xml.XmlDocument was removed and is now succeeded by System.Xml.Linq.XDocument.

    For those who’re new to Linq to Xml, here’s a quick example of what you can perform with that powerful technique :

    1. The class, using auto-implemented properties

    public class DiggStory

    {

        public int      Id { get; set; }

        public string   Title { get; set; }

        public string   Description { get; set; }

        public string   HrefLink { get; set; }

        public int      NumDiggs { get; set; }

        public string   Thumbnail { get; set; }

    }

    2. Using Linq to Xml

    XDocument xmlStories = XDocument.Parse(xmlContent);

     

    var stories = from story in xmlStories.Descendants("story")

                  where story.Element("thumbnail") != null

                  select new DiggStory

                             {

                                 Id = (int) story.Attribute("id"),

                                 Title = (string) story.Attribute("title"),

                                 Description = (string) story.Attribute("description"),

                                 Thumbnail = (string) story.Attribute("thumbnail"),

                                 HrefLink = (string) story.Attribute("link"),

                                 NumDiggs = (int) story.Attribute("diggs")

                             };

    3. Conclusion

    Advantages of this method is that :

    1. It’s way more elegant than classic XPath strings
    2. You get a collection of strongly typed items
    3. It’s very easy to perform databinding on the basis of the item properties

    Make good use of it ;)

    Share/Save/Bookmark

  • In bulk #3

    Posted on August 13th, 2009 Thibaut No comments

    Share/Save/Bookmark

  • Who’s your coach ?

    Posted on August 4th, 2009 Thibaut 3 comments

    For the french-speaking readers out there, Microsoft has launched the MSDN coachs program. You’ll find tutorials, screencasts and exercises about many topics such as Mobile and Web development, Silverlight, C#, Sql Server and many more. I really like the idea of going back to basics and learning the most important things, thus making effective use of your time. Some sections are still in development but growing every day. There is currently no english version but I guess it will be done in the future.

    Below, an overview of the coachs available for training. Click on the picture to go on the official site.

    MSDN coachs

    Share/Save/Bookmark

  • REMIX 09 : I’ll be there !

    Posted on August 3rd, 2009 Thibaut No comments
    REMIX The REMIX, re-edition of the popular MIX event will take place at Kinepolis Bxl on September 29. This free event will propose two different tracks :

    1. User Experience Track : prototyping with SketchFlow, Surface, creating Silverlight experiences, …
    2. Web Developer Track : Silverlight 3 new features, Expression Blend, …

    And as usual, I’ll post a summary of the event on my blog so don’t forget to check it out. See you there ;)

    Share/Save/Bookmark