Scott Hanselman

Mix: Getting my head around Oslo, M and MGrammar

March 12, '09 Comments [20] Posted in Mix
Sponsored By

imageI've been trying to get my head around "M" and "MGrammar" and "Oslo." I put the names in quotes as I'm not sure what's a codename and what's not. ;)

Oslo Developer Center on MSDN - The hub of all things "Oslo"

I had an opportunity yesterday to do a SharedView with Doug Purdy on his Mix talk. The talk is Developing RESTful Services and Clients with "M" and it's Friday at 9. He'll be doing it with Chris Sells as Code Monkey. Doug and Chris are an animated pair and their talks are a hoot.

When I've seen Oslo talks before, it's seemed like a lot of hand-waving and talk of things transforming into SQL and magic and elves. I told Doug it was too high level and that'd I appreciate something really concrete that I could really start to grok. So he focused on "M" - their new modeling language. I've done some simple DSL (Domain Specific Languages) so I figured this would be a good place to start.

Also, I took a bunch of screenshots (secret - don't tell!) while I was in this LiveMeeting/SharedView of Doug's demos. This part is making sense to me.

Here's a screenshot of their editor. Don't sweat the tools too much, but it's basically Emacs with a .NET heart written in WPF using IronPython for plugins. They call it Intellipad. You can do this stuff from the command-line, though. It's lightweight and quiet.

NOTE: The Intellipad editor is using the same WPF Editor in Visual Studio 2010. Nice to see folks sharing components. How is it all plugging together? MEF. Bam!

Anyway, on the left there, is a sentence "Scott is 36 years old." Actually my wife says I'm 35, so my bad there. Anyway, that sentence is a DSL - a Domain Specific Language. It's a DSL only because we decided it was. Just now.

oslo

In the middle there is the MGrammar (in a .mg file). (Good video on MGrammar here) 

This is kind of like Lex and YACC, but more general, and it quickly gets away from the dirty text parsing part of things and into the model much faster than they do.

The MGrammar in the middle describes our new DSL for expressing info about People. I can now say "Fred is 12 years old..." etc. Now I've got a simple DSL that I can consume and anyone can right. Still, a DSL isn't useful unless you can DO something with it.

On the right, in the third window pane is a tree of the output of this DSL with the MGrammar applied. Now I've got an object (or series of them) with properties that I can do something with.

Now,  we could give the system more info about these People. Like, give them an Id that's an Int32, make sure the system knows Age is an Int32 also, etc. There's all sorts of constraints like this that are much richer than a DB. This is the "modeling" part. We express what something is as simply as possible.

3

OK, so fast forward and switch gears to something more concrete. You're probably familiar with cURL. It's a the command-line tool for messing with URLs from the command line. You can GET, POST, etc with this nice command-line tool.

They created an example they're calling MURL to show how one could create a Domain Specific Language for talking to URL endpoints. Stated differently, MURL is a REST client built with their tools in very little code.

In this shot, he's got the MURL DSL on the left, looking like HTTP initially. Just GET url, for now. Then he adds to the language and makes it so he can do things like "secure using" with names and passwords. Then he adds POST support with payloads, etc. He can make his little language look like whatever he wants.

murl2

In this screenshot, he's made ? mean GET and ! mean POST, etc.

7

Some DSLs we use all the time are:

  • SQL - "select * from whatever"
  • XPath - "//something/else[@cool = 'neat']
  • RegEx - "%(&^%&^$#%#$@#$*@#((**$#$%"

And we often use these DSLs and their associated "engine" from our .NET code. That means, I could use MURL (or any other DSL and its engine I create) from my existing .NET code.

See the "runtime.Parse" statement in the screenshot below? I'd probably change the name and make it a one liner like "Murl.Do()" but you get the idea. Then the result is just XML I could go to town on.

Here he's using his MURL language from inside ASP.NET MVC to do some work. Don't get mired in the fact that he's just doing an HTTP GET to an endpoint. You might be all (and I was too) "ya, I can use Web Client for that." The idea would be you could create languages that can more easily expressed in a DSL than in C#.

When I worked in banking (not too long ago, actually), Patrick and I created a DSL for modeling domain object by extending XSD (an existing DSL). We could have created a much more terse and person-friendly DSL (as opposed to XML which is person-hostile) with tools like this. I can see this greatly facilitating Domain Driven Design.

mvc

Doug's talk is at Mix (and will be online later) on Friday and you can find it on the Mix Site. Remember it's not really about URLs, or REST, or MURL, it's about the creation of DSLs and the tools that support it.

It's early, but now I've got more context. I'm not on board yet, but it's slowing sinking in for me.

Other MGrammar Examples

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Free ASP.NET MVC eBook - NerdDinner.com Walkthrough

March 10, '09 Comments [40] Posted in ASP.NET | ASP.NET MVC | NerdDinner | Source Code
Sponsored By

imageToday is a pretty cool day. It's the culmination of a bunch of little stuff and a lot of hard work by some really nice dudes. Here's a few surprises.

Rob, Phil, and I have been working on the ASP.NET MVC book for a while. One (poorly kept) surprise is the inclusion of ScottGu as an author on the book. Between the four of us, we got enough forehead space for like six guys.

Here's where it gets cool.

Free ASP.NET MVC eBook

Today we're releasing the first 185 pages of the book as a FREE PDF download.

Not only that, it's licensed as Creative Commons Attribution No Derivatives. You can share, distribute, hand out, transmit it all you like. You can even include it in your own book if you'd like. ;)

We worked really hard on this chapter, but the real applause goes to ScottGu who closed down Starbucks a number of times, working late into the night. If you enjoy ScottGu's Epic Blog Posts, here's 185 pages of Epic. This chapter will be Chapter 1 in the book; kind of a book within a book.

The book itself is deep in production but this should hold you off for a while, I hope. ;)

Free ASP.NET MVC Sample Application - NerdDinner

Next, we're releasing the NerdDinner sample application at http://nerddinner.codeplex.com as MS-Pl. It's not nearly as sophisticated as the MVC Storefront, but it's pretty cool and does some nice stuff in a very clean way, in our opinion.

There's also more Full Application Samples to be had at http://www.asp.net/mvc with more to come soon!

Big thanks also to the NerdDinner style designer Michael Dorian Bach and to Dave Ward for his jQuery ninja skills. Thanks also to Steve Harman for his peer review. (I'm getting there! Soon...)

I'll be maintaining the application with all these folks, and you're welcome to join in! I'm hoping to add features like RSS, iCal, Blog Badges, jQuery UI controls, OpenID and more in the coming weeks. Wanna help?

Mix 09

I'll be presenting NerdDinner and the code at Mix 09 next week on Thursday at 2:30pm in session "T49F" called

"File|New -> Company: Creating NerdDinner.com with Microsoft ASP.NET MVC "

You can sign up for my talk by going to the Mix Session Builder, entering "T49F" and clicking on the "Green Plus Sign" next to the title.

Enjoy!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 152 - Code Generation and T4 with Kathleen Dollard

March 10, '09 Comments [4] Posted in Podcast
Sponsored By

dollard My one-hundred-and-fifty-second podcast is up. Scott chats with Kathleen Dollard about the past and the future of Code Generation. Scott's infatuated with T4, but does it have a future?

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Genome is a sponsor for this show!

Welcome to powerful, mature object-relational mapping in the .NET world. Genome lets you use the full benefits of LINQ with all major database platforms (Microsoft SQL Server, Oracle and IBM DB2). Genome: supporting real-world enterprise application development since 2002.

Telerik is a sponsor for this show!

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

10 Awesome Things I Remember About Computers

March 5, '09 Comments [124] Posted in Musings
Sponsored By

imageGreat fun on Twitter today as I asked when folks went online for the first time in their lives. The answers were marked with the #goonline hashtag. Mostly just random reminiscing but it got me remembering the fun we had "suffering" in the olden days.

The best part, of course, is that my "olden days" aren't yours. Maybe you learned with punch cards or maybe your first machine was a *gulp* Pentium. Either way, it was different and now it's a part of you.

Here's a totally random, completely useless collection of things I remember doing/accomplishing/working on while I was "coming up" in computers.

What's your list? Is it a list of suffering? Of joy? Of great fun? Of accomplishment?

What's 10 Awesome Things You Remember About Computers?

QEMM Using QEMM to rearrange all the TSRs in upper and extended memory. Then getting better than QEMM and using intuition to get better results.


sc0003b3d4 Stacker'ing a 40 meg MFM hard drive. Upgrading to DR-DOS and getting compression for free.


808019844_b1946eab8e Running a multi-node WildCAT! BBS under DesqView. Later running it under OS/2, then OS/2 Warp.


s_PC1553-2 Upgrading my PC/XT by meticulously adding dozens of DIPs to an QUADBOARD expansion.


200px-Squareholepunch Using a standard paper hole punch to punch another write-protect notch in a 5 1/4" floppy to make it double-sided.


mus_128 Telling everyone to be quiet so the acoustic coupler on a 300 baud modem could do its thing.


tape Using a regular cassette tape to play games on a Commodore Vic 20. LOAD "*", 1, 1


asciiart Printing out 40+ page or more giant-posters of Mr. Spock created entirely in ASCII on a TSR-80 and a 9-pin dot matrix printer. It took hours.


compute Typing in games from the back of COMPUTE! magazine. I ended up hiring kids from down street to read the long list of HEX values and CRC codes to me.


pclip_compute_feb86 Buying a printer to work with PaperClip and having to type the printer's control codes directly into the application.


What's yours, Dear Reader?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Quake Live Review and Rant - Why is this interesting?

March 2, '09 Comments [34] Posted in Gaming
Sponsored By

So I installed and have been playing QuakeLive. Here's the Review part. It's fun. It's Quake. Fast, pretty, twitchy, fun. Quake. Good fun.

Here's the Rant part. I'm having trouble understanding is why this is interesting in any way?

Folks on the 'tubes are saying, "OMG, this is a Browser-based game?"

To say, browser-based game, to me, implies effortless installation. More importantly, it also implies a reason to be in the browser. See the screenshot below? That's the MSI installer I ran as Admin.

InstallingQuakeLive

See this screenshot? That's IE requesting permission to run this plugin. There's a separate MSI if you want to run it in Firefox. I download and installed both installers separately.

image

Here's a sample error message:

** GLW_CreateWindow: could not register window class
Please report the the problem you encountered on the Quake Live forums.
You must reload the web page to make this display go away.

A web (or web-enabled) app that doesn't phone home with errors? Hm. Doesn't seem like a web app to me.

See this screenshot? That's my %appdata% folder with 266 MEGS downloaded. It gets downloaded in the background while you "train." Why do you think they train you for 10 minutes in a single level? It's because they are downloading the other 1/4 gig of content.

QuakeFolder

I'm sorry, but this is a re-imagining of Quake III Arena, compiled as a DLL and running inside my browser. It's the same PAK file concept and format that you (possibly) remember from ten years ago. Yes, 1999.

Yes, there's social aspects, background content delivery, easy multi-player matching, but why is this a DLL living inside the browser's memory space and not an EXE that jumps out of the browser? Do I want something that I think of as a browser plugin downloading 256megs+ of content for me? Why is no one pointing out that the emperor frag-fest has no clothes?

Apparently this is interesting to the young people today because the ones playing Quake Live because they weren't alive when Quake was released originally.

I would rather that a game company like ID spend more time really innovating in the gaming engine space (and I know they are), rather than repackaging the same game in different ways for a decade.*

Quake Live is NOT an interesting game. There are more interesting ways to distribute games that have been working nicely for me since 2003. GuildWars is another GREAT example. It was a <1meg EXE to bootstrap and streamed the levels you needed. There's no reason for QuakeLive to be shoe-horned into a browser plugin.

Now I'm off to delete 256 megs of Quake III from %AppData%\LocalLow\id Software\quakelive\home\baseq3.

End of rant. Move along.

*Quake and its four sequels, Quake II, Quake III Arena, Quake 4, and Enemy Territory: Quake Wars

Technorati Tags:

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.