The Fastest Readable Xml

I hate xml.

I really hate it. No humans should have to read it.

As a developer, if I have to even think about Xml, then it is because some developer before me made the wrong choice.*

That said, sometimes a developer full of contempt toward Xml does need to read xml.

Both feedburner and WordPress output mostly well spaces xml, but what if I look at rss from blogs.msdn.com? It looks like the webserver is running a whitespace filter. This is not human readable Xml. Now, I COULD copy and paste into Visual Studio, but then I have to open a new xml document, or save what I’m viewing in the browser and open in Visual Studio. All too many steps.

Cygwin comes with an optional program called xmllint. It is part of the libxml2 package, so be sure to select libxml2 when you run cygwin setup.exe.

$ curl http://blogs.msdn.com/giorgio/rss.xml | xmllint –format – | less

This reformats the xml into a nice 2-space indented by tag display.

* This may be a bit extreme, but I will stand by it most of the time.

C# vNext feature request

At Ann Arbor Dot Net Developers meeting last night, Eric Maino was there. I don’t think he meant to open up the giant can of worms that is me when he asked “What kind of things would you like to see in the next version of C#?” Here is my list.

  • Static Imports

    yes like java!

    Sometimes extension methods aren’t as readable as just a method call. Ability to import static methods and call them without the class name would be super.

  • Drop var.

    Type inference rules. Can we drop the var? its noise.
    var x = 1;
    x = 1;
    which of these lines is more concise? At least make it optional. I don’t mind if you want to say var. Just don’t make me do it.

  • Better type inference

    Optional type parameters, since the compiler knows what I mean!
    peeps = List(new string[] {“Bob”,”Dorothy”,”Jane”});
    This is a List<T>, but I don’t need to say List<string> the type can be inferred via the List<T>(IEnumerable<T>) constructor.

  • Optional Whitespace Significance

    We all use whitespace formatted code anyway. Why not just drop the parenthesis and semicolons and make the whitespace actually mean something. Of course I say “optional” because not everyone will like it. It would be really cool to be able to toggle it throughout a file.
    #pragma whitespace significance enable
    public class Employee
      public Employee()
        name = string.Empty
        hireDate = DateTime.Now
      public string Name
        get
        set
      public DateTime HireDate
        get
        set
    #pragma whitespace significance disable
    public GiveRaise() {
    salary *=1.10;
    }
    #pragma whitespace significance enable
      public Promote()
        CLevel--

    The file would have to end in the same mode in which it were started, or the compiler can figure things out.

  • A hook into the compiler pipeline

    See boo.

  • A hybrid compiler

    At CodeMash, Joe O’Brien and Michael Letterle about how nice it would be to use the better suited language for any given task in .NET. We don’t want separate projects. We don’t want separate netmodules.

    I want it right down to partial classes. VB’s XML Literals and late binding are sweet. I want to use those if I need. C#’s everything else are what I prefer to work with.

    ReadYourFeed.cs:
    public partial class ReadYourFeed {
      Initialize(){
        rss.FirstChild.AppendChild(GetGenerator());
      }
    }

    ReedYourFeed.vb:
    Partial Public Class ReadYourFeed
      Public Function GetGenerator()
        Dim sig = <generator>SuperReadYourFeed 2000 1.2.3.4.5</generator>
        Return sig
      End Function
    End Class

    * I don’t know VB. Writing that VB took me much googling

  • A plugable compiler

    Similar to the above with boo, but almost the inverse. I want an open definition for the AST which the compiler uses to generate IL and I want a great API for building this AST myself.

    Next, I should be able to plug in my own parser/lexer which builds this AST. So the IL generation from the AST is entirely from the (now more than) C# compiler, but the parser is mine.

    This is really an abstraction and opening of the previous step. Instead of just C#/VB, I want it ALL!

  • Easier method currying.

    Dustin Campbell might like writing lots of code to do it in C#. I’m sure he does it all the time, but I’d like to be able to do it in FAR fewer lines of code.

  • F#’s pipeline operator.

    This is more readable
    {1..10} |> Seq.fold (+) 0;;
    than this
    Enumerable.Aggregate(Enumerable.Range(1, 10), (a, b) => a + b);
    or this
    (from i in Enumerable.Range(1, 10) select i).Sum();
    or even this
    Enumerable.Range(1, 10).Sum();
    Ok, well extension methods sure look a lot like the pipeline operator, so never mind on this request 🙂

It seems like I talked about other crazy stuff too, but I don’t recall what things they were.

Creation of Open Space

via Gregg Newsom

 

Open Space is an awesome format for meeting and conferencing. The Day Of Dot Net Conferences have been promoting it with varying success.

Personally, I love it when a conference has space set aside for Open Spaces, if the conference isn’t entirely open space format. There are only so many times I can sit through another presentation about something I have seen before. Open Spaces does provide an alternative for us overly selective types.

More importantly, it provides a place for you to get out of it exactly what you put into it. What do I mean by this? How many times have you said “yeah, that would be awesome” to some idea when you were talking with someone at a conference? Open Spaces provides the means to make that idea a reality. Next time this happens to you, please grab that person with whom you were speaking and march directly to the open spaces room and begin working, planning, designing, developing, whatever-ing. Maybe make a pit-stop at the Open Spaces board on the way.

I can’t wait for the upcoming development tools focused open space event at SRT Solutions. I love my tools. I’m passionate about my tools. Like any good craftsman, I have my favorite hammer, my favorite saw, and my favorite drill. I feel crippled without my own tools. Ask a craftsman to build you something and give him unfamiliar second rate tools and see what happens 🙂  You probably will not like the results.