Some stuff about Web and .NET development
RSS icon Email icon Home icon
  • Book review : Framework design guidelines

    Posted on October 9th, 2011 Thibaut 2 comments
    Framework design guidelines

    Co-written by two Microsoft employees at the time (Brad Abrams now working at Google), this book is actually a publication of Microsoft guidelines that were produced along the way during the development of the .NET framework. Targeted to a large audience – developers from all levels will learn from this book – you’ll learn how to design a high quality framework, which naming guidelines to apply, type and member design, how to design exceptions, guidelines on how/when to use common types and interfaces of the .NET framework, such as arrays, attributes, collections, serialization, etc. The book also explains the common design patterns of a framework and how to create a good API specification before coding your framework. Very clear and filled of comments of dozen of people participating in the development of the .NET framework, this book is an instant classic !

    Pros

    • Very clear and instructive
    • Lots of guidelines commented by people working on the .NET framework, providing valuable information on how/when to apply those guidelines, when to break the rules, …
    • Developers of every level will benefit from this book

    Cons

    • Nothing special, very good book in overall

    Conclusion

    Excellent book. A must-read for every .NET developer.

    Share/Save/Bookmark

  • Shuffling a collection using Fisher-Yates algorithm

    Posted on August 7th, 2010 Thibaut No comments

    Lately, I came across a situation where I needed to shuffle a collection. It’s the case when, for example, you need to display elements in a random fashion.

    This is where the Fisher-Yates algorithm comes into play. Created by 2 statisticians, this algorithm enables to generate a random permutation of a finite set and properly implemented, the shuffle is unbiased, so that every permutation is equally likely. Exactly what I was looking for !

    Below, you’ll find my C# implementation for shuffling a generic dictionary (adapting this to shuffle any other type of collection should be straightforward) :

    /// <summary>

    /// Shuffles a dictionary using the Fisher-Yates algorithm

    /// </summary>

    /// <typeparam name="TKey">Type of the key</typeparam>

    /// <typeparam name="TValue">Type of the value</typeparam>

    /// <param name="dictionary">Dictionary to shuffle</param>

    public static void Shuffle<TKey, TValue>(ref Dictionary<TKey, TValue> dictionary)

    {

        KeyValuePair<TKey, TValue>[] keyValuePairs = dictionary.ToArray();

        Random random = new Random();

     

        for (int i = keyValuePairs.Length - 1; i >= 0; i–)

        {

            int j = random.Next(0, i + 1);

            KeyValuePair<TKey, TValue> temp = keyValuePairs[i];

            keyValuePairs[i] = keyValuePairs[j];

            keyValuePairs[j] = temp;

        }

     

        dictionary = keyValuePairs.ToDictionary(k => k.Key, k => k.Value);

    }

    C ya’ ;)

    Share/Save/Bookmark

  • Techdays 2010 - Day 2 (1 april) : my notes

    Posted on April 22nd, 2010 Thibaut No comments

    And here’s the second and last part of my notes taken at Techdays 2010.

    Session 1 - Unkeynote
    By Scott Hanselman

    • A quick recap of ASP.NET 4.0 new features, such as :
      • Clean HTML : specify client IDs (better for JS and CSS)
      • ViewState improvements (enable it just for some controls, …)
      • Charts
      • Cache extensibility : HDD based caching
      • Customized Web.Config (staging, prod, …)
      • Clean URLs for WebForms (REST)
      • Client-side binding in JS
    • MEF : Managed Extensibility Framework (design applications as components able to interact with others)
    • Parallel Computing : “threading for the masses”, so developers can focus on the business and not on concurrency problems

    Session 2 - Introducing MVVM
    By Laurent Bugnion

    • MVVM stands for “Model - View - ViewModel”
    • Advantages :
      • More testable
      • More maintainable
      • Blendability (ability to be edited in Microsoft Blend)
    • A lot of code examples
    • Laurent Bugnion has created the MVVM Light Toolkit, intended to accelerate the creation and development of MVVM applications in WPF, Silverlight and in the Windows Phone 7.

    Session 3 - Visual Studio Tips
    By Sara Ford

    • Sara is author of a book about Visual Studio Tips, such as shortcuts, productivity enhancement tips, … And the session was a sample from this book
    • You can find the tips she’s given on her dedicated blog entry

    Session 4 - What’s new in ASP.NET 4.0
    By Fritz Onion

    • Javascript intellisense + snippets
    • Routing (ASP.NET MVC URLs style)
    • ViewState improvements (ability to enable/disable it for a particular control, disable it application wide, …)
    • Ability to specify a ClientID (which is better for Javascript and CSS, no more need to use “ends-with” selectors
    • SessionState : store the session of the user in DB
    • Meta tags : ability to specify them code behind
    • Charts : a large collection of charts (including some based on Dudas charts)
    • QueryExtender : create filters for data that is retrieved from a data source, without using an explicit Where clause in the data source

    Session 5 - Software testing with Visual Studio 2010
    By Brian Keller

    • Software bugs cost billions of $ each year in the U.S
    • Today, still too much manual testing (about 70%)
    • Introducing Testing Center : interface to configure test plan :
      • Type of logs to produce
      • OS or browsers to test with
    • Test recording : user is performing actions being recorded and can be replayed later => about 20x faster than manual testing
    • If a test case fails : video to show what happened
    • Intellitrace : listing all the events and processes done by the app. Very useful to find quickly what went wrong (instead of placing breakpoints, doing some guess work, re-running the app, …)

    Session 6 - ASP.NET AJAX 4.0 : what’s new
    By Fritz Onion

    • Fritz started by announcing that Microsoft decided to make jQuery the primary way to develop AJAX apps using Microsoft technologies (officially announced by ScottGu at MIX in March)
    • As a consequence, no more effort will be put by Microsoft in the MS AJAX library
    • No notes to list here as the session was obsolete following that announcement

    Share/Save/Bookmark

  • Techdays 2010 - Day 1 (31 March) : my notes

    Posted on April 19th, 2010 Thibaut No comments

    I finally take the time to blog my notes about the 2010 edition of the Techdays, after some pretty busy weeks of work dealing with deadlines.

    Session 1 - Developer keynote
    By Anders Hejlsberg, Hans Verbeeck, …

    • Evolution of computer languages (from Turbo Pascal to now) and evolution of hardware (HDD capacity : 100 000 x, RAM : 10 000 x, CPU : 1 000 x)
    • Evolution of tools : debugger, profiler, huge frameworks, …
    • 3 major trends today
      • Dynamic
      • Concurrent
      • Declarative (more on WHAT instead of HOW)
    • Multi-core CPUs : need to develop accordingly (Parallel Linq, Task Parallel Library, …)

    Session 2 - Silverlight 4 & WPF 4
    By Gill Cleeren and Katrien De Graeve

    • Silverlight 4
      • Printing : visual tree to select what to print
      • Drag & drop : even from an external app (eg : drag an image from the explorer to Silverlight). Also works on Mac
      • Right-click support
      • Webcam & microphone support enabling powerful applications : scan barcodes with the webcam, …
      • RichTextBox : rich formatting (fonts, colors, images, …) into a TextBox
      • Out of browser enhancements : notification windows with custom look, complete control over the window (change the size, no borders, …)
      • Trusted out of browser apps : go beyond the sandbox
    • WPF 4
      • Visual Studio 2010 : built onto WPF
      • Better tooling : similar to WebForms design
      • Support for Win7 : multi-touch, ribbon, taskbar manipulation, …
    • When to use Silverlight or WPF ?
      • Tip of Gill Cleeren : “make Silverlight the default choice for business apps unless you require specific WPF features”

    Session 3 - C# 4.0 and beyond
    By Anders Hejlsberg

    • Dynamic keyword : be static as much as you can (compilation checks, performance, refactoring, error checking, …). dynamic should be use to simplify the syntax (replacing invoke, binding flags, etc)
    • Optional & named parameters : avoid multiple overloads, supply default values. Better experience with interop : no more 15 “missing” parameters
    • Co & contra variance : to simplify, developers can now work easier with collection types, and have less problems with linq queries
    • Compiler as a service : API of the compiler (meta programming, language objet model, …). Introduction of the new CSharpEvaluator class

    Session 4 - ORM with entity framework in .NET 4.0
    By Kurt Claeys and Hans Verbeeck

    • ORM : working with relational tables like objects in memory
    • Why use it ?
      • Productivity
      • DB independance
      • Hides complexity, uniform way of working
    • Entity framework is a Microsoft strategic technology (they use it in Reporting Services), which is a sign that they bet a lot on it
    • 2 ways of working
      • Model first : DB doesn’t exist yet, design classes and generate SQL code from it
      • DB first : DB already exists, generate classes from it

    Session 5 - ASP.NET MVC 2 : ninja black belt tips
    By Scott Hanselman

    • First, Scott gives us a tip to avoid repeating the same code : use T4 (text templating) to automate it (related article)
    • Hybrid apps : you don’t have to choose between ASP.NET Webforms & MVC. Ex : codeplex is written with both, some parts being exclusively WebForms or MVC
    • Then, a lot of demos…

    Session 6 - Building Windows Phone apps with Silverlight
    By Giorgio Sardo

    • A lot of demos in this session about what can be done with the phone (layout rotation, custom styling, …)
    • To summarize, a citation from the speaker : if you’re a Silverlight developer, you’re a Windows Phone developer

    And that’s it for the first day ! See you in a next post for my notes about day #2 ;)

    Share/Save/Bookmark

  • [FR] DotNetHub : C# 4.0 et les améliorations à la BCL

    Posted on March 28th, 2010 Thibaut No comments

    Bonjour à tous,

    Ci-dessous, vous trouverez en vidéo la conférence de la précédente édition de DotNetHub. Celle-ci, présentée par Pierre-Emmanuel Dautreppe, abordait C# 4.0 et les améliorations à la BCL.

    Plan de la conférence

    • Co & Contra Variance des types génériques
    • Paramètres nommées et optionnels des méthodes
    • Types dynamiques
    • Simplification pour l’interopérabilité COM
    • Améliorations apportées à la BCL (Base Class Library)

    1ère partie

    2ème partie

    Notez également que DotNetHub aura un stand aux Techdays cette fin de mois, n’hésitez donc pas à passer pour vous renseigner, rencontrer ses membres ou devenir sponsor. A bientôt ;)

    Share/Save/Bookmark

  • [FR] DotNetHub, le UserGroup .NET/Agile francophone

    Posted on January 17th, 2010 Thibaut No comments

    DotNetHub

    DotNetHub, le tout nouveau UserGroup francophone en Belgique, est le résultat du projet initié par 3 de mes collègues (Pierre-Emmanuel Dautreppe, Norman Deschauwer et Thierry Thoua) en association avec d’autres professionnels de l’informatique. Le but de ce dernier est double :

    • Pallier l’absence de UserGroups francophones en Belgique. Le premier UserGroup belge, VISUG, se rapprochant toujours plus de la partie nord du pays, l’initiative est plus que la bienvenue
    • Proposer en plus d’un pôle technologique (.NET) un pôle méthodologique consacré à l’agilité (Scrum, XP, …) par l’organisation de dojos, entre autres

    Pour la première session, DotNetHub aura le plaisir d’accueillir Peli De Halleux, un petit belge travaillant désormais pour Microsoft à Redmond. Il vous présentera Pex, Moles & Stubs, des outils de tests unitaires pour .NET.

    Pour plus d’infos sur la session, c’est par ici. Pour s’inscrire, cela se passe par là.

    Bonne session ;)

    Share/Save/Bookmark

  • Visug : lightweight stubs & detours for .NET

    Posted on November 11th, 2009 Thibaut 1 comment


    Visug

    Peli De Halleux, a belgian guy now working at Microsoft Research (Redmond) came back in Belgium at the Visug to talk about the project he’s working on. Stubs, Moles and Pex form together a lightweight framework to test .NET applications.

    Stubs

    Stubs is a stubbing framework solely based on delegates. Various examples can be found here.

    Moles

    Here’s an example of what you can accomplish with Moles, allowing you to replace any .NET method :
    Moles

    Pex

    And here, a diagram showing at a high-level view how Pex works :

    Pex

    Pex is an automated whitebox testing tool for .NET. From your code and parameterized unit tests, test code is automatically generated in C# and test results can be seen in the “input/output table”.

    Project-related resources

    I could copy-paste the great description of the project off the official website… But I instead recommend to those of you who are interested in this to take a look at the following resources, explaining you what Stubs, Moles and Pex are all about in the details.

    Pex

    Have a nice reading ;)

    Share/Save/Bookmark

  • 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 ;)

    Share/Save/Bookmark

  • Visug : Building better user interfaces

    Posted on June 3rd, 2009 Thibaut 2 comments

    Microsoft Belgium

    The 27th of May was held the latest session of the Visug in the (beautiful) offices of Microsoft Belgium about user experience. Presented by Jason Beres from Infragistics, a company specializing in user interfaces and user experience, the covered topic aimed to introduce people how to build great user experiences. Here is the overview of the presentation that was given :

    • Understanding user experience
    • Using patterns for better user applications
    • Platform issues
    • Problems solved
    • Wrap up

    From the icon a user double clicks, the splash screen and the visual of the application he sees, the user experience is every touch point with the user. It’s the branding and the image of your company you give to people so it’s very important.

    “User experience (UX) is about making great software… for people !”. Think about the user who uses your application every day, maybe full time ! It has a big importance from the user point of view. So making great software is understanding user needs while providing exciting and revolutionary UX.

    One first important concern is “how to build what people want”. This is where you start to make great UX. For this, UX experts interview users to determine what they need (and understanding the difference between what they say and what they really need), study how they interact with software to determine how to architecture your app.

    Understanding user experience

    1. Information architecture

    • It’s about organizing principles. What do you want ? Where are you in the application ?
    • Deliverables : navigation maps, glossaries, keywords, categories, search strategies, …
    • Need to think about it up front because this is what will determine the final result

    2. Interaction design

    • Discover and refine stories : coherent, consistent and effective UX
    • Deliverables : storyboards, usage scenarios, sketches, wireframes and prototypes
    • All of this to determine how the user will be actually using your app

    3. Visual design + user interface

    • Establish visual framework and style, strenghten communication, establish trust
    • Deliverables : themes, styles, palettes, mockups, images, visual guidelines and patterns
    • Patterns : this will be the focus of today’s presentation

    Patterns and user experience

    We’re gonna see patterns about designing interfaces. First, two recommended readings from O’reilly :

    Designing interfaces Designing web interfaces

    A first advice is to avoid to overpattern (eg : “caution : stairs !”) where it’s obvious there are stairs isn’t an added value at all. Let’s now introduce some UX pattern. Each one features a name (eg : “iconic navigation” for the iPhone interface), a problem (when/why/context) and a solution (implementation/examples).

    Paging

    • Prob : long lists of similar data (ex : search results)
    • Solution : present item grouped accross multiple pages

    Eg : the Flickr paging bar :

    Paging

    Faceted navigation

    • Prob : multiple elements from different categories to list
    • Solution : present them organized in facets (groups of data)

    Eg : the faceted navigation in the shop section of Amazon

    Faceted navigation

    Clear entry points

    • Prob : need to make very clear to the user what the entry point is
    • Solution : provide a page with minimal design with the emphase of what needs user’s attention

    Eg : the Google homepage :

    Clear entry point

    A tip with clear entry points : it’s difficult to provide some application an entry point when there are many options available. Microsoft Expression Blend uses an interesting trick to cope with that : the first time you start the application, you’ve got a little menu as a clear entry point, with the possibility to check “hide this next time” when you’ll have discovered the application more in details, thanks to the clear entry point.

    Titled sections

    • Prob : you’ve got many sections and want to give the user a preview of each of them
    • Solution : provide clickable section names which redirects to the full section

    Eg : Yahoo news

    Titled sections

    Liquid layout

    • Prob : a lot of information to display so maximizing user’s screen usage is wanted
    • Solution : provide a resizable window enabling the content to adapt to it just like a liquid would do

    Eg : windows explorer

    Two panel selector

    • Prob : two panels containing large information must be displayed at the same time but the width is too small
    • Solution : implement a vertical or horizontal bar enabling to resize both panels when dragged

    Eg : the windows explorer again, allowing you to resize folders hierarchy or folders content

    Overview plus detail

    • Prob : must provide the user an overview of something but there are also plenty of details to show
    • Solution : implement a zoom-in/out functionality allowing to have overview but also details

    Eg : Google Maps

    Overview plus detail

    Alternative views

    • Prob : same information but can be presented in several different ways
    • Implement a view selector to let the user choose how he wants his information to be displayed

    Eg : windows display mode menu (thumbnails, small icons, medium icons, …)

    Undo

    • Prob : the user can make wrong operations that need to be undone
    • Implement a undo functionality

    Eg : Gmail undo functionality :

    Undo

    A note about undo : I’ve read from articles on the web (a topic called “human interface”) that undo is way way better than the typical alert/confirmation box. Indeed, you’re so used to click that “ok” button that if you make the wrong decision, you’re done. Following some study, there’s nothing more frustrating for users than loosing their work so being able to prevent that is the best you can do for them. And undo is just the perfect choice for that, completely worth its extra cost in terms of development.

    Resources

    In addition to the two books listed before, some interesting web resources are :

    And last but not least, Quince, a really great UX Pattern explorer, developed by Infragistics and based on Silverlight.

    Wrap up

    • Build software for people
    • Use a process
    • Learn from patterns
    • Keep your eyes open

    And to finish, a very important information ! I’ve talked before the session with Pieter Gheysens (one of the founders of the Visug) who told me that Dino Esposito will be doing a session in October for the Visug. After Juval Lowy last fall, his colleague from IDesign will be teaching us some good architecture principles. So be sure not to miss him ! I’m currently reading one of his books .NET architecting applications for the enterprise which is really instructive !

    See you there !

    Share/Save/Bookmark

  • User Experience @ Vitra : I’ll be there

    Posted on May 25th, 2009 Thibaut 1 comment

    User Experience @ Vitra is a mix of demos and informations about Silverlight, Web development, Surface, Windows 7 etc presented by Microsoft and Vitra. The BESUG (Belgian Silverlght User Group) - a group I’ve subscribed for, which organizes conferences about Silverlight in Belgium - will also be present for some talks and demos. This event will start at 7pm and will be held at the 4 different dates and places :

    • 2nd June Antwerpen (Gijzelaarsstraat 20)
    • 4th June Diegem (Woluwelaan 137)
    • 10th June Gent (Vlaanderenstraat 107)
    • 11th June Luik (Rue Matrognard 13)

    I’ve subscribed for the 2nd of June and BTW this is a free event. For more info, take a look at the facebook page of the event.

    See you there ;)

    Share/Save/Bookmark