Some stuff about Web and .NET development
RSS icon Email icon Home icon
  • Visual Studio 2010 new logo & MSDN website refresh

    Posted on October 21st, 2009 Thibaut No comments
    VS2010 logo

    A new logo for Visual Studio (illustrated above) and the MSDN were recently introduced. I personally find ‘em pretty damn sweet : sober yet powerful. Also note that the MSDN has not just a new logo, but the whole website was refreshed at the same time, featuring new services. Details about this can be found on Scott Hanselman’s blog.


  • Book review : Silverlight 3

    Posted on October 18th, 2009 Thibaut 1 comment
    Silverlight 3 book I’ve just finished reading Silverlight 3 - Programmer’s reference book, which is written by 5 people of Infragistics, one of the world leaders in user interface development tools. Among the authors, we can find Jason Beres who came at Visug talking about user experience (see related post here). This full-color book gives us an overview of what can be achieved using Silverlight 3. Interesting and very well crafted, this book targets as well a graphists audience as the developers one. Silverlight is very much about User Experience so if you’re not interested by the UI part of an app, you might want to pick up another, purely technical book. Also note that there are a lot of chapters, so various things are covered but not as deeply as you would wish sometimes.


    • Written by a buch of experts in the field (guys from Infragistics)
    • Many aspects of Silverlight are covered, getting you started for writing nice apps
    • Not too long to read (460 pg, appendices excluded) which is a change compared to the ASP.NET book for example (almost 2 000 pg)
    • Full-color, which suits very well to the UI context of the book


    • As many things are covered, you won’t have a comprehensive book on Silverlight here (there’s a chapter which is only 15 pg long)
    • Title of the book says Programmer’s reference but it ain’t because of its lack of depth


    A nice book I enjoyed reading and that I would recommend if you’re not looking for the absolute bible for Silverlight 3. As I already said before on this blog, so many technologies are being released in a fast-paced fashion that it’s interesting to read some books with a “medium-depth” approach, making best use of your time.


  • Dino Esposito @ Visug : C# 4.0 & testability

    Posted on October 17th, 2009 Thibaut 1 comment


    This last 8th of October, Dino Esposito, a very well known figure in the .NET world, came to the Visug to talk about C# 4.0 and testability. Here’s a summary about the session :

    Software testability

    Code should ideally guarantee :

    • Visibility of the current state
    • Control degree at which code allows to send input data for testing purposes
    • Simplicity of the code results in more reliable test results

    Introducing the .NET 4.0 code contracts API

    The ecosystem at a glance

    1. Code contracts library
    2. Rewriter
    3. Static checker
    4. Contract reference generator

    1. Code contracts API

    3 basic types of contracts :

    1. Preconditions
    2. Postconditions
    3. Invariants

    Exposed via the contracts class (System.Diagnostics.Contracts)

    2. Rewriter

    • Translates contracts into code
    • Modifies MSIL instructions to place contracts checks where they logically belong
    • Executable is ccrewriter.exe

    3. Static checker

    • Examines code without executing it and tries to prove that all the contracts are satisfied
    • Lists unproven contracts to fix, otherwise you should debug or cover it with unit tests
    • Detects if there’s a possibility of contract violation

    4. Assembly reference generation

    • Extracts contract information from source code and returns an assembly with contract-only information
    • Used by rewriter & static checker
    • Executable is ccrefgen.exe

    Steps of a method

    1. Check validity of parameters & stats
    2. Do real work
    3. Check of existing works
    4. Update state accordingly

    Set up

    1. Add reference to mscorlib
    2. Contract must be specified in the body of the methods
    3. Contracts are not mandatory. You can do without

    Preconditions, postconditions and invariants


    • Requires(bool condition)
    • Requires<TException>(bool condition) throws an exception if condition is not met
    • if-then-throw statements
    • RequiresAlways(bool condition) is like Requires but stripped off in retail builds


    • Ensures(bool condition), condition must be true at the end of the method
    • EnsuresOnThrow<TException>(bool condition), condition must be true if exception is thrown. Allows for checks even if exceptional return arises (network error, stack overflow, …)
    • Helper methods
      • Result<T>()
      • OldValue<T>(T variable)
      • ValueAtReturn<T>(out T variable)


    • Invariant(bool condition), object-wide condition that must hold for the lifetime of the class
    • All invariants for a class are defined in one place

    Best practice :

    • Define invariants before implementing the class
    • Express the conditions under which the object is in good state
    • Could be hard to add them at a later time

    Assert & assume

    • At runtime, fully equivalent to Debug.Assert
    • Static checker attemps to prove any Assert, emitting a warning if it fails
    • Static checker treats Assume as always true, adds the assumption to its collection of facts


    • Used to iterate a check on all elements of a list
    • ForAll(…), true if condition is met by all elements
    • Exists(…)

    Interface contracts

    • Define a separate class for the contract because we can’t add code to interface memebers (no mixins in C#)
    • Link to the interface via attribute

    Contracts & inheritance

    Contracts are inherited by derived classes, regardless wether you invoke base class methods in overrides

    Code contracts & debugging

    • When failure, contract raises
      • ContractFailedException
      • ContractFailedEventArgs
    • No default handler (thrown everytime)
    • Register handler to ContractFailedException at startup (Global.asax for ASP.NET, Main method for WinForms)

    Contract failures & unit tests

    • You don’t want contract exceptions in unit tests
    • Rather want exceptions to be reported as tests failures
    • SetHandled() to let assume exception has been handled and SetUnwind() to clear the stack


    • Code contracts as part of the design effort
    • Adds testability to classes & code
    • New API coming up in C# 4.0

    And one final important quote of Dino Esposito :

    “Testable code means that it exposes every significant part of it in order to check its correct behaviour”

    See you next time ;)


  • ReMIX 09 @ Brussels : Summary

    Posted on October 7th, 2009 Thibaut No comments


    This last 29th of September was organized at Kinepolis Brussels the 2009 edition of the ReMIX, which is a one-day summary of the MIX edition (held last March in Las Vegas).

    Two session tracks were available : the Web developer track and User Experience (UX) track. But before this, an introduction was given by some well-known people of Microsoft belgium.


    By Luc Van de Velde, Katrien De Graeve, Gill Cleeren, …

    Here are some key points of the presentation :

    • A demo of the Microsoft Web Platform Installer by Katrien De Grave. More info on her blog post about it
    • Demos of Silverlight 3 new features : smooth streaming, rich media capabilities, SEO & deep linking, improved performance, …
    • Zendster, the first belgian web hoster to provide smooth streaming for Silverlight
    • Companies (such as Elia) performing demos about their Silverlight apps for critical, line-of-business applications
    • A demo of SketchFlow by Arturo Toledo
    • Interviews of companies reflecting the important shift towards UX, which is given more and more importance
    • VTM news (a dutch television company) is using Surface, manipulating a newspaper as a support for presenting news but also to present election results

    • A demo of the Surface application of Belgian Beer Cafe, featuring a wonderful background simulating beer liquid and providing infos about the beers you put on the table. Check out the video below :
    • The launch of WebsiteSpark, an Microsoft initiative for providing training, free licences for small companies, etc

    Session #1 : Prototyping with Sketchflow

    User Experience (UX) track
    By Arturo Toledo

    • No slides, live demo of prototyping an app using SketchFlow
    • More than a mockup tool, SketchFlow allows you to make it behave a real app (and used as is)
    • Effects, such as transitions, can directly be set easily in SketchFlow. No need to code to get everything working (although you can write some if you want to fine-tune some stuff)
    • The user (typically the customer) can test his app mockup as it’s a classic Silverlight application
    • Comments can be drawn on the mockups or feedback can be written in a column next to the mockup screens

    • The flow of the application can be designed visually, creating transitions by linking nodes representing pages

    • The creation of datasources is very easy in SketchFlow. Indeed, in a typical mockup, you need to create dummy data (lorem ipsum for texts, fake names or numbers for forms or grids, etc). Such data can be autogenerated by defining the type of data we want (ex: price, date, text, …), which is a great save of time

    Session #2 : Building Amazing Business Applications with Silverlight and RIA Services

    Web developer track
    By Brad Abrams

    According to Brad Abrams, the must-haves for a great app is :

    1. Professional feel
    2. Rich data query
    3. Validating data update
    4. Authentication
    5. Different views (of the same data)
    • A little Silverlight application was built in a RAD fashion using Entity Framework, featuring a GridView, a form to add/update/edit values and Regex attributes on the properties (code behind) for validations
    • A SiteMap of the app was provided in Robots.txt for indexing by search engines. Different views (html pages) were provided for search engines bots to parse the content of the application

    Session #3 : Creating Silverlight Experiences with Blend 3

    User Experience (UX) track
    By Arturo Toledo

    • An Adobe Illustrator file was imported in Expression Design (a character in a spaceship)
    • Showed then how to build a custom control (a button with glossy effects, mouseover growing animation effect without coding, …)
    • Custom button fires an event, starting a storyboard to make the spaceship fly on the screen
    • Timeline manipulations are performed to make the spaceship make a U-turn before flying back to its original position

    Session #4 : ASP.NET MVC Wisdom : building a real-world app in 60′

    Web developer track
    By Maarten Balliauw

    This session covered the following points in ASP.NET MVC :

    • Validation
    • Templated helpers
    • Security
    • Routing

    Slides of the presentation are available below and source code here



    A very interesting event as you can tell, providing lots of news, demos and other stuff about RIA development in general. See you next year ;)


  • The IDesign Coding Standard

    Posted on October 5th, 2009 Thibaut 2 comments

    IDesign logo

    “A comprehensive coding standard is essential for successful product delivery. The standard helps in enforcing best practices and avoiding pitfalls, and makes knowledge dissemination across the team easier.”

    - Juval Lowy

    As this statement says and from your working experience, you surely know how a coding standard is an essential thing. Juval Lowy, founder and architect at IDesign, an industry and world-class leader bureau of software architecture, puts at our disposal his standards about C# and WCF. Since he published these ones, they’ve become the de-facto industry standards. Needless to say they’re worth casting a glance at.

    Also don’t forget that there are no best standards and what defines a good one is how well and how uniformly you apply the one you’ve defined. Hope you’ll find these resources interesting !


  • Visug : framework design guidelines

    Posted on October 1st, 2009 Thibaut No comments

    The last Visug session was presented by Brad Abrams, Program Manager on the .NET Framework team at Microsoft, who shared with us guidelines about framework design. Member of the .NET Framework team since the beginning, his experience in the field is very valuable for architects and software designers, but also for developers who can highly benefit from a lot of good practices.

    Below, you can find slides of the presentation :

    View more presentations from brada.


    Have a nice reading ;)