« December 2007 | Main | February 2008 »

January 2008

January 26, 2008

Latest DLR Hosting Spec

hosting

I'm working on my Lang.net slides this weekend, and I just realized that I forgot to send out a link to our latest DLR hosting spec. Written by the incomparable Bill Chiles, this is a remarkably thorough guide to our hosting API. 

If you're stepping through our sources, at some point in time you'll run across scary types like ScriptHost and friends. The sources don't help much here, but page 14 of the spec sure does :) Enjoy.

January 25, 2008

Help wanted: IronPython PM

I've been at Microsoft for a little over a year now. Outside of the pain of moving to another country with a wife, two young kids and a dog, it's been awesome. I have the privilege of working on an awesome team, and because of our awesomeness, we're growing. We need someone to drive the direction of IronPython. But what does 'drive' mean?

My title says that I'm a Program Manager. But what does a PM do? It's a fairly nebulous job at Microsoft. There are folks who work on deep technical roles like Mads Torgersen, who works on the design of C#. There are other folks who designed and championed new technologies like Scott Guthrie who created ASP.NET, and is now a General Manager at Microsoft. You can rise pretty far in the company too, both J Allard and Bob Muglia started out as PMs.

One analogy that works is that of a Hollywood movie producer. Your job is to define what movie to make, set the direction, and figure out what has to be done and when. The job requires a lot of knowledge about how movies are made, which is why many producers rose from the acting or directing ranks in Hollywood.

Similarly, a PM needs to understand how to build software. Some PMs write code that ships in the product, but that's not a requirement. What you are held accountable for is what needs to be done and when. The world isn't a static place, so a lot of times you need to change direction in a big hurry - but that's OK - it's what makes the job a lot of fun. You also get to work with folks from around and outside the company. A few weeks ago, I had an awesome time talking with folks from Microsoft Research, our Robotics group, and Amazon about how IronRuby relates to the things that they're working on.

If you think you're up for the challenge, and want to work for an awesome team, send mail to me: jflam at the big software company in the Pacific Northwest.

Hate the mouse!

I hate mice. I really do. If it weren't for web browsers, I'd likely never use a mouse. So what does it really mean to live a mouse-free lifestyle?

NoMouse

First, you should get rid of toolbars. If you're not planning on using a mouse, toolbars just waste screen real-estate. This is what my copy of Visual Studio looks like:

VS2008

You should invest time in learning common keystroke shortcuts for your applications. For example, ALT-F-S in nearly all Windows apps will save (as will CTRL-S). To open the most recent document ALT-F-1 will do. In fact if you hit the ALT key, you'll toggle the underlines on your menu for the keys that will activate each menu option.

To make my keyboarding in Visual Studio more efficient, I also use viemu (VI emulation) in Visual Studio. If you're coding on a Mac, which lacks important programming keys, this is an absolute life saver.

If you use Visual Studio, check out this table of key bindings for C#.

If you spend a lot of time doing email, you should take the time to learn the keyboard shortcuts for your mail client. I particularly like GMail since I can drive their web client using the keyboard (with vim-esque bindings to boot). Check out their list of keyboard shortcuts.

For Outlook, the default bindings work just fine (although please enlighten me as to why CTRL-F searches in *all* other Microsoft programs except Outlook). Learn to love ALT-R for reply, ALT-L for reply-all, and CTRL-ENTER to send.

I've also hacked in some additional functionality in my copy of Outlook through some macros:

Outlook Zen

This lets me do ALT-Q to drop something into my archives, ALT-W to mark something for follow-up (and generates a matching Task for that item as well), and ALT-P to reply to a mail in plain-text and quoting the original mail using ">" (really useful for mailing lists). This makes it really quick to triage mails to get my inbox back to empty.

I had to bind those macros to the menu bar in Outlook. I'd love it if someone could explain to me why Outlook doesn't let me define custom key bindings so that I don't have to resort to hacks like dropping buttons on a menu bar.

Here's the macro file that I install into every copy of Outlook that I run:

Enum ItemOptions
    MarkAsRead
    MarkAsUnRead
    MarkAsTaskForToday
End Enum

Private Sub MoveToFolder(folder As String, options As ItemOptions)
    On Error Resume Next

    Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
    Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem

    Set objNS = Application.GetNamespace("MAPI")
    Set objInbox = objNS.GetDefaultFolder(olFolderInbox)

    Set objFolder = objInbox.Folders(folder)
    If objFolder Is Nothing Then
        MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, _
"INVALID FOLDER" End If If Application.ActiveExplorer.Selection.Count = 0 Then 'Require that this procedure be called only when
'
a message is selected Exit Sub End If For Each objItem In Application.ActiveExplorer.Selection If objFolder.DefaultItemType = olMailItem Then If objItem.Class = olMail Then If options = MarkAsRead Then objItem.UnRead = False End If If options = MarkAsTaskForToday Then objItem.MarkAsTask olMarkToday End If objItem.Move objFolder End If End If Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing End Sub Sub MoveSelectedMessagesToArchive() MoveToFolder "Archives", MarkAsRead End Sub Sub MoveSelectedMessagesToFollowUp() MoveToFolder "FollowUp", MarkAsTaskForToday End Sub Sub ReplyAsPlainText() Dim app As New Outlook.Application Dim exp As Outlook.Explorer Set exp = app.ActiveExplorer Dim item As Outlook.MailItem Set item = exp.Selection.item(1) item.BodyFormat = olFormatPlain item.Actions("Reply").ReplyStyle = olReplyTickOriginalText Dim reply As Outlook.MailItem Set reply = item.Actions("Reply").Execute reply.Save reply.Display End Sub

You'll need to either sign this file using a cert or disable macro security to get this to work on your computer.

Oh yes, when in Office learn to love CTRL-F1. This minimizes / restores the ribbon bar to give you back a ton of real-estate.

If you hate the mouse, then you should hate dragging and resizing windows as well. Overlapping windows is so 1990's. With large monitors today, *tiling* is the new hotness. To help you tile windows, you must get the totally awesome WinSplit Revolution. I bind it to CTRL-ALT-4 (tile left), CTRL-ALT-6 (tile right) and CTRL-ALT-5 (maximize). CTRL-ALT-left and CTRL-ALT-right move windows between multiple monitors. My only gripe with it is that it doesn't move vim windows at all. It works out of the box the first few times and then mysteriously stops working (it would rock if it were open source so that I could fix this myself ... wink wink nudge nudge).

January 02, 2008

IronRuby vs. Ruby.NET?

Sheesh

In the spirit of Jon Udell's Principle of Keystroke Conservation, I'm posting a follow-up to M. David Peterson's write-up on the differences between Ruby.NET and IronRuby here.

David observes correctly that the key difference between the two implementations is IronRuby's dependency on the DLR. The DLR provides some important benefits for languages that target it:

  • A shared code generation engine. It's a lot easier to use our code generation APIs than Reflection.Emit, so this saves time for compiler implementers. This also means that future performance improvements in the DLR show up for free in your favorite DLR-targeted programming language.
  • A shared hosting interface. We act as a broker between the host and the programming language. You target the DLR, and our programming languages (and others that we don't create but target the DLR) come along with no extra effort on your part. My team is building hosts for both Silverlight and ASP.NET.

There's a few quotes that I would like to clarify:

“Do I want the increased interop between a broader base of languages provided by the CLR (and therefore go with Ruby.NET), or do I want the performance gained for dynamic languages by the DLR, (and therefore go with IronRuby)?”

I don't think that you lose anything in terms of interop with existing CLR-based languages by targeting the DLR. While it's certainly true that there's a lot that we can do to make dynamic dispatch better in existing CLR-based languages (would you rather call Office APIs from C# or VB.NET?) there's nothing today that prevents you from calling IronRuby library code from C#. As long as you do so via our hosting interfaces[1], things should just work. It's unclear to me how you can call arbitrary Ruby.Net code from C# without having to pass along all of the context goo that languages like Ruby require.

Here's another:

"the dynamically compiled nature of IronRuby fits well into the much less predictable world of client-side applications, where as the statically compiled nature of Ruby.NET fits well into the much more predictable world of server-side applications."

A key advantage of the static compilation model of Ruby.NET is minimizing cold start time. They still have CLR cold start to deal with since their assemblies must be JIT-ed whereas IronRuby needs to generate IL *and* JIT the code. So I would turn this argument around and say that for client apps where cold start time is crucial that this is an advantage for Ruby.NET. That said, we used to have an AOT compilation model for IronPython, and have since removed it from the feature list of DLR 1.0. This is something we would like to revisit in the version after 1.0.

[1] Bill Chiles on my team has been working hard on updating the hosting spec. I've got an updated version that I'll post in a separate blog post.

Photos

  • www.flickr.com
    This is a Flickr badge showing public photos from John Lam. Make your own badge here.

Recent Comments

Recent Posts

May 2008

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Blog powered by TypePad