Tag Archives: Microsoft

Replace the Replace

I grabbed this screenshot during an online conversation about some of the more bizarre coding people have seen that came about as a result of the ongoing nasty surprises Phil Winstanley (@plip) keeps turning up in his current work.

Replace the ReplaceThis picture however shows some code that used to be in one of our systems, but was swiftly coded out when we found it. It was written by a contractor who amongst other things claimed to have worked with Microsoft writing parts of the .Net Framework.

Looking at this, if you’re a .Net Framework user you’d be forgiven for thinking that he didn’t have anything to do with the string classes, however one of his other regular complaints was how inefficient parts of the .Net Framework were, hence why he needed to spend time rewriting stuff that was already there! We could find no evidence to indicate that this function was any faster than the built in string.Replace, and since having this was a confusion and maintenance overhead it was removed.

Aside from the function being unnecessary there are a couple of other things I wouldn’t do. First up is the use of “” rather than string.Empty – Brad Abrams explains why on this short blog post. Secondly the whole routine uses systems Hungarian notation which is explicitly discouraged by the Microsoft naming conventions – ironic as it was their programmers that created systems Hungarian notation in the first place. Joel Spolsky (@spolsky) has an excellent blog post here that amongst other things discusses Hungarian notation. The third thing, which is more a matter of my personal taste is that there is a single line if statement which I would usually surround with {}, partly to make it clear, and also to help with maintenance – I’ve come across one or two difficult to spot bugs caused by missing braces, so I tend to think it’s better to use them all the time.

Late to the Party – Windows Phone 7 Series

Yesterday afternoon the internet was buzzing with details of the launch of Microsoft Windows Phone 7 Series in Barcelona. Only it wasn’t really a launch, it was more a demonstration of a preview version of the platform. It’s predecessor was only launched last autumn, and this pretty well complete rewrite of the Microsoft mobile phone platform isn’t going to be available to buy until around the same time this year.

Whilst it certainly seems to have innovative features – a user interface that does things rather differently from the current favoured multiple pages of icon design that is almost ubiquitous, along with an XBox Live tie up to link your mobile and console gaming – it does seem a pretty brave move to show your rivals what you’ve got planned months and months before anything is going to be released. Even when you take into account that Microsoft are often much more open about showing preview releases of upcoming products than Apple for example, it still seems very early to be showing.

However, when you think about it, if Microsoft wants any part of the rapidly growing mobile applications market, it had to do something.

Microsoft, just like Nokia, Sony/Ericsson and all the rest were caught massively on the hop three years ago by the launch of the iPhone. Smart phones were very much of a niche market, and most regular consumers used a phone to make calls. It was possible to add applications onto smart phones, but again it wasn’t something that many people did.

Roll forward three years and the iPhone has really gone mainstream, it still surprises me how many people have them, and who they are. Many of them, even relatively non-technical are comfortable with the idea of adding applications, reading e-mail, browsing the web and playing games from a phone handset. On top of this Google has moved in on the market making waves with it’s Android operating system. Established players like Nokia have found their market share falling after years of failing to ignite the smart phone market.

Then we get to Microsoft.

They had a niche in corporate markets, and certainly I’d come across techies from time to time using (and more often than not cursing) their Windows Mobile handsets. The ability to program applications in the same languages as desktop applications certainly helped adoption. However they largely dropped the ball. Whilst they have carried on releasing updated versions of their platform they’ve largely been left behind, giving the impression – intentionally or not – that they weren’t interested, that they were happy to relinquish their market share to Apple and Google. In the corporate space Blackberry has grown, certainly in our company those users who are issued with a smart phone are issued with a Blackberry, and many of the executives ask for one by name. Any mobile applications would have to be developed for Blackberry, not Windows Mobile now, and Blackberry provide the tools to do that.

As I’ve said, the iPhone seems to have really gone mainstream, introducing a growing range of people to a smart phone, and the techie space seems to be being filled by Google Android. The iPhone is selling by the million, and producing billions of application downloads.

What Microsoft were showing looks interesting, and if they can sort out the reliability and stability problems that established wisdom say plagued previous versions it would be a good platform, but it would be a good platform if the phones were on the market now. Between now and release Apple, Google and the rest will certainly be releasing updated and new versions of their phones and software. The Microsoft gamble is that having seen the show yesterday, people will be willing to wait, and that come the autumn they will be willing to put aside the previous reputation for being buggy, put down their iPhones, Blackberry and Android phones, write off the money they’ve spent on apps for those platforms – or in the corporate environment infrastructure, and switch over to a Microsoft phone. I’m sure there will be a good few techies who will do so, but the average consumer or the corporate user? It remains to be seen.

DDD8 – Apples, Boots and @blowdart

Major embarass @blowdart session!  #DDD8Today was the eighth annual(ish) gathering of four hundred of the Microsoft Development community for a day of free technical training. Once again it was spectacularly over subscribed – sold out faster than Glastonbury (all the places went within fifteen minutes) and with no Microsoft speakers had the usual mix of sessions, some of which perhaps you wouldn’t expect to see at Microsoft.

The day started off cold – although there was no snow it was definitely a case of scraping ice off the car, and if you were in any doubt, one look at Rachel Hawley’s footwear could tell you! Having said that, as has become traditional at these events, bacon butties to warm you up awaited those who got there early.

First off a couple of observations. For a Microsoft Developer Day, it was a very good advert for Apple! Of the five talks I attended, two were obviously running off Mac’s. One was about iPhone development, so using a Mac was a given, although the presentation was also given using Keynote (and all the more slick for it) and rather than messing around with font sizes as all the PC based presenters have to do Chris Hardy used the built-in OS X zoom gestures to quickly focus in on what he was showing. The other Mac based presentation given by Ian Cooper wasn’t anything related to Mac development at all, but was presented in MacOS X, using the Mac version of Powerpoint, with a windows development environment running in VMWare. It’s not so long ago that developers would buy a Mac, largely ditch MacOS X and stick Windows on it – it does seem that even with the advent of Windows 7 that isn’t always the case now… The other massive advert for Apple was not surprisingly the vast numbers of iPhones in evidence. I certainly think it would have been worth somebody doing the same as Scoble did at Le Web to get a ball park figure of how many there were. There were a good few Google Android phones around, but few if any Microsoft based phones in evidence. This was also reflected in the sessions – no talks on Windows Mobile development, but there was a talk on using MonoTouch to develop iPhone applications!

As is normal for these days, what I thought I would attend, and what I actually attended were slightly different. I initially thought I’d just take up residence in Chicago 1 for the day, but in the end I fancied a change of pace.

First up I attended a talk by Ian Cooper on Real World MVC Architectures. This in part was because I’ve just done my first ASP.Net MVC project, and I was half expecting to find I’d done it all wrong, as to a large extent I’ve put it together as felt right rather than following any explicit paradigm. To my relief it seems all the talk of proper architecture seems to be sinking in, and the way I’ve constructed it is pretty much as was suggested, even to the point that I’ve used particular techniques without having read about them as yet in my MVC book in that I understood why they were being used but didn’t recognise the idea by name! I suspect the session might have been pitched a bit too much towards the beginner end of things for experienced MVC programmers, but for me it was certainly a good reinforcement of the techniques.

Next I slipped next door for a change of gear, and a non-technical talk by Liam Westley who was talking about how to be a small software development outfit and not go bust. To be honest, the principles Liam outlined can apply equally well to large software houses, a number of which I’ve come across who don’t get this stuff right, and even to people in a corporate environment like me as getting these sorts of things wrong will at the very least have your internal customers looking elsewhere for their software, or at the worst put you out of a job. Liam gave us a set of broad principles that any software developer should be doing as a matter of course – things like delivering properly tested software, applying proper logging (even in a corporate environment fixing a problem before the users have got round to reporting it scores serious brownie points), and understanding your users, all go to making people happy to give you their software work, and not go elsewhere.

For session number three it was a first for me, in that it was the first time that I have heard Jon Skeet speak. His name will be familiar to anyone who frequents Stack Overflow – and as his reputation is testament to he sometimes seems to answer C# questions within seconds of them being asked. What is slightly more surprising is that his day job is at Google as a Java developer. Even more surprising he fits all of that in with being a Methodist Local Preacher too – but I suspect that stands him in good stead for being able to deliver material well, as from the experience today his reputation is well deserved. The latest version of C# brings in some interesting, but quite complex new ideas, and he did manage to put them over in a way that even with the early start on a Saturday I pretty well followed them. Having said that whilst I liked the presentation, and many of the new features, I was less than impressed by the return of the ubiquitous VB variant data type, in the guise of the dynamic type. Whilst I am well aware that the way the variant and the dynamic work are rather different, it’s much more about how it will end up being used, or more likely abused. I’m with Jon Skeet on this in that I much prefer a situation where the types can be validated at compile time. Whilst there are legitimate reasons for adding dynamic, and as an exercise in language design the implementation is very impressive, as with the variant I am quite sure it will end up being thoroughly misused, and will lead to many a difficult to nail down bug.

Next up was lunch, and was the traditional scramble for a lunch bag. Unfortunately it seems that the entire occupants of the Chicago 1 side went the same way and got all the non veggie and non seafood sandwiches (I have to watch having too much of certain types of seafood with my gout) and as always it was a bit of a lucky dip as to what else you got, so I ended up with a sandwich, crisps and an apple that I wanted, and a can of diet coke and a snickers bar that I didn’t want. I know they’ve tried various things over the years, but I still think there has to be a better way than this, as it was pretty obvious looking around that not everybody wanted what was in their lunch and there was a lot going to waste.

The lunch time Grok Talks had relocated this year, and were in the atrium in building four. This certainly gave a bit more space, but did seem to make the security guards mighty jumpy – I got a stern “I’ve just seen you behaving strangely” from one for taking this picture – I just liked the look of the clear blue against the white of the building structure and was going to make some comment about the weather! The Grok Talks were marred rather by problems with the technology. For a start the speakers were badly positioned in relation to where the presenters were standing leading to endless feedback problems. The talks also took an absolute age to get started, and when they did people seemed to overrun, which as a result led to people who were further down the running order being disappointed. There were a couple of interesting talks though, and it was especially interesting watching Gary Short intensely watching somebody else demonstrate Code Rush! Looking at the response hopefully there will be a few more converts from Resharper, a jump I made many years ago!

After lunch was one of my personal interest talks. As an iPhone owner and software engineer I’ve always quite fancied giving an bit of iPhone development a go. The problem is that as well as learning a new platform and new environment, developing for the iPhone requires learning a new language, Objective-C. However Chris Hardy was demonstrating a way that I could leverage my existing C# skills using the Mono environment and an add on to it called MonoTouch. Whilst developers still need to be able to read Objective-C to understand what is going on, and still need to learn their way around the Apple API’s, it allows them to develop entirely in familiar C#, and even brings advantages in terms of some of the extra type safety that C# brings. I have to say I was pretty impressed at the environment and what it can do. I was less impressed by the price – $399 for a personal license, which only covers you for a year of updates, with even more for a corporate license – far too much for your average hobbyist programmer to even consider. I can’t help thinking that they are missing a trick here, and providing a low cost or free license for developers in return for a share of the revenues, maybe using some sort of phone home code to keep track would certainly broaden the base of programmers using it.

My last session of the day, to be honest I would have gone to even if Barry was just reading the phone book, as this was potentially his last appearance at a Developer Day before he loses the essential qualification for being allowed to speak of not working for Microsoft, as in a scant few days he will be starting a new job working for Microsoft at one of their offices in Redmond. As always there was the classic banter with people he knew in the audience, in particular Jon Skeet who was attempting to pose increasingly difficult questions it seemed. Barry also started off by hijacking the session next door as Ben Hall, the speaker had a birthday and was foolish enough to tell somebody! What I was also expecting, and got in spades were interruptions marking his departure from the UK development scene. His book Beginning ASP.NET Security featured in several. In the first Liam Westley gave a touching and heartfelt tribute, and said how much he had been looking forward to the arrival of the book – as it was just the right size to prop up his wobbly table. In another they spoofed the winter cold adverts, suggesting that the book was good fuel to keep the elderly warm. The session finished off with a clip from his appearance many years ago on The Crystal Maze, and several of the organising team appearing in T-shirts especially prepared for the occasion. All in all it was a memorable way to finish off the day, and hopefully a memorable occasion for Barry as he heads across the Atlantic. The one question that remains is whether all the spelling mistakes in the presentation were down to Barry, or whether somebody did get at his presentation before he went on…

All in all it was an excellent day, and although I know there were a couple of sessions that had problems, the ones I attended were all excellent, and well worth the spare time given up. It was great to catch up with friends from the community, previous developer days and previous jobs. Whilst it does appear that the day is very much a victim of it’s own success (even with local developer days around the country people still travel from far and wide to attend this one in addition to their local days) hopefully a way can be found to allow it to keep running in future years, and all credit to the organising team, and the staff at Microsoft for keeping the whole day running smoothly.

Apple Hit Back

Last month, Microsoft launched a campaign called “I’m a PC” directly targeting the well known Apple “I’m a Mac” campaign, with a number of big name celebrities endorsing the PC.

Now we get to see the first salvo in the response from Apple, not a new campaign, not even an attempt to out celeb the competition, but a very funny addition to the existing set…

I’m a PC

Microsoft are in a strange position. Despite still producing the operating system that holds the dominant position in the market, still producing the office platform that holds the dominant position in the market, and still producing the dominant web browser, they are seen as being under threat. The reason? Their share of the market held by their products is not as high as it used to be, as the competition is making gains. More than that being the dominant platform they are the prime target for a variety of viruses and malware, and if they aren’t being criticised for the security issues in their software, it is their business practices that got them to the dominant position in the first place.

Being pragmatic you could argue that with the position they held about the only way their share could go is down, putting aside the interventions of the EU and the US government, even in a market that they dominate quite as much, competing companies can still come out with innovative products and change the balance. For example Google came out of nowhere and Microsoft were left scrabbling to compete. However you could also argue that Microsoft themselves have caused some of their problems. Vista was very poorly recieved by many people, both in terms of performance where it was visibly slower than XP, and from simple usability where the security features were downright obstructive. So many professionals ended up sticking with or rolling back to XP. I can also show you a number of end users who are continually frustrated with their Vista machines who wished they could have XP instead. The latest Office wasn’t quite so bad but the ribbon bar didn’t go down well, nor did the new file format – for example one member of the church regularly has to send round documents twice because he is using Office 2007 and his documents are incompatible with the older versions in use by other people.

Probably the most high profile perceived competition to their core product is the ever resurgent Apple. While it is certainly not making much of an impact in the corporate world, Apple is certainly making inroads into the home PC market. Whether it is thanks to their advertising, the much vaunted halo effect from the iPod, the distinctive design of the products, or a combination of all three, Apple computers are selling in larger numbers than they ever have.

Looking at the Apple advertising campaigns that directly targeted the PC market, first off we had the switcher campaign. This consisted of a series of real, sometimes celebrity users talking about their experiences and why they switched to the Mac. The Microsoft response was frankly an embarrassment, with them being caught faking a Mac to PC switcher.

Since then we’ve had the Get a Mac campaign. All the adverts follow the same general structure, opening with a relaxed looking casually dressed man introducing himself as a Mac, and a more straight laced man in a suit introducing himself as a PC. The advert then compares some aspect of the PC with the Mac, including crashing PC’s, changes in Vista, and numerous other perceived issues with the PC platform compared to the Mac.

Interestingly, Microsoft haven’t repeated the direct attack on the adverts as they did with the old switcher campaigns. We’ve had a bit of a mix, including most recently the criticised Mojave Experiment. Even with their latest campaign, it didn’t seem they were going to do that, as they started off with two adverts featuring Bill Gates and Jerry Seinfeld that were frankly bizarre, before moving on to phase two.

Phase two for the first time seems to directly attack the Get a Mac campaign, opening with someone who has obviously been cast to look just like the PC in the original adverts (although certain people seem to think he looks a lot worse) and then follow that up with a large variety of other people, including celebrities again, who also say they are PC’s.

Interesting things to note are that there are Microsoft employees in there, whose e-mail addresses are posted on the screen during the advert, but also note that Vista isn’t mentioned at all, and also that aside from addressing the stereotype in the Apple advert, it doesn’t address anything else in those adverts – the message of the advert is basically that lots of different people use a PC.

It has to be said, that after the fallout from the Mojave Experiment, and the bemused responses to the Jerry Seinfeld adverts, the response to this advert has been pretty good, and I’m pretty sure that given that the Get a Mac campaign has been going for two years it will bring a new campaign from Apple in response. But then is the new Microsoft campaign saying anything other than lots of people use PC’s?

Update: A little post-script to this story – a revelation that has caused much merriment amongst the Mac faithful – the advert may show lots of people who use PC’s, but the people who made the advert aren’t one of them, as the advert was put together on a Mac.