Showing posts with label DSL. Show all posts
Showing posts with label DSL. Show all posts

Saturday, November 1, 2008

Self-funded eval of Oslo's M language

I think this is the first self-funded evaluation of M that I've found on the web.  Great job William.

This is my favorite:

Except for this caveat, I like “M”. It’s not anti-XML (you can represent values as XML if you’d like) but it avoids the “the answer is XML/XSD what is the question” approach to modeling that is sometimes a little too prevalent. “M” is a much better schema language for IT systems than XSD. 


Simple Banking Transaction Model in M

At PDC I meet Alejandro. He and I worked through a very simple example of a bank transaction model.

Here's a warning. Not everything writen here is currently supported by the CTP compiler, such as enumerated values for Transaction.Kind. But you'll get an idea of what we would like to support by the time we ship.

Here's the model. Check out the computed value to test that an instance is in fact a valid Transaction. It uses type ascription to test that t adheres to the shape and constraints of the Transaction type.

Also notice the computed value, ChildrenTransactions, to determine the transactions that are children of another transaction. It uses a shorter syntax of LINQ-style queries that we call compact query syntax. I put the full LINQ syntax in quotes so you can compare.

Finally, notice the constraint to validate that Transaction.Target has been set when the Kind is a "Transfer".

module Banking 
{
    Transactions : Transaction* 
where item.Source in Accounts, 
item.Target in Accounts;

    Accounts : Account*;
    
    ValidTransactionGoodness (t : Entity)
    {
        t : Transaction
    }

    ChildrenTransactions(t : Transaction)
    {
        Transactions where value.Parent == t
    }
    
     type Account
    {
        Id : Integer64 = AutoNumber();
    }  where identity Id;

    type Transaction
    {
        Id : Integer64 = AutoNumber();
        Parent : Transaction?;
        Kind : { "Transfer", "Deposit", "Withdrawal"};
        Source : Account;
        Target : Account?;
        Amount : Decimal28;
    }  where identity Id, 
Kind == "Transfer" ? Target != null : Target == null;
}

Thursday, October 30, 2008

wonder twin powers activate

I'm a superhero fan. Not really into reading the comics, but definitely watching the Saturday morning cartoons :)

 

I keep gloating over my team. They are awesome. Well we have a couple of folks that I'll call the Wonder Twins, aka, Zan and Jayna (btw - I did not knew their name before today). Individually, each is an awesome person with great talents. Put them together, and BAM, watch out. They have an amazing multiplier greater than 1+1. I enjoy watching them work. I am often jealous.

 

Having wonder twins is wonder-ful. We have a hard problem, wonder twin powers activate. We need some new bits as soon as possible, wonder twin powers activate.

 

In all seriousness, Zan and Jayna are good friends, and great team members. Yet another reason I love my team!

Tuesday, October 28, 2008

DSL Hell

Everyone remembers DLL hell. You know -- run my app but there's 15 versions/copies of a DLL. So which one do I choose.  That was hell.

 

Guess what? I hate to tell you, but we are in DSL hell. There's XML dialects all over the place. Those are DSLs (for Mrs. Pinky, that's domain specific languages). And so we have lots of developers having to learn different XML dialects just to work with different runtimes.

 

And, APIs themselves are really just DSLs. You have to know which objects to instantiate, which methods to call, and in what order.

 

So - we're in DSL hell. And it's an ugly hell. Who likes writing code in XML? (besides Don Box)

 

Oslo, and M, are about to change the game. We want developers to build and use natural, textual languages. Imagine users configuring and running applications by writing simple text in a simple language targeted at their domain. Imagine writing a WCF service in 10s lines of code instead of 100s lines of C# + 20 lines of config + ... Imagine a standard language for business processes, such as Purchase Order Processing. Imagine imagine imagine...


One more thing. As a developer, I am pretty sure you will have more fun writing a DSL with Oslo than most programming you do today. I haven't had this much fun in years!


So this is Oslo. Check it out: http://msdn.microsoft.com/oslo


Geeks interacting with Models

We're announcing Oslo to the world as I type.

Someone leaned over and said, "Geeks having been looking to find tools to interact with Models for a long time..."

I don't think she ment Oslo models :)


Monday, October 27, 2008

"the brain"

If I'm pinky, then I'm sure everyone is asking, "where's the brain?"

Microsoft has lots of brains. They're all probably trying to take over the world. Or trying to explain the brain to us mere mortals.

But pure intelligence does not bring about revolution. Most of the time brain people are over confident, arrogant, and un-influential (except to threaten to hurt the Pinky).

My brain is different. "Brain" is very smart. He has answers to just about anything. And he's usually right... usually :). But the thing that differentiates my "Brain", and that makes my team so awesome, is that "Brain" is a nice person. "Brain" will listen intently on what you have to say, explain what you don't understand, and do it again if needed. "Brain" empathizes, cares about people, and helps everyone on the team. Brain is taking over the world 1 person at a time.

"Brain" is one of the reasons I love my team.

Friday, October 24, 2008

My team a' la hide-n-seek

I'm sure anyone that follows MS has seen mini-microsoft. Here's an insider hiding his/her identity to talk about Microsoft.

Well - I'm not hiding anything about me (just ask ;). But, I would love to tell you about my team at Microsoft. And yet, I don't want them to be too upset with me. So, I'll inverse mini and tell you about them but with interesting code names/aliases so as to hide the innocent.

BTW - don't expect dirty. I love these folks. They are the best - to work with, to hang with, to build cool stuff with.

My team rocks!

Thursday, October 23, 2008

Oslo

I work on Oslo.

Oslo is so smokin' hot. I can't wait to talk more about it after PDC next week.

In the mean time, I'll ramble on...

I've been reading about parser combinators today. It's like building a set of mini-parsing functions into 1 big gigantic function. I don't get why that makes life easier. I still have to write the mini-parsing functions.

It still looks like a cool thing right now - at least in a language like ML or Scala (both of which I'm still learning). But I think that's  because they support algebraic types and pattern matching directly in the language. 

I hope to find time to actually build a small example here shortly. We'll see how it goes.