Why I won’t be upgrading to IE8

no-to-ieI am what is commonly termed an “early adopter”. I readily install beta versions of software of my machine and tend to pro-actively track new versions of the software I use, and obtain and install them as quickly as possible. Most of the time I’m happy with this, but very occasionally, my “new feature greed” comes back to bite me. IE8 is one such case.

When IE8 beta came out, I installed it, had a play around with it and then pretty much lost interest, as my main browser is Firefox. I uninstalled it as part of experimenting with removing it from Vista (its an update, so it’s not immediately apparent how to remove it) and forgot all about it. When RC1 came along recently, my interest was piqued once more and I installed that, but all was not well.

These days I’m an Eclipse user, who spends a fair bit of his time writing and debugging Flex. Flex Builder in Eclipse can be configured to use one’s preferred browser. However it is highly unreliable with Firefox, so IE has finally found a use on my machine: it is the browser that runs the debug-enabled flash player that I test my Flex code against. Whereas Firefox often fails to start, or properly end,  a debug session, IE7 just works. However IE8 was a wholly different experience.

After stopping and starting debug sessions a few times, I first noticed that my machine was slowing up, then the code that handles cookies started behaving oddly and would report that other instances of the application were already running, despite no other occurrences of IE appearing in the taskbar. A peek at the Task Manager revealed the problem: there were around 15 non-terminated IE processes running on my machine. Investigating further, I realised this was a consequence of Microsoft copying Chrome’s 1 tab = 1 process model. Even with tabbed browsing disabled, IE8 starts two processes: one for the window “frame”, and the other for the tab’s renderer. When the Flex debugger quits, it kills the frame process, but leaves the renderer process – with its instance of Flash player – still running.

This neatly highlights what I dislike about Chrome’s process model and why I’m saddened by the lind rush by other browser makers to jump on the many process browser model. I like my apps to adopt the one process/ many threads model, for I want the whole application to get its backside off my system when I kill it and multiple processes are near-guaranteed to spoil that simple desire.

Perhaps this is just an RC1 bug and IE8 will die gracefully when its fully released. However, I rarely use IE, IE7 meets my needs, and so I’m likely to follow my own instructions and block the upgrade to IE8. I do so with a heavy heart, for I fear I’m taking the first step down the road to becoming like those weird luddites who still use VS6 over 10 years after it was replaced with a newer version, or those even weirder folk who can’t cope with leaving the antiquated Windows 95-2000 look behind and run XP or Vista with that last-millennium look. I think I’ve made the right decision on this occasion though…

C# and Friend Assemblies Made Easy

friendassembly_small.pngIf you are familiar with C++, you’ll know about “friend classes” within that language. If you are not familiar with them, they are a neat way of exposing otherwise private methods to trusted classes. Class A has a bunch of private members, that are obviously hidden to other classes, but there is a problem with this model. Class B is a unit test class that tests class A. Because it is doing unit tests, it needs to delve deep inside class A to check what is going on. By making class B a friend of class A, the former is then granted access to the latter’s inner workings.

So what does this have to do with C#? Well C# partially fixed this with the “internal” keyword. Internal members of a class are visible to other classes within the same assembly, but are effectively private as far as classes outside the assembly are concerned. Internal members are very different from protected ones by the way. In the latter case, they are only visible to subclasses (whether in the same assembly or not). However, largely due to a limitation with Visual Studio, internal members used not to be the full answer to the needs of unit testing. The C# compiler supports compiling multiple projects into one assembly, but Visual Studio has a strict one to one project/ assembly mapping. So unit test classes used to have to reside within the same project as the product code (which wasn’t practical if the project’s assembly was a executable, rather than a dll.) The other alternative was to expose all the members that the unit test classes needed to access by making them public.

I talk in the past tense in the previous paragraph as this problem was fixed with the release of C# 2.0. This introduced the idea of Friend Assemblies. To explain, let’s go back to our class A and B. Class A resides in assembly A.dll. Class B resides in assembly B.dll. Normally class B would have no access to the internals of class A. Add the “InternalsVisibleTo” attribute to class A though, specifying B.dll as the trusted assembly and now class B can access those internals. Further, unlike with C++ and friend classes, private members in class A remain private; only internals are exposed via this method.

If both A.dll and B.dll are unsigned, the extra code is just:

which is a pretty neat solution.

Things get really messy though the moment signed assemblies are used. The reason is that one must put the public key (not the nice short token, the full-blown humongous key) in the attribute. So it becomes something like:

(I’ve wrapped the public key across many lines for clarity. In reality, it must be on one line)

The whole horrible nastiness of the matter doesn’t stop there though. To get that public key, one must find the sn.exe tool, plough through its dozens of obscure options, and then run the right one against the required assembly (or run a sequence of two even more obscure commands against the original key file). Then one can cut and paste the output of the command into the attribute in Visual Studio. This is what we in Britain politely term a “complete faff”.

Having banged my head against the wall performing this operation recently, I decided that a simply little utility was required to do all the work. So I wrote an app called FriendAssembly, which I’m sharing here.

Continue reading “C# and Friend Assemblies Made Easy”

Are systems badly done worse than no system at all?

backnetwork.gifWhen I registered for Microsoft’s MIX:UK event, I received an automatic invite to the Mix:UK backnetwork. All very fine and dandy I thought and so I filled out all of my details and joined. I didn’t find it overly useful, but it had potential.

Today I received an automatic invite to the Flash on the Beach backnetwork. Now that is handy, or so I thought. I followed the links, expecting to find my details already filled out. They weren’t. I had to create a new username and password, so perhaps they’d appear when I did that. Nope. Two backnetworks supplied by the same company – Madgex Limited – with two copies of my data and no way for me to share it between the two.

Perhaps I’m just naive, after all these “social networks” are provided by the conference organisers to promote their conference and they are therefore unlikely to be interested in helping to promote others. But that’s not the point in my view. I want to share my profile across the two and I don’t much care what the conference organisers think. So for me, what could have been a great conference networking tool is ruined by poor implementation.

However I’m an eternal optimist. I’m a great believer in complaining when things are wrong, as they will never be put right otherwise. So perhaps Madgex will fix their product for me 😉

Mix UK 07 Day Two

Read about Day One here

Day two of the Mix event proved a bit more of a roller-coaster than yesterday. At times the presentations were great; one though was so truly awful, I struggled to stay awake. Then we got to the “Sneak Peaks” hour at the end and the conference ended on a really good high.

ironpythonjpg.gifironruby100×100.jpgThere were sessions on IronRuby and IronPython. Both were informative (though the IronRuby talk was really about Ruby rather than IronRuby). I find the whole DLR/ non-Microsoft language thrust here to be indicative of a sea-change in attitude by Microsoft. As Scott Guthrie put it yesterday, Linux is now the “arch friend”. Talking of Scott, Michael Foord (the chap who did the IronPython talk) , seemed to confirm what I had previously heard: Managed JScript is based on ECMAScript 3 (ie the nasty old-fashioned class-free 1999 addition of JavaScript), not on any variation on ECMAScript 4, JavaScript 2 nor ActionScript.

Todd Landstad, another American Microsoft person shipped over for the Mix event did an OK presentation entitled “Designing Interactions for Mobile Computing”. He had an impressive collection of UMPCs for us to all gawk at and he demonstrated both Windows Sideshow (a definite “solution looking for a problem” in my view) and some quite clever stuff of using various gestures and handwriting recognition to navigate around Live Earth using just the pen on a tablet PC.

The other presentation during day two was on the “design track” (rather than the “developer track that I tended to stick to). It had the glorious title of “Silverlight, WPF, Expression design projects – where do we get started?”. It didn’t just fail to live up to a great title though; it was crap; I can think of no better way of describing it. Presented by Paul Dawson and Robby Ingebretsen, it basically consisted of Paul doing a “Website Marketing for four year olds” talk then handing over to Robby who waffled on about XAML ownership within a design/ development team and the need for a “director” role to fulfil this ownership. It was so bad, I made use of the WiFi connection and caught up on work emails whilst they droned on. If this was an example of the quality of the “design track”, then I’m glad I stayed clear the rest of the time.

Then the final hour arrived: the Sneak Peaks. After the less-than-exciting keynote, my expectations were low for this. I was pleasantly surprised therefore at the quality of the presentations. There was some guff, such as a Halo 3 video (Halo 3 looks as boring as every other first person shooter) and a demo of seadragon (which I’d seen before as the full-blown app presented at this year’s TED talks rather than this less impressive Silverlight version). However there were two things that caught my attention. The first was a very brief sneak preview of Impression:Web 2 that revealed it is going to support PHP. The other was a “computer science problem” presented by Simon Peyton Jones. He works for CaricatureMicrosoft Research Ltd in Cambridge and he is a living version of the eccentric professor stereotype. He did a talk on transaction memory and absolutely stole the show (which is no mean feat considering half the audience were “arty” designers!)

On a final note, I took the risk yesterday of sitting down in front of a very clever lady, Luisa Calvo, who was drawing caricatures at the evening social event. The results can be seen on the right. I don’t see the likeness myself, but it was a fun end to the day.

Mix UK 07 Day One

I went along to the UK Mix with a degree of trepidation. There I’d be as a Mix newbie amongst seriously devout Microsoft devotees. Dare I mention the F word (Flash) or the L word? Would I be spotted as a less-then-100% committed-to-Microsoft person? I think sometimes I let my imagination get a little carried away. As far as I could gather, this was the first ever UK Mix event, so everyone was a newbie, and apparently Microsoft are now really into talking (rationally) about Flash and Linux.

So on to the event itself. My first impressions weren’t that good. The initial keynote speeches were dull and contained nothing particularly new. I suspect this is an affect of blogs though: Silverlight 1.0 was released last week, so announcing it at the Mix seemed like repeating old news.

A couple of the presentations in the keynote bucked the trend and were interesting. There was a “scrum wall”application that dotnet Solutions had developed using Silverlight. It was good to see another company using scrum, as I’ve become a big fan recently. The other impressive demo was by Sage and was a demo of a tax return. Yes, you read that right: a tax return. Windows offers the option to print a PDF to a file of XPS format. It turns out that XPS is a subset of XAML. Whilst not identical to Silverlight’s subset of XAML, its pretty close. So a PDF form can be readily turned into a web app without having to redraw a complex form. Very nice.

One of my aims at this event was to get answers to two questions I find important:

  1. When will Silverlight appear for WinCE?
  2. Why isn’t Microsoft better supporting JScript.NET for those trying to migrate from ActionScript to Silverlight.

A gent by the name of Scott Guthrie (I gather he is a bit of a Microsoft bigwig on account of having managed the teams that wrote/ are writing .NET and Silverlight!) put in appearances throughout the day. I was able to pose my questions to him and thus got answers from the horse’s mouth as it were. It appears that WinCE support should be available by the time Silverlight 1.1 is released. Silverlight 1.1 is due for release sometime next year (so it could still be a year or so before WinCE support appears). The answer to the other question was more revealing. The new Managed JScript ought to be fairly close to ActionScript in order to support the OO features of .NET. This doesn’t sound right to me, but time will tell. More interestingly though, Scott predicted that someone (which won’t be Microsoft, they’d prefer others did it) will likely write a ActionScript DLR compiler to allow ActionScript to be used directly(ish) within Silverlight. I hope he’s right on this.

So all in all a great first day at this event. I’ll finish with a photo (taken via a N800 webcam, so its poor quality) of Scott talking about Slverlight and .NET. More tomorrow.

Scott Gutherie

Finally, you can read about day two of the event here