Category Archives: software development

PhoneGap comes to Windows Phone

Nitobi has announced PhoneGap for Windows Phone 7, nicely timed just before the Microsoft BUILD conference next week.

PhoneGap is a cross-platform mobile development tool that uses the HTML and JavaScript engine on the phone as its runtime, supplemented by extensions which give access to other device features:

After unpackaging the contents of the www folder, your www/index.html file is loaded into an embedded headless browser control. This is essentially the same paradigm as other platforms, except here it is an IE9 browser and not a webkit variant. IE9 is a much more standards-compliant browser than previous IEs, and implements commonly used html5 features like DOMContentLoaded events, addEventListener interfaces, and CSS3. Be sure to use to get the html5 implementation otherwise the browser may fallback to a compatibility mode, and your code will likely choke and die.

The version for Windows Phone 7, just released in preview, is extended to support features including the camera, accelerometer, contacts, and notifications. There is also support for plugins:

PhoneGap-WP7 maintains the plugability of other platforms via a command pattern, to allow developers to add functionality with minimal fuss, simply define your C# class in the WP7GapClassLib.PhoneGap.Commands namespace and derive your class from BaseCommand.

In general Windows Phone 7 is not well supported by cross-platform toolkits, so PhoneGap support is an interesting development. PhoneGap has a high profile currently, and is being integrated into a diverse range of tools ranging from Adobe Dreamweaver to Embarcadero RadPHP, as well as the standard PhoneGap tools based on Eclipse.

Review: Continuous Delivery by Jez Humble and David Farley

I like this book. I know I like it because I find myself wanting to quote from it frequently. It is a book that almost every software developer should read, even if you disagree with parts of it – which is likely, because it is opinionated. The authors always give reasons for their opinions though, which means that if you disagree, you need to articulate why that is; or they may even change your mind. In consequence you find yourself learning as you read.

The authors are software theoreticians, but they are also practitioners; in fact they are practitioners first and theoreticians afterwards. This means they are pragmatic rather than dogmatic. Here is an example. Chapter 13 discusses software dependencies, and page 372 covers circular dependencies, “probably the nastiest dependency problem.” A circular dependency is when component A depends on component B, and component B also depends on component A.

A bad idea; but the authors write:

Surprisingly, we have seen successful projects with circular dependencies in their build systems. You may argue with our definition of “successful” in this case, but there was working code in production, which is enough for us.

As an aside, this kind of dry humour is characteristic, as also evident in remarks like this:

We are certain that, occasionally, manually intensive releases work smoothly. We may well have been unlucky in having mostly seen the bad ones.

The subject of the book is Continuous Delivery. So what is that? Well, if Continuous Integration is about ensuring that your software always builds, then Continuous Delivery is about ensuring that your software always deploys. The final form, as it were, of Continuous Delivery is Continuous Deployment, where you are so confident of your automated build and deploy process that any checked-in code that passes its tests can be deployed immediately. I was confused about the difference between Continuous Delivery and Continuous Deployment so I wrote a post about it; it turns out that there is not much difference.

The principle behind Continuous Delivery is that software is not done until it is released. If the release process is long, arduous and infrequent, then you are not really doing Agile development. A section of chapter 1 is devoted to release anti-patterns, and these form an excellent rationale for taking an interest in Continuous Delivery.

My guess is that anyone who has been involved in professional software development will wince a little while reading through these anti-patterns, thinking “that is what we used to do” or even “that is what we do”.

That said, Humble and Farley do not fall into the trap of merely writing about how not to do it. Rather, they address in some detail the kinds of problems you will face if you decide to embrace the Continuous Delivery methodology. The key ingredient in Continuous Delivery is that pretty much everything must be automated, otherwise it is too difficult to do. But how do you automate something like Acceptance Testing? That is the subject of chapter 8. How do you automate a deployment at all? That is the subject of chapter 6. The authors are not on a higher plane than the rest of us, and much of the advice is straightforward, even at the level of “Always use relative paths,” which is a tip in chapter 6.

The authors talk a lot about testing, as you would expect, but there is also extensive discussion of software configuration management, describing different approaches such as centralised and distributed version control and even specific tools. The chapter on Advanced Version Control is a particularly good read. Humble and Farley articulate the point that branching and merging is antithetical to Continuous Integration and therefore Continuous Delivery:

If different members of the team are working on separate branches or streams then by definition they’re not continuously integrating (p 390)

Does this mean branches are a bad idea? Not always, say the authors, but they also state:

Our strong recommendation is to crate long-lived branches only on release … new work is always committed to the trunk (p 392)

The reason is not only to enable Continuous Integration, but also because merging is complex and error-prone.

Software configuration management is not easy, but it is a relatively mature aspect of software development. This is less true of what you might call infrastructure configuration management; yet infrastructure dependencies such as versions and configurations of the operating system or web server are a common reason for deployment failures. Several chapters discuss this problem in detail. In principle, the authors say:

The desired state of your infrastructure should be specified through version-controlled configuration.

This leads to some thoughtful discussion of how to achieve this.

Another theme, as you would expect, is that development and operations people need to be working together and not in isolation. To some extent this is a DevOps book.

A great book then; but there are flaws. One is that there is some repetition because of the way the book is organised. This is good if you are inclined to read chapters in isolation, but not so good if you are reading straight through. In practice I did not find it too annoying, but it is there.

Another issue is that while the authors do cover Microsoft .NET to some extent, this is usually in the form of a brief mention and there is more focus on Java. This may be in part because of their preference for open source. It is still a good read for .NET developers, because the principles are platform-agnostic, but Microsoft platform developers may find it irritating at times. Team Foundation Server, say the authors, is “essentially an inferior knock-off of Perforce” (p 386).

The discussion of specific tools is a strength but also a weakness, in that the tools will change over time and the book will become dated.

This is not the last word on Continuous Delivery, but it is an enjoyable and thought-provoking read. Recommended.

 

Amazon entices Android developers with $50 incentive

Amazon is offering Android developers $50 of AWS (Amazon Web Services) credit if they submit an app to the Amazon Android app store.

Although the announcement refers to apps that actually make use of AWS, this does not seem to be a pre-condition:

September 7 – November 15: Android developers who submit an app that is approved to the Amazon Appstore for Android through October 15 will receive a $50 promotional code towards the use of AWS products and services

The move ties in with reports of Amazon developing its own Android-based tablet/Kindle. Exactly what Amazon will offer is still under wraps.

Amazon is an interesting contender in the mobile wars because it has its own instant ecosystem – millions of customers who are already signed up with accounts and stored credit card details. Add in Kindle eBooks, the MP3 store, and the Amazon Instant Video Store for streaming video, and it amounts to a comprehensive content offering that approaches that of Apple.

The AWS element is also significant, and in this respect Amazon is ahead of Apple. Of course there is nothing to stop you using AWS with apps for iOS or other platforms, though there is synergy when it comes to payments.

The relationship with Google is interesting, in that Google controls Android but Amazon is not hooking into Google services or the official Android Marketplace. Amazon is showing no sign of developing its own search engine though, so Google will still get some benefit if Amazon devices are popular, provided Google remains the default for search.

Windows Phone 7 apps, stats and future

Justin Angel, a former Microsoft employee who worked on Silverlight, has posted his analysis of the 24,505 apps he found in the Windows Phone 7 marketplace, exploiting a loophole that lets you get the download links. A few highlights:

  • 97% of the apps are not obfuscated, meaning that it is trivial (with easily available tools) to decompile the source.
  • 90% are Silverlight vs 10% XNA. This is not so much an indicator of the popularity of the two frameworks, but more an indicator of how many apps are graphic-rich games rather than some other kind of utility. Of course if you are making a very simple app, Silverlight is easier than XNA, so that may be a factor too.
  • 99% are C# vs 1% Visual Basic and a smattering of F#. A fascinating stat that makes me wonder what is the future of Visual Basic.

There are more interesting stats about libraries and components used, for which I refer you to the original post.

Does it matter? Well, Windows Phone 7 has not been a big success so far, though the reasons for that are not so much the quality of the OS or the ease of developing apps, but rather its low profile at retail and the fact that most operators and manufacturers don’t really need it: Apple and Android between them pretty much have the market.

That said, there are a few reasons why Windows Phone or some evolution of it may yet be significant. Nokia is betting on it, and while Nokia is undoubtedly in difficulties, this must work in Microsoft’s favour. Further, fear uncertainty and doubt surrounding Android patent and copyright issues may persuade some industry players to give Windows Phone another look.

Perhaps more significantly, when Microsoft unveils its developer strategy at the BUILD conference next week, it is likely that the application model in Windows Phone, or some evolution of it, will integrate with what is planned for Windows 8. NVIDIA is already talking about how Windows 8 will run Windows Phone apps.

For these reasons I believe there is at least a glimmer of hope for Microsoft in the mobile world; certainly the developer story to be officially told next week will be an interesting one.

Hands on with Delphi XE2 for Apple iOS

Last week Embarcardero released RAD Studio XE2. RAD Studio is the suite of tools based on Delphi, a language – originally called Object Pascal – and visual development tool which still has a loyal following. XE2 is the most interesting new release for years, introducing a 64-bit compiler for Windows and cross-platform support for Apple’s OSX and iOS.

I have been trying the final release, paying particular attention to the iOS support, bearing in mind the importance of Apple’s mobile platform. The RAD Studio IDE only runs on Windows, so the most convenient way to target Apple’s platform is to install on a Windows virtual machine. I used a Parallels VM running Windows 7 64-bit, hosted on OS X Lion.

Setting up for iOS development with RAD Studio XE2 involves several steps. First, you have to use the new FireMonkey application framework in order to do cross-platform work. FireMonkey emerged after Embarcadero acquired the intellectual property of a company called KSDev early in 2011, along with its founder Eugene Kryukov:

KSDev’s intellectual property has been purchased by Embarcadero Technologies, the makers of Delphi and C++Builder Rapid App Development Tools. I am excited to announce that I have joined Embaracadero’s next gen frameworks team leading a very exciting project. As a result I will no longer operate the KSDev company and will not be accepting any further orders for KSDev products.

The products in question were Delphi frameworks called VGScene and DXScene, and these seem to have been melded with remarkable speed into what is now called FireMonkey. FireMonkey controls such as buttons and listboxes are all custom drawn, which is good for cross-platform consistency, but bad if you want your application to look and feel truly native. FireMonkey is not compatible with Delphi’s VCL (Visual Component Library), though the basic controls like TButton and TEdit are similar. FireMonkey applications can be either 3D, with the emphasis on Flash-like visual effects, or HD, used for more traditional user interfaces.

Support for Mac OSX is more fully integrated than for iOS. You can easily add an OSX target to a FireMonkey application, but for iOS you have to create a new application that only targets iOS. Another difference is that Embarcadero has its own Mac compiler, whereas the iOS support depends on the FreePascal open source compiler. If you are targetting OSX, you can code and debug entirely from the Delphi IDE, whereas for iOS you have to export your project and compile in Xcode.

In order to prepare for iOS development, you first need a Mac with XCode and the iOS SDK installed. Next, install RAD Studio XE2 on Windows. Then find the FireMonkey-iOS folder in the directory where RAD Studio XE2 is installed. This contains FireMonkey-iOS.dmg. Copy this to the Mac side, mount it and run the FireMonkey iOS installers to add FreePascal and the FireMonkey libraries to your XCode setup.

image

If you are also doing OSX development you will also need to install the Platform Assistant on the Mac, but for iOS this is not required.

Now you can go over to the Windows side, start a new application observing all the tasty new options, and choose a FireMonkey HD iOS application.

image

This creates a new form sized for an iPhone 4.0, though of course you can amend this. There is a tool palette which looks well-stocked with components, but note the following warning:

While you are designing your iOS application, you can only use components that are supported on iOS devices. However, the Tool Palette might contain components that are Windows-only or otherwise not supported on iOS.

That is an annoyance, and contributes to a feeling that iOS support is a little, dare I say, unfinished. Still, undaunted I built my sample app, following the path I have trodden before by creating a simple calculator.

image

You might wonder why all the buttons are green. I did, too, and played around a little trying to change it. This seems to involve creating a custom style. I started doing this, but decided it was not necessary for my simple test. It does make the point that the default appearance does not have the iOS look and feel.

There is what seems to me a small bug in the designer. If you select more than one control, the sizing tabs disappear and there is no visual evidence that the controls are selected, other than a heading in the Object Inspector that reads “n items selected.” At first I thought it was impossible to select more than one control, but this is not the case. However, there is no clipboard support in the visual designer. For example, if you want several buttons that are exactly the same, you need to add them individually, then multi-select and set the properties as needed.

While developing an iOS app, you can test it by running it on Windows within the IDE. When it is ready to test on iOS, you need to export the project. To do this, you need a command-line tool called dpr2xcode.exe, which is in the RAD Studio bin folder. Running this from the command-line is inconvenient, so the usual approach is to use Configure Tools from the Tools menu to add it to the IDE.

image

It is puzzling that Embarcadero has not included this by default.

Running the tool creates an xcode sub-folder in your project directory, with an .xcodeproj project file along with some default icons. I then copied the entire project folder to the Mac. It is also possible to use a shared folder accessed from both Windows and Mac, though I found this does not work if the folder is on the Windows side, so I simply copied it back and forth.

I opened the project in Xcode, and was prompted to “Modernize” it in Xcode jargon, to no ill effect. At this point I could successfully build it and run in the iPhone emulator.

Of course I wanted to test it on an actual device. I attached an iPhone 4 and did the Apple provisioning dance. After the usual messing around with certificates, it worked.

image

and here it is on the iPhone:

image

It works, and to that extent I am impressed. That said, I am disappointed with the performance. This is subjective, but I am talking about the responsiveness of the UI. There are perceptible pauses, which for such a simple app is surprising. I have created this same app numerous times using different development tools, and had expected that the Delphi version would be up there with the best, but while it is acceptable it is less responsive than some of the others.

Let me add though, a Delphi developer will find the process described above a easier than learning Objective C, and I was able to create this fully working app in an afternoon so I should not complain too much.

Maybe when Embarcadero comes up with its own iOS compiler there will be some improvement.

Google gets serious about App Engine, ups prices

Google App Engine will be leaving preview status and becoming more expensive in the second half of September, according to an email sent to App Engine administrators:

We are updating our policies, pricing and support model to reflect its status as a fully supported Google product … almost all applications will be billed more under the new pricing.

Along with the new prices there are improvements in the support and SLA (Service Level Agreement) for paid applications. For example, Google’s High Replication Datastore will have a new 99.95% uptime SLA (Service Level Agreement).

Premier Accounts offer companies “as many applications as they need” for $500 per month plus usage fees. Otherwise it is $9.00 per app.

Free apps are now limited to a single instance and 1GB outgoing and incoming bandwidth per day, 50,000 datastore operations, and various other restrictions. The “Instance” pricing is a new model since previously paid apps were billed on the basis of CPU time per hour. Google says in the FAQ that this change removes a barrier to scaling:

Under the current model, apps that have high latency (or in other words, apps that stay resident for long periods of time without doing anything) can’t scale because doing so is cost-prohibitive to Google. This change allows developers to run any sort of application they like but pay for all of the resources that your applications use.

Having said that, the free quota remains generous and sufficient to run a useful application without charge. Google says:

We expect the majority of current active apps will still fall under the free quotas.

Free apps are limited to a single instance, 1GB outgoing and 1GB incoming bandwidth per day, and 50,000 datastore operations, among other restrictions.

The pricing is complex, and comparing prices between cloud providers such as Amazon, Microsoft and Salesforce.com is even more complex as each one has its own way of charging. My guess is that Google will aim to be at least competitive with AWS (Amazon Web Services), while Microsoft Azure and Salesforce.com seem to be more expensive in most cases.

Full circle for Microsoft database APIs as OLEDB for SQL Server is deprecated

Microsoft’s Eric Nelson has posted about how the OLEDB driver for SQL Server is being deprecated and will not be supported beyond “Denali”, the forthcoming version.

OLEDB was created to be the successor to ODBC – expanding the supported data sources/models to include things other than relational databases. Notably OLEDB was tightly tied to a Windows only technology (COM) whilst ODBC was not (Although we did try and take COM cross platform via partners)

ODBC never did get replaced. What actually happened is that ODBC remained the dominant of the two technologies for many scenarios – and became increasingly used on none Windows platforms and has become the de-facto industry standard for native relational data access.

ODBC was as I recall Microsoft’s first attempt at creating a universal database API.

The death of OLEDB will be slow, according to Nelson. The OLEDB driver for Denali will be supported for seven years following Denali’s release. He also says that OLEDB itself, as opposed to the SQL Server OLEDB driver, is not necessarily being deprecated; though frankly if Microsoft ceases supporting it with its own database I cannot see much future for it.

Note that ADO.NET, which to some extent replaced OLEDB, is not being deprecated. However ADO.NET is only usable from .NET applications. When you consider that Microsoft may be to some extent tilting away from .NET and towards native code, the deprecation of OLEDB becomes even more significant.

ODBC is not particularly easy to use in its raw form. However, you can wrap ODBC with, yes, an OLEDB provider or an ADO.NET provider; or you can wrap the whole lot in an object-relational framework such as Entity Framework.

One more chapter in the long, strange and tortuous history of Microsoft’s data APIs.

Windows Live Messenger error message hell

Recently I tried to sign into Live Messenger on Windows 7, only to be informed of what appears to be a temporary interruption in service.

image

Show details, by the way, shows Error code: 80040154

I retried and got the same message, so I clicked the Get more information link, which took me here:

image

The help document says that the solution is to reinstall Windows Live Essentials. I confirmed this, not by reinstalling (yet), but by trying Live Messenger on another machine, where I could sign into the same account successfully.

A few observations about this:

  • The error message is incorrect, since the error is apparently on the client whereas the message states it is a temporary problem with the service.
  • Microsoft’s engineers know that the error message is incorrect, since the help document references both the message and the solution.
  • The error message has been incorrect for years, since it applies to both Windows Live Messenger 2009 and 2011.
  • The misleading error message is particularly annoying, since if the user wants to use Live Messenger urgently they may well wait as advised by the message, not realising that the problem can be fixed immediately.
  • The solution is a brute-force one that involves many other applications, including Live Mail and Live Writer (on which I am typing this post). Or is it enough just to reinstall Messenger? The message suggests not. However if you use Live Mail for all your email, you probably want to know whether the uninstall will delete all your email and contacts or not. The referenced article on uninstalling Live Essentials does not say.

How could Microsoft improve this? At risk of stating the obvious:

  • Give an accurate error message.
  • Give a solution which targets the exact problem rather than relying on an uninstall/reinstall procedure that changes many things that are working fine.
  • If this is impossible, at least advise the user in one place concerning their obvious questions, such as “what happens to my stuff”.

Update: I found the cause of this problem. A developer tool beta had overwritten my system path with its own, breaking this among other things. I do not blame any application for breaking in these circumstances. I fixed the Live Messenger problem by performing a Repair on Live Essentials – less risky than uninstall/reinstall, and in this case sufficient.

Another idea if you have this kind of problem is System Restore.

Nevertheless, the error message could do with some work!

Adobe says role of Flex and Flash has changed, makes play for mobile

Adobe’s Andrew Shorten has posted on the future of Flex, the developer-oriented tool for building applications for the Flash runtime.

This is one of the clearest statements I have seen from Adobe that recognises that the role of Flash on the web is diminishing:

There are countless examples where, in the past, Flex was (rightly) selected as the only way to deliver a great user experience. Today, many of those could be built using HTML5-related technologies and delivered via the browser, and at Adobe, we will provide tooling to help designers and developers create those experiences – Edge and Muse are two such examples.

Adobe is not giving up on Flash, of course, and states that it is still the best for certain categories of application:

We firmly believe that Flex is already the best technology for building complex, high fidelity enterprise applications such as business dashboards, line of business tools, real time trading applications and desktop replacement applications.

I would add both statements are written from the perspective of application developers. The role of Flash as a video and multimedia player is a separate issue. Flash is also important in that context. There is some overlap, in that if your application includes multimedia content then Flash is correspondingly more attractive.

As an aside, it is interesting to note that this repositioning of Flash makes it not so different from Microsoft’s Silverlight: a runtime for business applications.

Adobe is focusing on a new market for Flex in mobile. This overcomes the Apple iOS problem, since you can compile a Flex application to iOS native code. Adobe promises “additional mobile development capabilities” later this year and says:

In our next major release timeframe we expect that the need to build a fully-native application will be reserved for a small number of use cases.

I agree that cross-platform mobile development is a key area and one where there is no clear winner yet. It is a good opportunity for Adobe, though there is increasing competition from the products like Appcelerator Titanium and PhoneGap.

I also think that Embarcadero’s new RAD Studio XE2 will attract interest. This tool which will be released soon does native code compilation across Windows, Mac and Apple iOS, with Android promised, using the Delphi IDE and language.

jQuery usage soars as Adobe Flash shows slight decline

A press release from .appendTo, a company which offers jQuery-based services and training, states that “jQuery Overtakes Flash on World’s Top Websites”. I found it a curious claim insofar as jQuery is not really an alternative to Flash, though there is some limited set of graphical effects for which I guess you could use either.

I took a look at the source data from httparchive.org – note that the data at this link changes regularly. I compared the most recent stats, from August 15 2011, to the oldest available, November 15 2010, an interval of nine months. The data is based on the most visited sites based on various lists and seems to amount to between 15,000 and 20,000 URLs.

In November 2010, jQuery was found on 39% of the sites, whereas Flash was on 49%. In August 2011, the stats show jQuery on 48% of sites with Flash on 47%, hence the press release.

Other figures that caught my eye: in web servers, Microsoft IIS has moved from 21% to 20%, apache from 51% to 49%, nginx from 11% to 13%.

Google analytics is the most commonly found script, moving from 61% to 63% of these sites. The amount of data Google receives on internet traffic is remarkable.

The real story here is the ascendancy of jQuery rather than the decline of Flash. If you want your website to work on Apple’s mobile devices as well as on desktop PCs, then Flash is not an option.

Adobe does not make money from the Flash runtime, which is free. It makes money from design tools and server-side services, among other things. Although it is good for Adobe if everyone uses its Flash client, it can still succeed in an HTML 5 world.

Flash has other roles too. Adobe AIR uses the Flash runtime on desktop PCs and some smartphones, and an iOS compiler lets you build Flash apps for Apple’s iPhone and iPad.

There is also some evidence that Adobe is tilting its efforts a little more towards HTML, with products including the preview of Edge which is a motion and interaction design tool for HTML5, CSS and JavaScript.