Archives / 2006 / May
  • Script# brings compile-time and C# niceties to JavaScript development

    I'm very excited to finally be able to point to this post of Nikhil's. I've known about this project from the start and am Super-Ultra-Mega-Excited (this expression (c) Andres Sanabria) about it, but until now I had to keep my mouth shut.

    JavaScript is in many ways a very powerful language, but it lacks a compile-time (bye bye type checking) and OOP is very unnatural. While some consider it the best language ever, most people who come from C# or Java just go "ugh!" the first time they have to write anything beyond a click event handler with it. Some continue to strongly dislike it even after they've gained expertise with it. I'm not judging, but...

    Wouldn't it be nice to keep the power of dynamic scripting languages but with all the niceties of statically typed languages?

    Enter Script#, a project Nikhil started on his spare time (how much spare time this guy has has always been a mystery to me).

    Watch the screencast:

    Read the first blog post:

    And tell him what you think.


  • Don't play this game

    And I mean it. It will just eat up all of your free time. It will keep you awake at night and prevent you from doing anything else. For weeks. Or months. Your significant other will hate it.
    Just look on the left of this page and compare my number of posts for April and May. Care to guess when I started playing The Game?
    Don't start playing this game or you won't stop.


  • ScriptDoc: document your Atlas classes

    When I was talking at the Journées Académiques last week, someone in the audience asked me about documentation tools for Atlas classes. That was a great question, especially as I had such a tool ready...

    This application generates documentation for Atlas client script libraries.

    It generates XML documentation files that have the same format as C# documentation files and that can be processed by existing tools such as NDoc.

    Documentation is generated from the source code of the classes defined in files and namespaces defined in a project file. The project to use is specified
    using the project query string parameter. For example, if you have built the project file myProject.xml in the Projects directory, browsing to
    default.aspx?project=myProject will generate the file Output/myProject.xml documentation file.

    The tool can work in the absence of specific documentation information in the source code but the usefulness of such documentation will be small.
    To include real documentation, you can use the /// comments that are familiar to C# developers with one essential difference: the comments have to be
    inside of the class or method definition.

    Here's an example of class documentation:

    Sys.Data.DataView = function() {
       /// <summary>
       ///   DataView filters its input data through a collection of filters.
       ///   It can also paginate and sort data.
       /// </summary>

       // [... actual definition of the class ...]

    Here's an example of method documentation:

    this.getItem = function(index) {
       /// <summary>
       ///   Gets an item in the filtered data by index.
       /// </summary>
       /// <param name="index">The index in the filtered data of the row to return.</param>
       /// <returns>Null if the row was not found.</returns>

       return _filteredTable ? _filteredTable[index] : null;

    And finally, here's an example of a property's documentation (notice how the
    documentation is on the getter only, not on the setter):

    this.get_data = function() {
       /// <summary>
       ///   The data that the view will filter.
       /// </summary>

       return _data;
    this.set_data = function(data) {
       _data = data;

    To be able to write the output XML file, the application must have write access to the output directory. For this reason and also because I didn't especially look for possible injection attacks, this application should never be exposed publicly on the Internet. I recommend making it only accessible locally.

    One more thing: for all this to work, the application must be installed in an Atlas-enabled application. This means the right web.config, Atlas dll and of course the script files that you wish to document.

    You can download the tool (source code included) from this workspace:

    UPDATE: The 1.0 version, which works with ASP.NET Atlas 1.0 and later and produces data that Sandcastle can use can now be found on Codeplex.


  • .NET 2.0 Book recommendation

    I've been meaning to do that for a while. A few months ago, I had the pleasure to review the ASP.NET 2.0 part of Patrick Smacchia's excellent Practical .Net2 and C#2. The book is really excellent and is the most complete I know on .NET 2.0. It covers with unparallelled accuracy everything about .NET 2.0. This book is an almost 900 page masterpiece and reference book that I highly recommend.

    Practical .Net2 and C#2