Thursday, 20 December 2007

Redesigning a famous webpage

I came across this page which offers a rethink of a very well-known webpage. I like it - what do you think?

Wednesday, 19 December 2007

Noble number

Whilst chatting with the lovely Nadyne at OOPSLA, she came up with the notion of a "Noble number", much like the Erdos number or Bacon number. So, I'm happy to announce that I have a Noble number of 1 as we have just submitted a paper on upgrading in Java (co-authored with Matthew Parkinson and (the) James Noble)!!

Thursday, 6 December 2007

Volta is Live

Want to write cool multi-tier Web apps? Don't want to write them in Javascript but prefer VB/C#? Want the compiler to do the tier-splitting for you? Want it to run in any browser (at least any one with a Javascript VM)?

You're in luck! My friend Erik Meijer has been running an elite team in Redmond building exactly this system! A technology preview of Volta is now available from Live Labs:

http://labs.live.com/volta/

Check it out! (And congratulations to Erik and his team.)

Wednesday, 5 December 2007

Interview

There's an interview with me in the Slovene press today. For the first time, the topic is my wife! It's her turn in the spotlight as part of the Slovene Woman of the Year competition.

SML/CAML/F# differences

It's all Nick Benton's fault! I just spent a whole day trying to get some of his cool "embedded interpreters" code through F#. Ug. It was very hard to pin this down, but it turned out to be a difference between SML (the language I know and Nick's code is written in) and CAML/F#.

Here's the offending function:

let mypair args =
match args with
((e,p),(e',p')) -> (function (x,y) -> (e x)@(e' y), function [x;y] -> (p x, p' y))

Type this into F# you get the following type:

val mypair : (('a -> 'b list) * ('c -> 'd)) * (('e -> 'b list) * ('c -> 'f)) -> ('a * 'e -> 'b list * ('c list -> 'd * 'f))

Type the similar code into SML/NJ you get the following type:

val it = fn : (('a -> 'b list) * ('c -> 'd)) * (('e -> 'b list) * ('c -> 'f)) -> ('a * 'e -> 'b list) * ('c list -> 'd * 'f)

Looks the same, right? But no. I'd forgotten that CAML treats pairs differently (as you can drop the brackets). What I had meant to write was this:

let mypair args =
match args with
((e,p),(e',p')) -> ((function (x,y) -> (e x)@(e' y)), (function [x;y] -> (p x, p' y)))

[Spot the new pair of brackets!]. Interesting F# claims the type is:

val mypair : (('a -> 'b list) * ('c -> 'd)) * (('e -> 'b list) * ('c -> 'f)) -> ('a * 'e -> 'b list) * ('c list -> 'd * 'f)

Look carefully you'll see the different bracketting. Clearly I still have more SML to forget!

MSR/C#/Functional Programming

I gave a lecture yesterday at the University of Warwick as part of one of the Department of Computer Science's undergraduate courses.

I spoke about two things: Firstly, the way Microsoft Research operates within Microsoft. People are always surprised about how we operate - we're not told what to do by the product groups. What's interesting is to look at other research labs to see how they operate. There's a surprising amount of variation. I was very happy to point the students to Roy Levin's recent paper.

The second thing I spoke about was (surprise, surprise) C# 3.0. More specifically I wanted to emphasize the very strong influence of functional programming on the new features that appear in C# 3.0. [Particularly pertinent as it appears that Warwick was dropped functional programming from its degree course - which is a real shame.] I also wanted to show how formal techniques can and are used in commercial language design.

Overall it was great fun. I'm always impressed by the quality of students at Warwick.

Monday, 19 November 2007

Hip friend

Spot the famous theoretical computer scientist singing with Bloc Party earlier this year?!

Laziness in C#/LINQ

Perhaps this post should be called "The influence of Haskell".

One thing that people often don't realize is that when people (e.g. my buddy Erik Meijer) say that IEnumerable is a lazy list, they *really* mean it! Consider the following code in C# 3.0. It queries a database (in this case an array) by filtering out those elements that are not less than thirty. It then takes this resulting array and filters out those elements that are not more than twenty. The result is then printed out.


var MyDatabase = new int[] { 1, 25, 40, 5, 23 };

var query3 =
from x in MyDatabase
where LessThanThirty(x)
select x;

var query4 =
from x in query3
where MoreThanTwenty(x)
select x;

foreach (var r in query4) Console.WriteLine(r);

In fact, this is NOT the semantics. It's lazy lists a la Haskell, not strict lists a la ML. To see the difference, let me give you the code for pne of the filter tests (I'll make it side-effecting so you can see when it happens...)

static bool LessThanThirty(int x)
{
Console.WriteLine(x+"? Less than 30");
return x < 30;
}


Now try running the code. Not what you expected? That's because this is lazy programming!!

If you're a Haskell programmer, this is natural; although I suspect that programmers from more conventional languages might find it a little tricky.

POSTSCRIPT: Okay, a number of people have asked me to give the result of running the code. It's as follows (where I've added some formatting to help you see what's going on).

1? Less than 30
1? More Than 20

25? Less than 30
25? More Than 20
25 //OUTPUT

40? Less than 30

5? Less than 30
5? More Than 20

23? Less than 30
23? More Than 20
23 //OUTPUT

So you can see the laziness working here, in that we get alternating Less-than-30, more-than-20 calls. Cool!

Slovenka Leta 2007

Mateja is one of the fourteen nominees for Slovene Woman of the Year 2007. Unfortunately not much is online though... (There was also a 2 page spread in Delo - the national broadsheet - unfortunately, you need to subscribe to read the rest of the article:-()

I'm really very proud! We're looking forward to the awards ceremony in January (hopefully it doesn't clash with POPL!)

Monday, 5 November 2007

Live maps vs Google maps

I'm currently visiting the mothership in Seattle. Yesterday I had a spare day (I came early to help with jetlag - given that I'm blogging at 05:38 it clearly didn't work!). To help this poor UK driver with the routes between Kirkland and Seattle I went to Google Maps. Just out of interest I went to Live maps, which I haven't used in a little while.

I realize that I'm (a) employed by Microsoft, (b) basing my conclusions on a single experiment, and worse (c) going against the rule of Coolness, but here's the reality: LIVE MAPS IS SIMPLY MUCH BETTER THAN GOOGLE MAPS! The maps are clearer, the photos are a million times better and the new UI is awesome! Microsoft is ahead on this game (and how often can you say that?!)

If only MS stock was as good as Google's...

Friday, 2 November 2007

OOPSLA: Time off

I'm now back from OOPSLA and just about recovered. It was a really interesting conference. As always it was the people not the talks that were the highlight. (There were good talks though!) I'm still particularly excited by Second Life Scripting (thanks for the tutorial William and Cristina!). I was also impressed by my friend Erik Meijer's preaching to the masses about the joys of Haskell.

After OOPSLA was over I had some time before my flight back to the UK. I went to the Musee d'Art Contemporain. It has a smallish collection of Canadian modern art and currently three expositions by Karel Funk, Thomas Hirschhorn and Vik Muniz.

For me the highlight was the Brazilian artist Vik Muniz. He makes "temporary art" pieces using real-life objects and photographs them. (The "original" piece is typically destroyed leaving only the photograph.) There's a lot to admire in Muniz's work - both the clever dialogue about the meaning of art and also his incredible skill in creating the work. He has used chocolate sauce, tomato ketchup (a wonderful pair of Warhol-esque Marilyns), dust, toy soldiers and many more strange items. There was also an interesting documentary about the artist which I found really helped me appreciate his work. I hope he comes to the UK sometime soon. He has a website.

Sunday, 28 October 2007

OOPSLA: Student Research Competition

One of the most interesting things I did at OOPSLA was be one of the three judges for the ACM Student Research Competition. A while back we refereed 20 paper submissions, which we narrowed down to 7. These 7 had posters in the OOPSLA poster session. From these 7 we narrowed it down to 5 who gave the judges a 10 minute presentation with 5 minutes of questions. After that the judges had a very spirited debate to decide on the following:

  • 3rd place "Activating Refactorings Faster" by Emerson Murphy-Hill.
  • 2nd place "Flexible Ownership Domain Annotations for Expressing and Visualizing Design Intent" by Marwan Abi-Antoun.
  • 1st place "Code Genie: A Tool for Test-Driven Source Code Search" by Otavio Lemos, Sushil Bajracharya, and Joel Ossher.

Congratulations to all of these students. We had a very difficult job deciding the positions. The quality of all the posters and presentations was extremely high - I don't think any of us (the judges) expected quite such a wonderful show! This shows that some of the very best students are broadly in the OOPSLA field, which is a very healthy thing for OOPSLA.

Thanks go to Nadyne Mielke for organizing the competition.

Thursday, 25 October 2007

OOPSLA: Brian Foote "big balls of mud"

Lots of people have mentioned to me the Big Ball of Mud paper. It's a classic apparently.

One of the authors, Brian Foote, gave a keynote at OOPSLA. I'm afraid to say I found it deeply disappointing. The talk - which lasted ninety minutes - really had very little to say, other than repeat the BBoM thesis (this really only takes a few minutes to describe). Given that the BBoM paper is now ten years old now I was hoping to see what the speaker had learnt given these ten years: were things better or worse? What have we been doing right? What more needs to be done? Should we give up? Or is there some new research area waiting to emerge?

None of these questions were answered. Although the talk was mildly entertaining with creative use of powerpoint and stories, I didn't feel that it was appropriately technical enough to end an OOPSLA. Shame. Sorry, Brian.

OOPSLA: Ownership session

3 very interesting talks on ownership:
  1. Inferring aliasing and encapsulation properties for Java by Foster/Ma
  2. Multiple ownership by Cameron/Drossopoulou/Noble/Smith
  3. Ownership transfer in universe types by Mueller/Rudich

I especially enjoyed Nicholas Cameron's talk: he has his mojo (sic)! They use an interesting form of existential over ownership annotations (written using a wildcard syntax). I wonder if you could encode their stuff into sep logic where their o&? constraints would be encoded as EXISTS b.o&b formulae? At the very least it would provide some sort of semantics. Yet another thing to discuss with James Noble!

OOPSLA: Second Life/LSL

I must now be the coolest person in MSRC. I went to William Cook's tutorial on Linden Scripting Language (LSL) so I have now written some LSL scripts!!

Possibly more impressive - in terms of street cred - I did have breakfast and a lengthy chat with Babbage Linden. He's driving the Linden Labs effort to migrate to mono (.NET on Linux). Super cool stuff. Wow.

OOPSLA Panel: 40 years of languages

[Grrr...the hotel wireless is dying under the strain of several hundred oopsla attendees attending to read email. I wrote a lengthy piece about the panel, but after clicking the post button, my machine lost its connection and I lost the blog entry. Damn.]

On the panel were Guy Steele, James Gosling, Betrand Meyer, Anders Hejlsberg and Ole Lehrman Madsen. It was quite interesting. The panellists got five minutes to talk about the influence of Simula 67 and the future of PL. Highlights:

Steele: He quoted Alan Perlis quite amusingly. He also stated that there would be more functional programming in the future but you can't hide state everywhere. He was still worried about the 5% of state manipulating glue.

Gosling: He had an early job maintaining a Simula 67 compiler. He spoke about "drivers" for languages. For Java it was the network. He also mentioned in-memory databases [I've been talking about these recently - I'd like to work some more on these as I think they're going to become very important.]

Meyer: He promoted Eiffel (of course). He mentioned that people still used imperative languages because Hoare and Dijkstra had provided us such great reasoning tools. (ha!) He urged people to look at the concurrency model in Eiffel.

Hejlsberg: Anders spoke about the growing importance of functional programming in the context of multi-core. He mentioned the (wonderful) news of the productization of F# by Microsoft.

Madsen: Ole spoke about the importance of history - people should know more about what has been done in other languages.

Some further points arising from questions from the floor:

1. On functional programming:
Bertrand: FP is good but won't take over. We have to reconcile Angel and Beast. Hoare told us how to reason about messy imperative languages.
James: problem with FP is that it's too difficult. Humans are imperative.
Guy: More FP in future, but never 100%. Big problem is state - what about the remaining 5% code that shifts state around?

2. Can we change programmers through language?
MEYER: nice features of Eiffel: type system and pre/post/object invariants
OLM: teach higher level stuff. Not endless discussions about e.g. multiple inheritance. Should learn from other fields - no more "XXX extensions of Java"
GUY: What about PL features to boost programmer's self esteem? :-)
[Gosling: Isn't that what Perl's about?]

3. Is OO necessary but not sufficient? (Quote from Nygaard)
OLM: Teaching too technical - COOL. Simula closed world - need more, e.g. distributed programming, global ubiquituous programming. Time and location now matter.

4. Is programming hard?
GOSLING: Boeing spend 3kdollar per line because its so hard to reason about code. (And its assembly code)

5. Meta programming?
ANDERS: Meta programming is what makes Ruby nice, not lack of types.

6. Why dont we have co-routines a la Simula? (And build other concurrency primtives on top of it?) ANDERS: Never going to be a single model of concurrency.
GUY: Fundamental commitment to stacks is the enemy of concurrency. (They give an ordering)

Tuesday, 23 October 2007

oopsla 2007

I'm attending OOPSLA 2007, which is in Montreal, Canada. I have a paper in the "language specification" session of the research track. It' s a huge conference and there are a huge number of talks/tutorials/workshops to attend at any one time. I'll blog what I attend if possible...

Wednesday, 17 October 2007

F# productization

Finally one of the most exciting pieces of news is out. Today it was announced that Microsoft intends to productize F#! F# is a functional language originating from the ML family (actually it's a close relation to OCAML) that was designed to be .NET language. It was designed and implemented by my colleague Don Syme in MSRC. Many congratulations to Don who has worked incredibly hard to get F# to the stage where it can be transferred over to the product team.

Wednesday, 10 October 2007

OOF not OOO

I've finally solved one of the Microsoft mysteries. No, not that one! Inside Microsoft people abbreviate the phrase "Out of office" as "OOF". In my three and a half years here I've not found anyone who could explain it. Catching up with Nadyne's blog, I've now discovered what it means. Somehow I feel better for knowing - I should get out more often I guess!

SQL code injection joke

A nice cartoon highlighting one of the problems addressed by Cw/LINQ can be found here. [Thanks to Nick Benton for spotting this!]

Tuesday, 9 October 2007

Zune 2.0

It's a tough time to be considering to buy a media player it seems. Everyone's seen the new Apple devices. Somewhat drowned in the noise, Microsoft also upgraded the Zune. There's a nice video here. Still single-touch, not multi-touch, but a much improved UI.

Monday, 8 October 2007

Mateja in the news!

My wife, Mateja Jamnik, was in the news last week in Slovenia. She attended a congress for Slovene scientists who work abroad. She ended up being rushed into the TV studios and being interviewed live on the 10 o'clock news - Odmevi - which is a very big TV slot in Slovenia.

If your Slovene is up to it - you can view the interview on the web. Go to this page and click the archive for 4th October 2007. This will launch a pop-up with an emedded player. There's about 3 minutes of introduction before you get to Mateja! What a star!

C# overloading

I just discovered an interesting "slip" in our ooPSLA paper. (Actually it's not a slip in the fragment of the language we consider, but it's dishonest in the Parnas sense (see an earlier blog entry)). I'm grateful to Eric Lippert for pointing this out to me.

Consider the process of typing a method call: e.m(f1,f2).
  • First we synthesize a type for e, call it sigma.
  • Next we generate a set, call it CMG, of all the candidate methods, i.e. the methods called m in sigma and its supertypes.
  • Now we need to discover which one of these candidates are applicable: this amounts to checking that they have the same number of arguments as supplied (in this case 2), checking the modes (to handle ref parameters), checking that the arguments f1, f2 can be implicitly converted to the candidate argument types(*). [I'm ignoring generics here. If the method is generic and the call does not provide an explicit type argument list, then we need to use type inference to infer the type argument list]
  • Finally we take this set and determine if there is a best method signature. [This is the heart of overloading resolution.]
Or that's what I thought happens! It turns out the last step is not strictly speaking true!!! It should be:
  • Finally we take this set and the argument list and determine if there is a best method signature.

The problem arises because C# lets you define your own (cyclic) implicit conversions. Imagine we have two classes X and Y (that are not subtype related) but we define implicit conversions in both directions. Then imagine we have overloaded methods:

static void m(X x)
{
Console.WriteLine("Picked Program::m1");
}
static void m(Y y)
{
Console.WriteLine("Picked Program::m2");
}

and the code:

X x = null;
m(x);



C# picks the first "m" method because its the best match for the argument given that we know that argument of static type X. So overloading resolution needs to use this static type. As not every expression can synthesize a type, we have to pass the argument itself. If we had just considered the type signatures of the method m (i.e., X -> void and Y -> void) then neither would have been better and we would have rejected this call as ambiguous. Ha!

I'm currently extending our ooPSLA paper into a journal version. Part of this is formalizing the overloading process in C#. (It has been extended for C# 3.0 - it treats delegate types in/co-variantly.) Hence why I tripped over this.


(*) For some reason in the camera-ready copy this type check got missed out! Sorry - it was in the submitted version - I must have been too enthusiastic with my CTRL-ks when preparing the camera-ready copy :-(

Tuesday, 2 October 2007

POPL 2008

The paper with Matthew Parkinson on using separation logic to verify OO programs with inheritance got accepted for POPL 2008. Hurrah! We're currently working on an extended version that we should release in the next couple of months.

See you in San Francisco in January?

Friday, 28 September 2007

Abstraction, Lies and Videotape

There's an interesting letter posted to CACM by (the) David Parnas. He points out that abstraction is good and important but if you abstract too far then the results can not be trusted. He quotes Dijkstra's definition: "An abstraction is one thing that represents several real things equally well." As Parnas puts it, a model that fails this definition is a lie. Interesting.

I'm sure that I've fallen into this trap in various papers, but we have been very careful in our recent work on C#3.0 to formalize our fragment in a way that works for all the other language features, even though we don't give them in the paper. This was a real pain, but I'm happier with the result even though it looks clumsy in places!

Thursday, 27 September 2007

2^16-1

Wow! It turns out there's a display bug in Excel!

Fire up Excel 2007. Type the number 850 in cell A1, 77.1 in cell A2, and the formula =a1*a2 in cell A3. The answer is not 2^16-1 but rather 100,000 according to Excel!

If you read the Excel team blog you'll see that this is a display bug rather than a calculation bug, so not quite as bad as it seems but still...

Wednesday, 26 September 2007

New languages

I'm attending OOPSLA this year. I plan to learn about two new languages whilst there by attending the tutorials: (1) Linden Scripting Langauge, and (2) Ruby (on rails).

I've just come across this, so maybe the second tutorial isn't so important :-)

Tuesday, 25 September 2007

In my in-tray

Normally the in-tray is full of research papers, but occasionally I come across something on the blogosphere that I want to read carefully. (Call me old-school, but that entails printing it out and reading it at my desk!)

One such article is the latest posting from Alex Buckley on null types and Java. (Alex is in charge of the JLS at Sun.) Alex always has interesting things to say - so I'm looking forward to sitting down with this one!

Unified C# specification

[I forgot to blog about this earlier.]

My colleague Mads Torgersen has worked incredibly hard to unify the C# 1.1, 2.0 and 3.0 specifications into a single spec. This is an amazing achievement (you'll understand if you've ever read any of them!). I spent a lot of time puzzling over parts of the spec whilst we were writing our OOPSLA paper. A couple of my suggestions even made it into the spec!

Take a look
here.

Monday, 10 September 2007

SQL server installation woes

I spent/wasted much of today trying to install SQL Server 2005. I did a clean install of Vista a while ago (see earlier posts) and have been using Visual Studio 2008 Orcas Beta 1 quite happily (although that was a difficult install - don't get me started). Today I wanted to fiddle with the CLR integration in SQL Server 2005.

To cut a long story short, the installation continued to the end without any particular problems. Once finished I had a running MSSQLSERVER instance of the db engine, but no management studio, no server profiler, no tuning advisor, no nothing. I spent ages trying to figure out what had gone wrong.

After hours of reading msdn and blogs, restarting, I uninstalled and had another go. Then I figured out what was happening. In the installation process it does a check and offers a report. I spotted a "warning". Double-clicking gave the details: essentially as I had SQL Server Express installed (its installed as part of Visual Studio Orcas) the warning was that installation would fail!! Crickey - only a warning. What warrants an error? :-)

Tuesday, 4 September 2007

SQL injection

One of the big selling points of our Cw language was the elimination of SQL injection attacks. Finally people have noticed that LINQ offers similar functionality!

Monday, 3 September 2007

Gimme More

Something new to listen to when I'm not playing the New Young Pony Club album.

[Ug - these links don't stay up very long! Try this one.]

Additions to the (PPT) family

Today our research group expanded dramatically! We just gained two new postdoc researchers and another visitor:

What a great place to work! I'm really looking forward to these three being around.

Sunday, 2 September 2007

Farewell to Bob Harper

One of the great things we do in MSR is host academics on sabbatical. We've recently had the pleasure of Bob Harper's company. I've learnt a lot from Bob - primarily I now understand better the "judgemental" techniques that he and Frank Pfenning have been using over the past few years. This stuff is way cool!

On Friday we had a farewell dinner. It was quite an evening! Andy Gordon has posted some pictures on his blog.

Thursday, 22 March 2007

Vista colour scheme

Here's an interesting Vista tip from my colleague, Josh.

Have Vista and Office 2007? Would you like the Office apps to use the Vista Black colour scheme rather than the default blue? Don't bother looking in Outlook - I couldn't find anything here. Fire up powerpoint; click the windows button (top right); click on "powerpoint properties". On the first screen, there will be a drop down for powerpoint color schems: select "black" and click save. This will side-effect all other office apps! (Isn't aliasing a wonderful thing?!).

Anyone else have another way to do this?

Wednesday, 21 March 2007

Writing

I have been killing myself writing two conference submissions recently. By the end of such a process, I started thinking that my writing style was quite good.

Then at the weekend I chatted with my brother about writing. When pushed, both of us nominated Harold Pinter's Nobel Lecture as the best thing we have heard in the past few years. I took a look at it yesterday. You should too:

http://nobelprize.org/nobel_prizes/literature/laureates/2005/pinter-lecture-e.html

After re-reading it I realize that I can't write at all. If you ever thought "the pen is mightier than the sword" was something your mother told you to help you get over being bullied at school, you need to read this! Not only is it thrilling reading - from a technical point of view - it simply annihilates Bush and Blair with clinical precision.

Friday, 9 March 2007

Journals

We finally got a (tentative) publication date for our paper on dynamic update in ACM TOPLAS. (This is the journal version of our POPL 2005 paper.) We submitted in January 2006, it was accepted in October 2006, and will appear...in...July 2007.

How about that for rapid turnaround? (Not) You natural scientists don't know how lucky you are. No wonder people don't bother so much with journals in computer science...

Thursday, 8 March 2007

The Vista experience

I've just started upgrading my office desktop to Vista. The current preferred route in our office is a fresh install. So, once Vista is on your machine, you have to install all those apps you've collected over the past two years :-( This is a nice way to waste a day I've discovered.

Overall, Vista seems quite nice. Certainly the UI is fresher. I quite like the transparent windows. The aero 3d menus are cute, but I doubt I'll use them other than to show off my graphics card to colleagues! Better is the new ALT+TAB interface. But overall I think MS has done a nice job of tidying up the windows experience - it seems more coherent than, say, XP. [Whether it's better in this sense than MacOS X is another matter!]

The problem comes with installing non-MS software - in particular some open source software. I rely on emacs, miktex, auctex and (to a lesser extent) tortoiseSVN to do my work. Here's where the problems are. Vista imposes a new security model on applications, which many now do not adhere to. So, for the time being, the apps that I need are very clunky. I found problems with all of the above. The solution for emacs/miktex/auctex seems to be to install some older versions. For tortoiseSVN I now use this on an XP machine only. Hunting around the web, it seems that Vista-compliant versions should appear sometime later this year.

I wonder if less MS-friendly people than me will be quite so tolerant?! I understand the thinking, but requiring app writers to re-architect code is going to cheese off a lot of people.

Thursday, 1 March 2007

Welcome!

I've finally made it into the brave Web 2.0 world! Welcome. I hope to discuss my work in the world of programming, and anything else that I discover surfing when I should be working :-)