Category Archives: .net

Fragmentation and the RIA wars: Flash is the least bad solution

The latest salvo in the Adobe Flash wars comes from the Free Software Foundation, in an open letter to Google:

Just think what you can achieve by releasing the VP8 codec under an irrevocable royalty-free license and pushing it out to users on YouTube? You can end the web’s dependence on patent-encumbered video formats and proprietary software (Flash) … Apple has had the mettle to ditch Flash on the iPhone and the iPad – albeit for suspect reasons and using abhorrent methods (DRM) – and this has pushed web developers to make Flash-free alternatives of their pages. You could do the same with YouTube, for better reasons, and it would be a death-blow to Flash’s dominance in web video.

Fair point; but one thing the FSF misses is that Apple’s stance has not only “pushed web developers to make Flash-free alternatives of their pages”. It has also pushed developers into making Apple-specific apps as an alternative to web pages – which to my mind is unfortunate.

The problem goes beyond web pages. If you have an application that goes beyond HTML and JavaScript, maybe for offline use or to integrate with other local applications or hardware, there is no cross-platform solution for the iPhone, iTouch or forthcoming iPad.

While I understand that non-proprietary platforms are preferable to proprietary platforms, it seems to me that a free cross-platform runtime is less evil than a vendor-controlled platform where I have to seek approval and share income with the vendor just to get my app installed.

More broadly, it is obvious that the days of Windows on the desktop, Web for everything else are over. We are seeing a proliferation of devices, each with their own SDK: alongside Apple there is Palm WebOS, Nokia/Intel Meego, Google Android, and when Windows Phone 7 comes along, Microsoft Silverlight.

The question: if you have an application and want to reach all these platforms, what do you do? A web app if possible; but otherwise?

It is the new fragmentation; and frankly, Adobe Flash is the closest thing we have to a solution, particularly with the native compilation option for iPhone that is coming in Creative Suite 5.

I don’t like the idea of a single company owning the runtime that unifies all these platforms. That’s not healthy. Still, at least Adobe is currently independent of the obvious industry giants: Google, Apple, Microsoft, IBM and so on.

Dealing a death-blow to Flash is all very well, but the end result could be something worse.

Mono Tools for Visual Studio: code on Windows, run on Linux

I have just com across Mono Tools, a Novell add-in for Visual Studio that lets you test Mono compatibility. It adds a Mono menu which has options to run locally or remotely in Mono, analyze for compatibility issues, and create deployment packages. No sign of Mac support, which is a missed opportunity, but understandable given that Novell owns SUSE Linux.

For those few still unfamiliar with Mono, it is an open source implementation of Microsoft’s .NET Framework, enabling your .NET applications to run on other platforms. One compelling use is to have your ASP.NET web applications run on the free Apache web server, rather than Microsoft’s IIS.

image

Mono Tools works with both Windows Forms and web projects.

image

This is just the sort of thing Mono needs to move it further into the mainstream, though another less welcome sign of business acceptance is that this is a commercial product, currently costing $99.00 for an individual or $249.00 per seat in an organization. There is also an Ultimate edition at $2,499, which comes with a commercial non-LGPL license to redistribute Mono.

The Mono Tools team is now looking for testers for its 1.1 edition, which supports Visual Studio 2010.

Windows Phone 7 development rumours abound

News about the Windows Phone 7 development platform is leaking out, ahead of its official unveiling at the Mix conference next month. Rumour has it that both Silverlight and the XNA gaming framework will be supported, for creating consumer-focused applications, together with limited access to native APIs subject to Microsoft’s specific approval.

The controversial aspect, if these ideas prove to be accurate, is lack of compatibility with existing applications. It seems possible that C++ applications written for previous versions of Windows Mobile will not run, while those written for the Compact Framework will need porting to the Silverlight UI.

While there is little love for Windows Mobile, it is used for business applications where it integrates well with the rest of Microsoft’s platform. Since Windows Phone 7 seems to target the consumer, Microsoft may argue that this does not matter, since businesses can continue to use Windows Mobile. You would imagine, though, that enthusiasm for continuing with Windows Mobile will be limited given the superior usability of Windows Phone 7. Maybe a professional edition to follow in 2011?

One thing we know for sure is that Adobe Flash is not supported in the first release, though Microsoft says it is not opposed to it appearing on the platform in future. That in itself is interesting, since Adobe is hardly likely or able to rewrite Flash in Silverlight or XNA. Will certain important developers have privileged access to a wider range of native APIs? Despite rumours, there is still plenty to speculate about.

Visual Studio 2010 testers unhappy with help

Visual Studio 2010 comes with a brand new help system, based on a local help server rather than a database plus viewer as in the past. There is also an option to use Internet-based help for the most up to date content.

Sounds good, but developers are not happy. The problem: the new help appears to have no index of contents. You are meant to navigate by search, then perhaps navigate forward and back using the table of contents tree that appears on the left.

image

In the old one, you could use the index to find keywords quickly:

image

It turns out that many users prefer the old approach:

This is terrible. Productivity will go to zero without an index. Online help is junk, even on a fast connection — it can never be as fast as my local PC and when I am programming, I need instant answers.

says one commenter.

Microsoft says:

We realize the importance of delivering a keyword index, but we were unable to deliver it in our first release. In this V1.0 release of help system, we first implemented an improved search capability in order to deliver a more familiar, consistent online and offline experience. We then implemented a keyword index feature based on our search catalog. Unfortunately, the results did not meet our quality bar and we determined that this feature would require more work than the Beta 2 timeline allowed. We are looking at implementing it for at future release.

The odd thing is, there is a third-party viewer called H3Viewer which was apparently put together in a short time using Delphi and the new APIs. It turns out that Visual Studio’s Help is actually an early example of a new Windows Help System called Help 3, and is designed with a comprehensive API for developers. If you set the default help viewer in Visual Studio 2010 to H3Viewer, it works more like the old one, complete with index:

image

I can’t actually recommend H3Viewer in the current  beta. It takes ages to read 440,000 index entries every time you start it up and view the index pane – a message notes that “a late fix in the RC release has slowed down the reading of index items dramatically”. In addition, it does not cope well if you set your help preference to online. Still, H3Viewer will likely improve.

Speaking personally, I don’t mind the idea of search-based help, provided that the search works really well. In practice, it is often easier to Google for what you want to know, bypassing the official help completely, though that may mean getting to the same place by another route. Nevertheless, a reliable online reference is important and it seems that a lot of developers do in fact use the local index.

XML literals come to PHP via Facebook: XHP

Facebook engineer Marcel Laverdet has written up the XHP project on which he has been working at Facebook, and which he says is “quickly becoming a cornerstone of front-end PHP development at Facebook”. XHP enables XML fragments to be valid PHP expressions. In addition, most HTML elements have been pre-defined as variables. The project is hosted on github and you can read a quick summary here. PHP inventor Rasmus Lerdorf has had a quick look and says:

The main interest, at least to me, is that because PHP now understands the XML it is outputting, filtering can be done in a context-sensitive manner. The input filtering built into PHP can not know which context a string is going to be used in. If you use a string inside an on-handler or a style attribute, for example, you need radically different filtering from it being used as regular XML PCDATA in the html body. Some will say this form is more readable as well, but that isn’t something that concerns me very much.

Lerdorf goes on to express concern about performance, but says that in combination with APC caching it is much better, and with HipHop compilation to native code becomes “a viable approach”.

One of the benefits here is that getting XML markup out of quoted strings means that it can be checked as it is parsed, so that errors are caught earlier. There are parallels with Microsoft’s work on Linq (Language Integrated Query) which pulls database queries into the language, and XML literals in Visual Basic 9.0. Ideally, developers should not have to hide code such as SQL, XML or Javascript within strings that are not checked for valid syntax until runtime.

This might also re-ignite the debate about whether XML literals should be in C#, now also gaining more attention because of the popularity of ASP.NET MVC.

Visual Studio 2010 RC arrives with go-live license

Microsoft has made the Release Candidate of Visual Studio 2010 available for download to MSDN subscribers. From tomorrow (10th February) the same release will be available to everyone. There is a go-live license so you can use this in production if you wish, though if the full release comes in April as planned, it hardly seems worth it in most scenarios.

What’s new since the beta? Jason Zander says mainly performance. Note that the Chief Architect of Visual Studio is Rico Mariani, formerly Microsoft’s .NET performance guru, which is encouraging in this respect.

The blow-by-blow account of issues with the RC is here.

Whatever your views on the direction and future of Microsoft’s platform, there’s no doubting the huge scope of this release, though in my view the company has not communicated this particularly well, saying too much about things like SharePoint development, top of its list of walkthroughs but still an ugly business, and not enough about features such as IntelliTrace debugging, or the new ability to float windows out of the IDE and onto a second display, which will have a more immediate impact on developers. Note that the Visual Studio IDE has been re-built using WPF (Windows Presentation Foundation), and that it comes with a the first completely new version of the .NET Framework since 2005.

Silverlight 4.0 is another area of interest, though I understand that it will not be complete in time for this release. Visual Studio 2010 will have Silverlight 3.0 out of the box, with the ability to install the 4.0 preview release and eventually the final release as an add-on. I’ve also heard that Silverlight 4.0 is not yet supported at all in the RC, so be cautious if this is your area of work – you may need to stick with the last beta for the moment.

New is not always better, of course. I’m interested in hearing from developers working with Visual Studio 2010 – whether performance and stability issues have been overcome, and what you think of it overall.

What’s new in Visual Studio 2010 – more than you may realise

I’m beginning to think Microsoft has under-sold Visual Studio 2010. Of course it is a huge product, as I observed back in October, especially since it includes a major new release of the .NET Framework as well as updated tools, but I thought I had discovered most of the significant new features. Still, when I sat down recently to write up an extended review, I found a lot that I had missed.

One of my reflections on this is that Microsoft has done of poor job of communicating what is new. I attended the Professional Developer’s Conference in 2008 and 2009. The developer-focused keynote on the second day last November should have hyped the best of what is new; but instead we got Steven Sinofsky on Windows 7 quality control – hardly the most exciting of topics – a sneak preview of IE 9, an unconvincing tour of Sharepoint and Office 2010, and Scott Guthrie on Silverlight 4. Guthrie was fantastic, leading us blow by blow through Silverlight’s new capabilities, but much else was neglected.

It doesn’t help that Microsoft’s home page for Visual Studio 2010 has meaningless headlines. “Set your ideas free”, “Simplicity through integration”, “Quality tools help ensure quality results.” Pure fluff, which saps your will to read further.

Here are a few things that I found interesting – nothing like comprehensive, just features that perhaps have not had the attention they deserve.

Microsoft F# – a new language from Microsoft Research, integrated into Visual Studio with remarkable speed. The people I’ve spoken to who have taken the time to discover what it does are truly enthusiastic. Some of its strengths are parallelism, asynchronous programming, graphics manipulations, and maths. You probably won’t write a complete application in F#, but it will be great for assembling libraries.

Windows Workflow Foundation 4.0 – potentially a new and effective approach to visual programming and long-running state management. Flow charts are often used to teach programming, since they express common concepts like if conditions visually. WF lets you draw a process as a flow chart – or there are other types of chart – using the nice new WPF design tools, and then execute it in the runtime, which is part of the “Dublin” extensions to IIS, now known as Windows Server AppFabric (I have no clue why this confusing name was chosen). To get the idea, I suggest reading David Chappell’s Workflow Way. For applications that fit this kind of model, it is a compelling approach, and integrates well with Windows Communication Foundation for messaging.

Dotfuscator – I know this is a third-party thing, but this is no longer just a tool for obscuring your .NET assemblies in the hope of preventing decompilation. The new Dotfuscator does runtime analytics, and can report back to a portal when your application runs, what features you use, what operating system it is on, whether it crashed, and so on. It also supports application expiry, known as “shelf life”, and can detect if assemblies have been tampered with. Some of this sails close to the spyware wind, but this is a matter of getting informed user consent. These are interesting features for Windows desktop developers, if there are any left, and even the free edition is quite capable.

Test and Lab management – a challenge to set up and configure, but when it works, amazing. Lab Management uses Visual Studio, Hyper-V and System Center Virtual Machine Manager to automate deploying an application over one or more VMs, so you can run tests against it. This hooks into Team System so you can file a bug report with a link that actually shows the bug happening at runtime, with a snapshot of the virtual environment.

Step backwards through code – IntelliTrace is a new feature of the Visual Studio debugger. Configure it to collect IntelliTrace events and call information, and you can then step backwards as well as forwards from a breakpoint, examining variable values as they change.

Team Foundation Server Basic – what this means is that even a solo Visual Studio developer can have TFS running locally or on a networked machine for source code management, issue tracking and so on. It’s worth considering because of the way it integrates with the IDE. I admit, I still like Subversion which I have on a remotely hosted server, since it acts as an effective off-site backup, but I’d much rather use TFS Basic than nothing.

UML – Microsoft has finally done what it should have done years ago, and implemented a wide range of up-to-date UML diagram tools. Nothing revolutionary, just useful.

Not everything is wonderful in the new Visual Studio. Deploying to Azure remains clunky in Beta 2 – when is this going to get better? SharePoint is another one; I appreciate the value of F5 debugging, but you still need SharePoint installed locally, with great potential for mucking up IIS, and the whole thing feels unwieldy.

A Silverlight UI for Windows Mobile 7, backward compatibility in doubt

Note: speculative post; I have no official information on this.

It’s been rumoured for ages; but at this point I would be surprised if the Windows Mobile 7 UI were not built with Silverlight. Consider:

  • Silverlight has to be supported – it should have been in 6.5 – otherwise nobody will take mobile Silverlight seriously
  • WM7 has to have excellent UI design; and WPF/Silverlight is Microsoft’s designer-friendly UI framework
  • Silverlight 4 already supports touch control in the current beta
  • Scaling/Zooming is baked into Silverlight and ideal for a mobile UI
  • If Silverlight is present on the device it would make sense to build the UI with it

If this is right, there are a couple of interesting aspects for developers. It will make Silverlight a more attractive platform in scenarios such as Enterprise roll-outs where the device can be specified.

The awkward question: what about all those existing Windows Mobile apps built either with native code or with the compact framework? Again, there are rumours of lack of backward compatibility. Does that mean that all Windows Mobile 7 apps with a UI will have to be done in Silverlight? That’s what John Biggs says:

WinMo 7 will not run 6.x code. End of story. It is based on Silverlight and .Net. Everything save a few basic programs will not work under WinMo 7. There is no expectation that this will be a “business device” and the focus is currently on games including some XBox Live functionality for gaming and messaging. There will be a Microsoft App store with an easy approval process.

I find this a stretch. I can believe that Microsoft might initially target the consumer market, or have crippled “consumer” versions; but not that it would give up on mobile business apps – we heard at PDC (to the point of tedium) how Microsoft is supporting “three screens and a cloud”, unified for developers by Visual Studio. There’s no reason why Silverlight should not be used for business apps.

What about backward compatibility though? Traditionally Microsoft does a good job of keeping your old stuff running, within reason; possibly too good – Windows is full of compatibility hacks that may be to its detriment overall.

Another point to bear in mind: WM7 needs a browser, and I don’t see Microsoft re-implementing IE in Silverlight.

So I’m sceptical about this too; but with Windows Mobile at such a low ebb could the company decide it has little to lose?

Windows Azure is too expensive for small apps

I’m researching Windows Azure development; and as soon as you check out early feedback one problem jumps out immediately. Azure is prohibitively expensive for small applications.

Here’s a thread that makes the point:

Currently I’m hosting 3 relatively small ASP.net web applications on a VPS. This is costing about $100 per month. I’m considering transitioning to Azure.
Q: Will I need to have 1 azure instance per each ASP.net application? So if I have 3 web apps, then I will need to run 3 instances which costs about $300 per month minimum, correct?

The user is correct. Each application consumes an “instance”, costing from $0.12 per hour, and this cost is incurred whenever the application is available.

Amazon also charges $0.12 per hour for a Windows instance; but the Amazon instance is a virtual machine. You can run as many applications on there as you like, until it chokes.

Google App Engine has a free quota for getting started, and then it is charged according to CPU time. If the app is idle, you don’t pay.

In addition, all these services charge extra for storage and data transfer; but in a low-usage application these are likely to be a small proportion of the total.

Summary: Azure’s problem is that it does not scale down in a way that makes business sense. There is no free quota, unless you count what is bundled with an MSDN subscription.

I realise that it is hard to compare like with like. A cheap Windows plan with a commodity ISP will cost less than either Amazon EC2 or Azure, but it is worth less, because you don’t get a complete VM as with Amazon, or a managed platform as with Azure, or the scalability of either platform. The point though is that by cutting out smaller businesses, and making small apps excessively expensive for customers of any size – even enterprises run small apps – Azure is creating a significant deterrent to adoption and will lose out to its rivals.

Check out the top feature request for Azure right now: Make it less expensive to run my very small service.

Silverlight 4 with COM can do anything – on Windows

At PDC Microsoft played down the significance of adding COM support to Silverlight 4 when run out of the browser and fully trusted (you can also be out of the browser and not fully trusted). The demos were of Office automation, and journalists were told that the feature was there to satisfy the requests of a few Enterprise customers.

Now former Microsoft Silverlight program manager Justin Angel, who has implemented his blog in Silverlight, has spelt out what we all knew, that Silverlight with COM support can do just about anything. His richly-illustrated blog post has code examples for:

  • reading and writing to any file (subject I guess to the permissions of the current user)
  • executing any command or file
  • emulating user input with WShell.SendKeys
  • pinning files to the Windows 7 taskbar
  • reading any registry values
  • adding an application to the Windows startup folder
  • doing text to speech using Windows built-in engine
  • accessing local databases with ODBC
  • automating scanners and cameras
  • using the Windows 7 location API, accessing the full .NET Framework
  • and of course … automating Microsoft Office.

Well, fully trusted means fully trusted; and these are great features for powerful though Windows-only Silverlight applications, though I hope no user installs and trusts one of these applets thinking it is “only Silverlight” and can’t do much harm.

The post also has comments on the lack of any equivalent feature for the Mac in Silverlight 4:       

If Microsoft chooses to not go ahead with Mac support in Silverlight 4 RTM, well, it’s not because they couldn’t

says Angel, suggesting that it would be easy to add AppleScript support. (I had to type that quote – no clipboard support in Silverlight 3).

Of course there is time for Microsoft to unveil such a feature, say at Mix10 in March, though I wouldn’t count on it.