home & news
interviews
tools
the spout
writing
fun
colophon
contact
off topic

Google

Please consider ASP.NET hosting plans provided by HostMySite.com, a Microsoft Gold Certified Hosting Partner.

Microsoft

Software Legend

Windows Forms Coding Hero

Mensa

IEEE

         

You've reached the internet home of Chris Sells, Program Manager in the Distributed Systems Group at Microsoft. I've also written some tools and done some writing, both targeted at the Windows developer. Enjoy.

Marquee de Sells: Chris's insight outlet

 Consume the RSS 2.0 feed (or the RSS 0.91 feed)
 View the archive (may take a moment)

What is all the fuss about how you can write DSLs in Lisp?

I found an interesting post on domain-specific languages and Lisp from June of 2007. It has this to say about designing a DSL:

"There are three approaches to designing programming language syntax. The first is to develop a good understanding of programming language grammars and parsers and then carefully construct a grammar that can be parsed by an LALR(1), or LL(k) parser. The second approach is to `wing it' and make up some ad-hoc syntax involving curly braces, semicolons, and other random punctuation. The third approach is to `punt' and use the parser at hand."

I like these categories. I find most folks do #2 with no tooling support or #3 using XML. MGrammar in Oslo is about making #1 easier than #2 and providing the tooling support, e.g. language-specific Intellisense services.

The real topic of the thread, however, is how to do a DSL in Lisp. The questioner would like to implement the following syntax:

trade 100 shares(x) when (time < 20:00) and timingisright()

I find this syntax to be reasonable for an event and it wouldn't be hard to imagine a system with a bunch of rules expressed this way and I could imagine a developer and a business person working together on such a system to ensure things were expressed properly. I don't think I could imagine the business person keeping up as well with syntax expressed as the answerer suggests, however:

(when (and (< time 20:00)
                   (timing-is-right))
      (trade (make-shares 100 x)))

IMO, that's not a DSL -- that's just a set of function calls in an existing language.

Monday, January 05, 2009 8:20 AM  (2 Replies)

Eat Less and Exercise: Before and After

A few years ago, I looked like the "before" picture to the right. I didn't look like that all the time, thank goodness -- this was some couples' party and I was doing the "ballerina dance" challenge -- but as you can tell, I was a tad overweight. Specifically, I weighed in excess of 100 pounds more than the top end of my idea weight range, which put me over 300 pounds.

I had been a skinny kid with a fast metabolism growing up. At 6'5" it takes a lot of food to get to full grown, even when I had only a medium build (I can't even claim to be "big boned"). In college, living in a fraternity served by a cook that believed fully in the benefits of meat and potatoes and having been born in the Midwest with a gravy ladle in my mouth, I got my "freshman 15" in the first semester and kept on going until I was the jolly fellow you see to your right (complete with the belly that shook like a bowl full of jelly).

I tried dieting. A few years ago, I was able to lose 50 pounds on The Geek Diet (it was a freely downloadable PDF file at the time), but gained it all back in a year. The problem was that that diet is fundamentally based on deprivation: you count calories and don't eat more than a certain amount based on your activity level. This made me hungry and crabby all the time. Then, one Christmas back in Fargo under the influence of my deep-fried meat, brownie, cinnamon roll and fudge pushing grandmother, I snapped. It was like a psychological rubber band, pulling me right back into my old habits. Also, I didn't exercise, so I'd plateau'd and my metabolism wasn't equipped to deal with even a few extra calories.

Over the last twelve months, I tried something different and as of a coupla week ago, I look like the guy on the left. I called it "eat right and exercise." It sounds revolutionary, I know, but I've lost 60 pounds over the last year and I've kept it off (even after the visit to my grandfather over the holidays!) The idea isn't to diet at all, but to change your habits. I can't say that I'm expert enough to recommend any of this to you, but here's what I did:

Stop Eating When You're Full. This was the hardest one to learn. In college, I learned up to drink and, most importantly, when to notice when it's time to stop drinking. However, it took me 'til I was 38 to learn how to tell when I was full. This involves eating slowly and being very ready to leave food on your plate (which I always try to do now).

There's Always More Later. This is the other key to stopping eating. As much as I might like something and want to finish it, I had to realize that there would always be more of whatever it was later. I learned to feel good about leaving food uneaten, no matter how good it was.

Eat Better Food. If you have to choose between eating 1000 calories of Doritos or of broccoli, I think we all know the right choice to make. The key is, making it. I've had to learn to like salad, fruits and vegetables, which I'm still working on. I'm always trying new things to learn to eat things that are better for me.

Don't Buy Grazing Food. If I'm doing something I don't like or am bored or reading or watching TV or any number of other things, I can easily eat chocolate or chips or any other manner of things that are bad for me, even if I'm not hungry. I have a hard time saying "no" to an unhealthy snack when I'm watching a movie, for example, so I don't buy them. Instead. I buy apples and applesauce and melons and other things that are good for me so that if I have to snack, there are only good things available.

Eat Lots of Meals. This one is counter-intuitive, but I find I do better if I eat a small amount every few hours than larger meals three times a day. In general, if I'm hungry, I eat and if I'm full, I stop. It's really just that easy.

Don't Deprive Yourself. If you want a piece of chocolate or a chip or whatever it is that you crave, then have it. Life is short and there is a variety of wonderful things to enjoy. Don't gorge yourself -- everything in motivation -- but don't make yourself crazy, either. I find it makes me feel good to eat a piece or two of my grandmother's famous fudge and it feels equally good to stop eating it.

Exercise Regularly. This is one of my major failings with The Geek Diet. I was depriving myself of calories, but I wasn't boosting my metabolism, so my body was just adapting to fewer and fewer calories. These days, I try to swim 2 miles/week and that seems to keep me at my fighting weight.

Mix It Up. I find I'm happiest eating a bunch of small portions than one or two large portions at a meal. I like variety, so I like a little bit of a few things. Also, to make sure that my body doesn't get used to my level of exercise (it's getting easier and easier to swim for distance), I try a variety of exercises. For example, I just did a 90 minute hot yoga class the other day (I thought I was gonna die) and I regularly do sprints in the pool, going as fast as I can. The latter's useful because it always sucks, no matter how fit I get, so it's almost more than I can handle.

Commit. The key to making anything happen is to decide it's going to happen and then route around obstacles until it does. The days I swim without resting or swim a mile when I normally go half are the days I decide to do so. The key to weight loss or any other accomplishment is first to commit.

Don't Beat Yourself Up. Didn't do as much exercise as you wanted this week? Had a few too many Twinkies? So what. You're human. Let it go. Don't give up. Do better today.

The whole point of all this is that it's not about a temporary diet, but about changing my habits permanently. I still have 40 pounds I'd like to lose, but I don't obsess about it. In fact, I haven't weighed myself in months. And even if I never do lose those pounds, I'm down from a 44 waist on my pants to a 38. If I do nothing but stay there, I'll be happy as hell with myself.

I love that most of these tips are just like Scott's newsflash -- gives me some validation. Do you have tips to contribute? Tell me about them.

Sunday, January 04, 2009 4:47 PM  (4 Replies)

Martin Fowler: DslExceptionalism

I love what Martin has to say on the topic of designing DSLs:

"DSLs are seen as a small and simple subset of general purpose programming thinking. As a result people think that what's true for general purpose languages is also true for DSLs (with the implication that DSLs are too small to be worth thinking much about).

"I'm increasingly of the opposite conclusion. The rules for DSLs are different to the rules for general purpose languages - and this applies on multiple dimensions."

When you're ready, Oslo lets you build DSLs to be as simple or as complex as you like.

Tuesday, December 30, 2008 4:47 PM  (0 Replies)

Spirited Discusson of Oslo on stackoverflow.com

Joel Spolsky and friends have started a developer question/answer board and they've started to get some Oslo traffic. Jump on in; the water's fine.

Tuesday, December 30, 2008 4:41 PM  (0 Replies)

Jon Flanders Builds XLANG in MGrammar

It's cool to see an MGrammar for a real-world language (XLANG). Enjoy!

Tuesday, December 30, 2008 4:39 PM  (0 Replies)

Creating a Logo / Turtle Graphics Textual DSL using Oslo MGrammar

Jason Hogg has posted a very cool Oslo DSL and an interpretter for doing Logo Turtle Graphics. He had this to say about MGrammar:

I did the bulk of the work specifying the grammar for this simple version of Logo on the flight back from LA to Seattle - which should give you a sense of how intuitive Mg is - and how productive the Intellipad authoring experience is.

Thanks, Jason. We try!

Tuesday, December 30, 2008 4:37 PM  (0 Replies)

Shawn Wildermuth on Oslo

Shawn's been doing a bunch of Oslo work on his web site:

Enjoy.

Tuesday, December 30, 2008 4:31 PM  (0 Replies)

Jeffrey Juday Exploring the Oslo Repository

Jeffrey has a nice hands on intro to Oslo focusing on the Repository:

Oslo is Microsoft's model-driven future. The Repository is one of the many architectural components debuting in the Oslo SDK. M is the Oslo model building language. M is translated to TSQL and the resulting Data Definitions create tables and views in the Oslo Repository.

Check it out!

Tuesday, December 30, 2008 10:41 AM  (0 Replies)

Erik Stepp provides the question for Oslo's "42"

I'm just catching up a little after one set of holidays and before another one on Wednesday and I noticed Erik Stepp's blog post entitled "Oslo == 42" in my inbox. In his post, he provides a lovely discussion of what Oslo is and why we built it, giving us a concrete example from his own development life. He got it pretty much dead on. Check it out.

Tuesday, December 30, 2008 9:31 AM  (0 Replies)

Parsing relative and absolute dates with MGrammar

Dilip Krishnan has built a lovely little date parser that supports absolute dates like "6/2/1969" (just like DateTime.Parse already supports today) and relative dates like "today" or "next Monday" or "5 days from today". I find myself using relative date expressions like these all the time in Outlook and I've love to have them in every app I use that does dates. With Dilip's parser and the Oslo SDK, you can add it to your app. Good work, Dilip!

Monday, December 22, 2008 4:57 PM  (0 Replies)

If you liked Zork, you'll love Spork!

Spork is a sample of an end-to-end application using M and the Repository. It starts by defining a set of M types that describe the data needed for a text adventure along the lines of the famous Infocom game Zork (and hence the corporate bad-café-inspired name). The M instances are generated by running a custom compiler developed with the VBA (Visual Basic for Adventures) MGrammar grammar. We also provide a runtime driven by adventure data loaded into the Repository in multiple versions of the types called AdvRunner.

Follow along with the video or with the ReadMe see Spork in action. Enjoy!

Monday, December 22, 2008 3:50 PM  (2 Replies)

Lang.NET + DSL DevCon = Joy

This year, we’re thinking very hard about putting the Lang.NET conference and the DSL DevCon at the same venue (the research center on the Microsoft Redmond campus) in the same week. The idea is that people interested in general-purpose language design and development can come to Lang.NET and the people interested in domain-specific languages can come to the DSL DevCon and for folks interested in both, the DSL DevCon will start right after Lang.NET, so folks can stay a little longer and come to both. Also, the conference chairs on both conferences will make sure to keep the content unique across the two conferences.

 

We think that’s a good way to make sure the conferences complement each other and helps keep people’s schedules sane and their travel costs lower. However, I have two questions for you:

 

1.      Traditionally, Lang.NET is 3 days and a DevCon is 2 days. Because of the overlap of the content (languages), we were wondering if folks thought it would be a good idea to do 2.5 days of Lang.NET and 1.5 days of DSL DevCon this year instead, doing both conferences in 4 days instead of 5. What do you think?

2.      If we linked these two events like this, will you attend just Lang.NET, just DSL DevCon or both?

 

Post your comments on this blog entry. Vote early, vote often!

Thursday, December 18, 2008 5:15 PM  (4 Replies)

Notation, Notation, Notation!

Markus Völter has posted some interesting model-driven design guidelines, my favorite of which is "notation, notation, notation!" Since Of course, since Oslo provides MGrammar to let you build the notation of your choice, I'm hardly unbiased. : )

Wednesday, December 10, 2008 6:40 AM  (0 Replies)

.NET Rocks! Oslo is Love

COM spread the love between developers of multiple languages.

Oslo spreads the love between domain experts, developers and IT folks.

Check out show #401 of .NET Rocks for the how and the why. Enjoy.

Tuesday, December 09, 2008 10:46 PM  (0 Replies)

Mr. Epl on the brain

I've been writing my MSDN Magazine pieces introducing Oslo and spending a great deal of time in Mr. Epl mode inside Intellipad. So, at 1:23p on a Sundary afternoon, I'm getting a little loopy, which is manifesting itself as me repeating famous lines from popular culture, only substituting Mr. Epl's name, e.g.

"Mr. Epl, I am your father."

"Oh, Mr. Epl, I can't pay the rent!" "You must pay the rent." "I can't pay the rent!"

"Help me, Mr. Epl. You're my only hope!"

"Mr. Epl, Mr. Epl, it hurts when I do that!" "Don't do that."

Did I mention I'm doing the voices, too?

Sunday, November 16, 2008 1:23 PM  (1 Replies)

SpankyJ is an Oslo Star!

SpankyJ (Josh Williams) is a star developer on the Oslo team (specifically the MSchema compiler) and he's been doing some very cool stuff with M.

Firstly, Spanky's the author of the Mr. Epl tool, which is a Read-Evaluate-Print-Loop program for interacting with M (M-REPL => Mr. Epl -- cute, eh? When we used to call "M" "D", it used to be Dr. Epl. If we change it to "S", we'll Senór Epl! : ). Mr. Epl ships with the Oslo SDK, so if you've installed it, you can find it in C:\Program Files\Microsoft Oslo SDK 1.0\Bin\Intellipad\Samples\Microsoft.Intellipad.Scripting.M\MREPL.exe or you can execute it directly inside of Intellipad with the MScriptMode mode.

For a demonstration (and an explanation of how to get MScriptMode working in Intellipad), Spanky has recorded a very nice Mr. Epl screencast. Highly recommended.

Secondly, Spanky has just released a library for taking the output of MGrammar and producing a graph of .NET objects via XAML. He's got a nice screencast of using it to create something simple to give you a feel, then he moves right into a natural language processor for creating WPF windows and controls interactively. The ability to type text that translated into WPF without using angle brackets demonstrates the potential for DSLs very well, I think.

A few notes when watching Spanky's screencasts:

  • He has slowed himself down considerably to be clear and understandable and he's done a good job. If you'd like to hear what he sounds like in real life, run the screencast at 1.5x speed. : )
  • He has a blinking red/green light in the taskbar -- what *is* that?!
  • He's a dev that tells a story like a champ -- why the hell does my team even need PMs?

Anyone interested in Oslo should absolutely subscribe to Spanky's blog. I know I have.

Saturday, November 15, 2008 9:50 AM  (2 Replies)

Syntax Coloring for Your Custom Mg Language with Intellipad

Justin Bailey shows how to hook up custom syntax highlighting in Intellipad for your MGrammar language. Very cool!

Thursday, November 13, 2008 8:10 AM  (0 Replies)

tvrss.net + uTorrent + FiOS + WHS + 360 = DVR Bliss

So, the other day, Windows XP SP2 destroyed my Windows Media Center Edition install that I've been using for years and absolutely loved. It let me record all my favorite shows on two separate tuners and I could watch them on the TV attached to my MCE box, from all the PCs in my house and from my XBOX 360. Losing it was a huge blow, especially since it was clear I'd need to repave and I was swamped with PDC and post-PDC work (damn those MSDN Magazine deadlines!).

A little research revealed the following facts:

  • tvrss.net provides RSS feeds of every TV show I've ever heard of, whether it's on normal TV, cable or a premium channel like HBO and Showtime. The shows are available in HD with the commercials pre-edited out, so I wouldn't even have to do the 30-second fast-forward, 5-second rewind dance that MCE enables to skip them.
  • uTorrent provides automatic downloads from RSS feeds, including fancy features like only downloading each new episode once, even if it's provided from multiple sources.
  • My Verison FiOS pipe provides 20MBps downloads, so a 22 minute TV program (30 minutes - 8 minutes of commercials) even at HD would only take about 20 minutes to download, on average.
  • My $500 Windows Home Server machine has 1.4TB of storage, so your average 22-minute sitcom, at 180MB, is only a tiny fraction of the storage. Put another way, I could store about 4000 hours of TV.
  • My XBOX 360 supports the same format (XVID) that TV shows available from tvrss.net seem to be provided in. Further, my 360 has direct support from playing videos from shares on my home network (which is wired for 1GB Ethernet, but only run by a 100MB Ethernet router right now).
  • The XVID codec is available, along with a ton of other useful codecs, from free-codecs.com (I'm partial to the K-Lite Codec Pack myself), which means that any videos that I download in XVID format can be played back on any PC in my house. Those PCs running Vista Ultimate that have a Media Center remote control on them can surf to videos on the network and pick them with an experience just like that of my XBOX 360.
  • It's my understanding that the XBOX 360 menuing system will be updated this month to support Netflix streaming, so for the minimum subscription fee (1 DVD at a time, $8/month), I'll be able to get live, streaming movies directly from my XBOX 360 and all my PCs for the movies I don't yet own.

All of this means is that if I were to schedule episodes of say, Burn Notice, to be recorded by uTorrent and dropped into the Videos\TV\Burn Notice folder of my WHS box, I'd be able to access those and play them back on my XBOX 360 even more simply then I could access video from my MCE box, because I don't have to start up the Media Center software first -- access to shared folders is built right into the XBOX 360 menuing system. And I could have all of this in HD (no CableCard required) without commercials and without regard for how many tuners I have. This is all free and, if I don't want to watch live TV (the Superbowl was the last time I did), then I don't even need to spend $55/month on cable.

Plus, when combined with my photos, music and ripped DVDs, all of which are also stored on my WHS box, and streaming movies I don't yet own, I could access all of my digital media from my XBOX 360 (attached to my 46" LCD panel) and from all of my PCs simply and quickly.

Of course, I would never record my favorite TV programs like this, because it's very much a copyright violation and therefore highly illegal.

But if I did, wow, it would rock...

Why do I need cable again?

Wednesday, November 12, 2008 6:44 PM  (3 Replies)

Rocky on Oslo

Rockford Lhotka had this to say about Oslo:

"The Oslo modeling tools are also interesting, though they are more future-looking. Realistically this idea of model-driven development will require a major shift in how our industry thinks about and approaches software development. Such a massive shift will take many years to occur, regardless of whether the technology is there to enable it. It is admirable that Microsoft is taking such a gamble - building a set of tools and technologies for something that might become acceptable to developers in the murky future. Their gamble will pay off if we collectively decide that the world of 3GL development really is at an end and that we need to move to higher levels of abstraction. Of course we could decide to stick with what has (and hasn't) worked for 30+ years, in which case modeling tools will go the way of CASE.

"But even if some of the really forward-looking modeling ideas never become palatable, many of the things Microsoft is doing to support modeling are immediately useful. Enhancements to Windows Workflow are a prime example, as is the M language. I've hard a hard time getting excited about WF, because it has felt like a graphical way to do FORTRAN. But some of the enhancements to WF directly address my primary concerns, and I can see myself getting much more interested in WF in the relatively near future. And the ability of the M language to define other languages (create DSLs), where I can create my own output generator to create whatever I need - now that is really, really cool!

"Once I get done with my book and all my fall travel, you can bet I'll be exploring the use of M to create a specialized language to simplify the creation of CSLA .NET business classes : )"

Rocky on, Rocky!

Wednesday, November 12, 2008 3:27 PM  (0 Replies)

Designing a language is hard; implementing it shouldn't be

Frans Bouma has an interesting point: Designing a language is hard, and M won't change that. And he's right.

For many domains, a DSL can make expressing what's important easier so that the developers using the DSLs can communicate between themselves and to a computer with fewer lines of code, making it easier to read, check and maintain. Many (arguably most) domains live without a DSL, instead encoding design decisions into general purpose languages, adding unnecessary ceremony to the essence of what's being decided, thereby obscuring it.

Does M making designing a language easier? No. It's still hard to design the syntax of a language. Does the M family of languages and the associated tools make it possible for more developers to add DSLs to their domains, letting them concentrate on the essence their language and reducing the Weird Science-like ceremony to bring it to life? We hope so. You'll have to let us know.

Tuesday, November 11, 2008 10:55 AM  (0 Replies)

More Oslo Reactions: What “Oslo” is and is not

Lars Corneliussen (not the wonderful Lars that did a cameo at the Repository & Schemas PDC talk about 8 minutes in) did a nice overview of Oslo. It's amazing to me how well the vision and details of the platform came through at the PDC. General-purpose modeling is a new thing for mainstream developers, but at least the developers that we've heard from so far seem to be open to the idea.

Tuesday, November 11, 2008 10:42 AM  (2 Replies)

Ted Neward Explores M

When I was an external to Microsoft, I used to see new Microsoft technologies and have several reactions: wonder, awe, lust, hate, confusion, apathy. Really, Microsoft was a harsh mistress that caused all kinds of reactions.

I've been heads down for 3.5 years working on Oslo, so seeing other peoples' opinions from inside of Microsoft is very enlightening. Ted Neward has an Oslo opinion that I enjoyed reading, even if it wasn't all positive. Thanks, Ted.

Tuesday, November 11, 2008 10:36 AM  (0 Replies)

News: How modeling will change programming

Burley Kawasaki is a Microsoft marketing person, it's true, but he also really understands the point of Oslo. Enjoy.

Tuesday, November 11, 2008 10:27 AM  (0 Replies)

Three-Pane MGrammar Development in Intellipad

Roger Alsing has posted a discussion of how Intellipad's support for MGrammar development makes writing DSLs easier but showing you what parsers and how as you update the input file and the grammar file itself.

Personally, I'm a huge fan of seeing something work as I type. Think of it as "holistic intellsense." The SQL generation in Intellipad works the exact same way. I find it a huge help.

Tuesday, November 11, 2008 10:22 AM  (0 Replies)

Another Oslo MGrammar Sample: WatiN

Torkel Ödegaard has done a very nice, detailed look at created a DSL in MGrammar for the WatiN browser automation library, including a look at the code he used to parse the Abstract Symbol Tree produced by MGrammar to do something useful.

Tuesday, November 11, 2008 10:18 AM  (0 Replies)

   
  home & news   interviews   tools   the spout   writing   fun   colophon   news  contact  off topic 

This page is copyright (c) 1995-2005, Chris Sells. All rights reserved. No warranties extended. Some assembly required. Void where prohibited. You may link to this site freely from your own site. You may quote small excerpts from this site, but please include a link to the original source on this site.