F#, Enterprise JavaScript at QCon London

The best sessions here at QCon London have been the small ones, not the big ones. Yesterday the slot I enjoyed most was from Attila Szegedi on JavaScript in the Enterprise. He uses Mozilla Rhino for server-side development. It’s not a mainstream choice; but he made a case for it, saying that continuations in JavaScript bring huge benefits, that there is a ready supply of developers with JavaScript skills (albeit mostly browser-based), and JavaScript is so flexible that he can work around any limitations.

One example is that JavaScript has no namespaces; but it does support function pointers, so he adds a bunch of function pointers as members of an object, and then that object works like a namespace.

Szegedi says he has little interest in ECMAScript 4.0 – once thought to be the future of JavaScript – because there is no community consensus around it.

Today I’ve just attended a session on Microsoft F# given by Amanda Laucher. F# is a functional language that will be released as part of Visual Studio 2010. I knew little about it until today. Laucher gave a code-heavy presentation looking at how the ease of concurrency in F# can greatly increase speed of execution, using an example from the car insurance industry.

Laucher said that threading in C# is horrible in comparison.

Developers are not going to abandon C# or Visual Basic in favour of F#. Rather, they will encapsulate pieces of functionality in F# where they can get benefit, and call them from their C# or VB application.

Technorati Tags: ,,,,,

QCon London 2009

I’m at QCon London and covering it on Twitter as wi-fi and battery power allows. The focus of the conference is enterprise development, and it spans Java and .NET, SOAP and REST, but with a bias towards Agile methodology.

I was here last year, and my observation is that last year there was considerable angst about the idea that the SOAP stack was failing to deliver and that new stacks based on REST were the thing to do.

This year this same statement feels more widely accepted and people are moving on, based on that assumption.

One delegate stuck his hand up and asked, “is this a fad, or will it last”? Sounds like a cry of pain from someone who invested heavily in something now condemned. History tells that in five or ten years time we may well be equally enthusiastic about some new thing and observing all the weaknesses in the bad stuff we used to do.

Still, these trends don’t form overnight. We have to choose what looks like the best model at the time.

I’m typing this during a session on test-driven development. Personally I think TDD is a more profound improvement in the software development process than REST vs SOAP; the detail of TDD will continue to evolve and be debated; but its basic ideas are hard to challenge.

As an aside, this is one factor in why ASP.NET MVC is so important for developers on Microsoft’s web platform. Reason: it’s testable.

Mono creeping into the mainstream?

For those of you who have not already seen this link on Twitter: I’ve posted a short piece on Mono, the open source implementation of Microsoft .NET. The piece was prompted by my own experience writing a simple .NET application in Visual Studio and deploying it to Linux. Admittedly I anticipated the move by using MySQL rather than SQL Server as the database; but even so, I was impressed by how easy it was – I spent more time recently deploying an application from Visual Studio 2008 to Windows Server 2008, thanks to some issues with SQL Server Express.

Don’t Miguel de Icaza’s comment about scalability and garbage collection, two of the factors that have deterred some from real-world Mono deployments.

Hands on with ASP.Net Membership, SQL Express and Server 2008

Is it worth using the built-in membership framework in your ASP.Net application, or should you roll your own? I’ve been trying it out recently, and I have mixed feelings.

On the plus side, it does get you up and running quickly with user login and role-based permissions, saving time and possibly achieving more reliable results, on the grounds that Microsoft and countless other users should have found and fixed any bugs by now.

One the negative side, there are annoying limitations. The most obvious one is that a user as defined in the framework only has a minimal number of fields, not including information you probably want to store like first and last name. You are meant to fill this gap by using profiles, another ASP.Net feature which lets you store arbitrary name-value pairs in a database as a kind of persistent session. That works, but the way profile properties are stored makes it hard to do things like sorting users by last name. Therefore, you will probably end up managing your own user database and joining it to the membership system with the user ID, at which point you begin to lose some of the benefits.

Some of the supplied controls, like the CreateUserWizard, seem rough-and-ready too.

Still, the real fun began when I tried to deploy my demo app to Server 2008 and SQL Server Express 2008. By the way, make sure you install .NET Framework 3.5 SP1 and Windows Installer 4.5 before installing the latest SQL Server Express, otherwise the setup spends ages unpacking its files and then exits with a brief message. I got there eventually, copied my application across, and optimistically tried to run it.

When you debug a web application in Visual Studio, it defaults to a SQL Express database in the App_Data folder within the web site, attached on demand. In theory, that should make it easy to deploy to another machine with SQL Express installed: just copy it across, right? There must be a way of getting this to  work, but it seems a lot of people have problems. I got the message:

Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.

This makes sense, insofar as ASP.NET runs as this user. I temporarily attached the database and added the login, to be rewarded with a different and more perplexing error:

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance.

A quick Google shows that many users have suffered from these errors, and that a large number of remedies have been proposed. I abandoned the idea of attaching the database on demand and set up a new database, made ready with Aspnet_regsql. I still got one or other of these errors.

Eventually I realised that my application was using more than one connection string. The problem is that the membership framework uses three different "providers", one for membership, one for roles, and one for profiles. By default in IIS 7.0, these all use an attach-on-demand connection string, defined as LocalSqlServer, and inherited from machine.config buried deep within your Microsoft .NET Framework system folder. In order to prevent ASP.Net membership from using this, you have to override all three providers in the web.config for your application. There’s an example in this article from ISP MaximumASP. I wish I’d come across it sooner; but my demo works fine now.

RIA plug-in stats: Flash dominates

I’ve just come across riastats.com which has statistics on which RIA (Rich Internet Application) plug-ins are installed on which browser.

The stats are from a relatively small sample: it claims to have analysed 1.5 million browsers across 42 sites at the time of writing.

The headline: Flash is on over 97% of browsers; but only 52% are at version 10. Java is on just under 75%, while Silverlight can only muster 20% penetration.

I also noticed that Firefox (25%) users are more likely to have Silverlight than IE (20%). Maybe all those locked-down corporate desktops.

Another snippet: less than 30% of Linux users have Sun’s Java plug-in installed.

Microsoft can take some comfort from the direction of the graph. In December 2008 only 15% of browsers had Silverlight. That’s pretty fast growth.

Still, the bottom line is that if you want to be fairly sure that your users have nothing to install in order to view your RIA content, use Flash. But stick to version 9.

Latest steps in the Google dance: brands, or not?

There’s a buzz in the SEO community about an update which the search company has made to its algorithms – though Google’s Matt Cutts calls it a change, if you can figure out the difference, albeit one important enough to have a name within the company – it’s “Vince’s change”, after the employee who contributed it.

According to SEO guru Aaron Wall  it is related to CEO Eric Schmidt’s comments last year that the Internet is a “cesspool” of false information. Big idea: promote trusted brands in the search results to ensure quality in the top hits.

As usual with Google, it’s hard to discern whether this is a big deal as Wall claims, or a minor evolution as Cutts presents it. Still, it is worth a few observations.

First, it seems obvious that Google’s original big idea, pagerank based on incoming links, is becoming less and less useful. It has been killed first by the SEO industry itself and its unceasing link farms and exchanges, and second by Google’s promotion of the “nofollow” attribute, which ironically means that many of the best incoming links are now supposedly ignored, while the SEO folk ensure that low-quality links which are not tagged nofollow abound.

That being the case, Google has to look for other ways to rank sites. According to Cutts, there are three things (in addition to pagerank) that it tries to identify: trust, authority, and reputation.

The brands idea is an easy solution. Prefer the well-known names; that way you may not get the best content or the best price; but at least users generally won’t be scammed.

The potential consequences of this kind of thinking are far-reaching. It is undermining one of the Web’s key attractions, which is low barriers to entry. If SEO becomes a matter of building a big brand, it is no different than the old world of big-budget marketing campaigns (and perhaps that should not come as a surprise).

The other twist on this is that users searching don’t necessarily want the big brands. Rather, they want the best information. Further, if a user wants to find a big brand on the Web, it does not need Google to do so. If Google goes too far in promoting familiar names above the best content, it leaves an opportunity for other search engines.

I think Google is smarter than that. Nevertheless, the problem which Schmidt refers to is real, and I reckon that barriers to entry on the Internet are rising and will continue to do so.

The power Google exerts to make or break Internet enterprises and to influence the flow of information is downright spooky, mitigated by the fact that it does an excellent job as far as I can tell (and there lies the rub).

Finally, one tip for Google. Scrap nofollow. It was a bad idea, for reasons which only now are becoming obvious. If I were building a search engine today, I would take little or no account of it.

PS great comment from @monkchips on Twitter just as I posted this entry:

for my purposes google search has actually become less useful over time. Now its kind of like a mall of corporations

Programming language trends: Flash up, AJAX down?

I’m fascinated by the O’Reilly reports on the state of the computer book market in 2008, particularly the one relating to programming languages.

Notable facts and speculations:

C# is the number one language, overtaking Java (which is down 12%), and was consistently so throughout 2008. Although the .NET platform is no longer new and exciting, I’m guessing this reflects Microsoft’s success in corporate development, plus the fact that the language is changing fast enough to stimulate book purchases. Absolute growth is small though: just 1%.

Objective-C is growing massively (965%). That’s probably stimulated by iPhone app development more than anything else. It’s a perfect topic for a programming book, since the platform is important and popular, and attracting developers who were previously ignorant of Objective-C.

ActionScript is growing (33%). That’s Adobe’s success in establishing Flex and the Flash platform.

PHP is up 3%. I’m not surprised; it’s usually the P in LAMP, everyone’s favourite free and open source web platform. That said, the online documentation and community support for PHP is so good that a book is less necessary than for some other languages.

JavaScript is down 24%. I’m a little surprised, as JavaScript is still a language everyone has to grapple with to some degree. It may be a stretch; but I wonder if this is a symptom of AJAX losing developer mindshare to Flash/Flex (ActionScript) and maybe Silverlight (C#)? Another factor is that JavaScript is not changing much; last year’s JavaScript book is still good enough.

Visual Basic is down 15%. Exactly what I would expect; slow-ish decline but still popular.

Ruby is down 51%. This is a surprise; though it was well up in 2007 so you could be kind and describe this as settling. The problem with Ruby though is lack of a major sponsor; plus the migration from PHP to Ruby that seemed possible a couple of years ago just has not happened. It may be intimidating to casual developers who find PHP more approachable; plus of course, Ruby probably is not installed on your low-cost shared web hosting package.

Python is down 14%. Google sponsors Python, in that it is the language of App Engine, but apparently this has not been enough to stimulate grown in book sales. I guess App Engine is still not mainstream; or maybe there just aren’t enough good Python books out there.*

It will be interesting to see the 2009 report in a year or so. Meanwhile, I’m off to write an Objective C tutorial (joke!).

*Update: I was reading the charts too quickly; it looks as if the percentages above are only for the last quarter; the annual figures are similar except that Python actually grew over the year as a whole.