Application Development


Last week Smart421 once again was a sponsor at the Gartner Application Architecture, Development and Integration (AADI) Summit - this is the primary event in the UK Gartner calendar that covers integration/SOA, cloud computing, mobile, big data etc. Our marketing manager kept me rather busy with customer meetings throughout the event (!), but I still managed to catch some of the Gartner analyst sessions.

In the keynote, Andy Kyte made an interesting point about the barriers to SaaS adoption, in that organisations traditionally organise themselves along application lines (i.e. the System A team, the System B team…) rather than along domain lines (the “customer domain” team, the “product domain” team…). This relates nicely to our view of how organisations should develop their integration strategy over time. Anyway, although Andy didn’t use this term, this seemed to me to be yet another realisation of Conway’s Law, where individual team structures and the typical budget scraps over limited resources that they take part in put significant barriers in the way of the adoption of SaaS to replace existing legacy systems.

Ray Valdes presented on user experience design and gave a useful checklist of things to consider and the top 10 common mistakes to avoid. He made the distinction between design approaches led by intuition (“I know I’m right, trust me”) and evidence (“I’ve tried this and measured the outcome so I know it improves things”). I felt that the remedy to many of the top 10 mistakes lay in the application of the principles of the Lean Startup, e.g. test and learn, iterate quickly, validate your assumptions, collect metrics and feedback etc – although interestingly the intuition-based approach is more likely to lead to a innovation leap, whereas the evidence-based approach is more likely to lead to refinement and tuning of existing approaches but not such a large likelihood of a game-changing innovation.

On the Thursday there was the usual evening reception which was a lot of fun – this year we had some flair bartending on our stand from CocktailMaker – here’s an action shot… (Photo by Jim Templeton-Cross )

Gartner AADI 2013 stand

The cocktail guy did drop the bottle on the floor a few times following particularly ambitious throws but fortunately we didn’t burn the place down with any flammable liquids :) . As you can see from the photo below, our team (Neil Miles, the MD, and two colleagues from Business Services) are very smiley after knocking back a few cocktails…and Red Hat’s marketing approach at the event clearly worked!

Gartner AADI 2013 smiles all round

Photo: Industrial backdrop by Pilarts  Dreamstime Stock Photos & Stock Free Images

Photo: Industrial backdrop by Pilarts Dreamstime Stock Photos & Stock Free Images

I’d like to propose a best practice for rolling out new features in a Service Oriented Architecture (SOA).

Traditionally, when we roll out a major new feature, we often end up causing a breaking change to the service. We’re then faced with a choice: (a) Force all our consumers to upgrade to the new version, and making all our consumers hate us, or (b) continue to support the old version of the service as well as the new, making only our own teams hate us. Suck it up, plan (b) is the better option, but try telling that to the guy having to patch fixes in three concurrent versions of a service.

Now, there are patterns that can help here (more on that another day), but they all still mean more work for everyone.

Also, when we first roll out a feature is exactly the moment we understand it least. We’ve got absolutely no idea how people will use it, nor whether it will even turn out to be useful. By baking the feature into a new major version of the service, we’re taking all our options away. The feature will be hard to remove if we decide it isn’t useful, and if we want to change how it works, we’re back into a major version upgrade again.

To my mind, good engineering is largely about keeping your options open. It’d be nice if we can try a new feature with a subset of consumers first, iterating quickly with just that subset, gradually adding more consumers as we get more confident.

Enter the Feature Flags pattern. Feature flags allow you to turn features on an off at a moment’s notice. At its most basic, a feature flag just turns a feature on or off for everyone at once, but the idea is often extended to allow turning on features for specific users, or collections of users. This allows you to roll out a new feature to consumers gradually, over an extended period.

So, here’s the proposal:

  • Allow consumers to pass a set of feature flags dictating which features they’d like enabled in the service.
  • Whenever you build a major new feature that would otherwise cause a breaking change, only enable it when the feature flag is passed.
  • If appropriate to your environment, control access to feature flags like you would to any other resource – e.g. you might want to restrict access in the early days to just a single consumer, making it easier to iterate.
  • Once we’re comfortable with a feature, it becomes publicly available – i.e. anyone can toggle the flag.
  • Every so often (e.g. once every couple of years), create a new major version of the service, refactoring it to include popular, battle tested features by default. Also, take this as an opportunity to clean out the cupboard and abandon any features that aren’t well used.

What do you think? Comments and thoughts very welcome…

 

Please remember to Rate and Like this post.  If you can, please leave a Comment.

Wow! SyncIpswich’s second meetup and around 80 people crammed into the Eastern Enterprise Hub in the James Hehir Building at University Campus Suffolk. Many of the attendees were working for local behemoths like BT but there were also a good mix of bootstrappers, Start Ups and tech entrepreneurs with all kinds of backgrounds (even spotted a Chartered Accountant).

Organisers Carl Farmer (@CarlFarmer), supported by Anders Fisher (@atleastimtrying) and others have done a great job with SyncIpswich, which we are proud to sponsor. The focus of this meetup was on building software quickly with good practices as well as a nice introduction to the Windows Azure Cloud.

Talk no 1. Continuous Delivery

The first presentation by Chris O’Dell from 7digital (@ChrisAnnOdell) described how Agile practices (CI, Kanban, etc) combined with their architectural evolution to SOA have reduced code to deploy times to half a day  at 7digital.  And, by the sound of it, makes their developers more productive by getting away from “DLL Hell” that used to be the bane of any Microsoft Windows developer’s life towards a loosely-coupled set of services and a public API.

7Digital Logo

Chris raised some really interesting points around developing small fine-grained service components – not being that familiar with .Net myself this seemed to be similar to what we are doing in the Java world with OSGi and Service Component Architecture. I do like the policy of developing new features on the trunk (no feature branches) but making good use of feature flags rather than old-fashioned branch & merge.

They are also using Git for the code version control and Chris showed the inversion of the classic Unit Test, Acceptance Test, QA triangle. Some in our own organisation are raising question marks about the usefulness of very granular unit tests so the approach taken by 7digital of increasing the number of Unit tests is interesting.

There were a lot of questions from the floor, I was particularly interested in how the small kanban teams (about 6 or 7 members in 5 or 6 teams I think) interact when there are common services. This is a key problem that us SOA architects need to get right to get the best value on services. Feature Flags is something that we’ve also thought about in the context of simplifying application testing by, for example, switching off authentication for functional testing.

It’s great to see a company like 7digital competing successfully with iTunes and Amazon in the digital music space. I’ll be checking out their API (and their JLS back catalogue !) in more detail this weekend.

Richard Astbury AzureTalk no 2. Starting out in Azure

The second talk of the night was by Richard Astbury (@richorama) of Two10 Degrees ( @two10degrees). Richard gave a nice introduction to Cloud computing and in particular using Microsoft Windows Azure, showing a picture of a MS data centre under construction, which was something I haven’t ever seen before. I think it really brought home the sheer scale and commodity nature of the Cloud and these facilities being full of containers of kit that is just thrown away or recycled when it stops working.

Building a website on Windows Azure from scratch can use a few main pre-canned routes like the obvious “Website”, “Virtual Machine” and “Cloud Service”.

And it now includes a “Mobile Service” which is of particular interest to me. Sadly, I didn’t have time to chat to Richard about this but it’s on my “To Do” list to get a Hello Smartie mobile service up and running. In fairness, Richard did do two masterful demos for Website, including a node.js based site which he even launched from his home computer (a Raspberry Pi no less). As Carl tweeted:

Deploying to Azure from a remote RaspberryPi at home… Impressive stuff from @richorama !

— SyncIpswich (@SyncIpswich) April 25, 2013

Well done to the people of Ipswich for turning out and drinking all the sponsored free beer!
SyncIpswich will run and run.

Please Rate and Like this blog.  If you can, please leave a Comment.

Last night, I was one of 6 presenters who gave 5 minute lightning presentations at the monthly Front End Suffolk meeting in Ipswich.

I love the lightning presentation format as you get a really broad range of presentation topics and styles in a short burst – I first came across it at CloudCamp some years ago and we’ve used it internally in Smart421. Presentations covered Jasmine for JavaScript unit testing, use of make and accessibility considerations with links – a really good mix of thought provoking topics.  Thanks to Anders Fisher ( @atleastimtrying ) for organising the event and for the invitation to present. Great group Anders..

At the previous month’s FESuffolk meeting Paul Hutson presented on KineticJS (see his presentation here) and that got me thinking/comparing it with the work I’d done with YUI, especially related to collision detection – so I foolishly stepped up and offered to present on the topic. Here’s my presentation on SlideShare…

Please Rate and Like this blog post.  If you can, please leave a Comment.

Alloys

Which Essex boy doesn’t want Titanium Alloys?
Photo © Maxpro Dreamstime Stock Photos & Stock Free Images

Introduction to Appcelerator

I’ve had my eye on Appcelerator and their Titanium mobile development platform product for some time. So I grabbed the opportunity to venture north of the [Suffolk] border to the ”SyncFocus“ a SyncNorwich spin-off event that was held in the Garden House Pub, upstairs room, in Norwich last night (20th March).  So, reflecting on my rough notes, I’m posting this blog with a few random thoughts thrown in and some links to further information for those interested in javascript-based mobile developments.

This SyncFocus featured as guest speaker non other than Boydlee.  For those who haven’t heard of Boydlee, he is a mobile application development guru and specialises in the Titanium platform who, like Beyoncé, is now so famous he doesn’t need to use his surname :-) .

My “executive summary” is that Titanium is a serious productivity tool for people who can write “well written” javascript code. It is in competition with the HTML5-based approach of PhoneGap, and does not (yet) have as many surrounding services as IBM Worklight which is squarely aimed at the big Enterprise market and is not as broad in its coverage of operating systems and devices (yet). It does however, have a thriving developer community and a very attractively priced (i.e. “FREE” cloud service). It does appear to be very easy for a moderately skilled javascript developer to create apps but it’s probably just as easy to create a horrendous mess so the newest approach is to supply a framework as the well-known MVC pattern through “Alloys” – which Essex boy doesn’t want Titanium Alloys on their racer?

Main points:

  • Titanium is purely JavaScript library coding against the Titanium api, the platform compiles the source to native Objective-C or Java code for the iOS and Android Apps and can easily be linked with the Xcode or Android SDK to complete the builds.
  • Links with emulators for iPhone, iPad and Android
  • Appcelerator has over 400,000 registered developers worldwide (a counter on their home page tells me it is just under 430,000 today)
  • The libraries themselves are “Free and open source”, available on GitHub
  • However, the Titanium studio is not free, and you can take the Appcelerator Paid support
  • An estimated one third of cross- platform apps are built on titanium
  • Claims to also support BlackBerry 10, but Windows 8 is not available until later this year

One really nice feature is a very large “Module marketplace” which is mostly compiled binary code aimed at one native operating system or the other that can be downloaded and incorporated into the build – for example something to integrate to native libraries, plugins, e.g. Barcode scanning

A lot of those modules also have their source code on GitHub, building the community even more and improving the eco-system. This appears to be thriving and also includes some javascript extensions as well as the compiled native iOS and Android libs.

Appcelerator Mobile Service (ACS)

ACS is an interesting move to give a free level of Mobile (application) Back-end as a Service (MBaaS) to developers of services, running on AWS.

This includes 20GB storage, 5m push, 5m api and 20 pre built common services, including key-value pairs (similar to AWS Simple DB), Ratings, Geo services, media, including thumbnails, Social integration (Facebook) and storage of custom objects, which I think was based on Mongo DB as a service. There is certainly capability to link directly with Node and Mongo backends and simple stuff like SMTP integration (again similar to AWS’s Simple Email Service “SES”).

Coding practices

Boydlee recommended looking into Common.js best practice for relative newbies to Javascript. Other frameworks are available, like backbone, require.js and one of his blog posts has recommended the javascript patterns book by Stoyan Stefanov.

There are also free books online available on styling, including best practices to cascade for tablets so you don’t just get an enlarged phone experience that sucks.

The CSS approach also over-rides for different devices, so it’s not always best to stick with pure javascript for everything, however, for those who really are blinkered by javascript there is a CSS to JSON converter library.

Boydlee’s books are on PACKT or there are kindle versions. Boydlee’s best practices book is one I will be getting for sure.

Finally, the newest developments in Appcelerator will probably be using Alloy which includes full Model View Controller (MVC) frameworks (again, all built on well-known javascript frameworks) that claims to speed up App development by another order of magnitude.

Comparing it with the IBM Mobile First offering the coverage of mobile O/S is much wider in Worklight (Windows 8 and BB 10 were available very soon after launch), the adaptor environment, the upgrade management and enterprise app centre seem more developed and you have the whole extra wrappers of security, analytics and so on within IBM’s Mobile offering. The customer list on Appcelerator’s website is mighty impressive for consumer-oriented Apps but the ability to integrate with Enterprise back-ends is less of a focus, which is why in our case we’re focusing on IBM for Enterprise mobility but Appcelerator is certainly worth considering.

Please Like and Rate this post.  If you can, please leave a Comment.

AWS

In my previous blog post on using AWS CloudFormation to provision a Centos based environment I mentioned how at first the JSON syntax used within CloudFormation templates can be a little daunting, especially for people with limited scripting experience.

At the time of writing the blog I was using a combination of   Notepad++ with the JSON Viewer Plug-In to create and maintain my CloudFormation templates. One of the problems I had with this approach was that the templates are treated as pretty basic text files by Notepad++ and the JSON Viewer Plug-In only checks the base JSON syntax, so there is no validation of the objects defined in the JSON to ensure that the correct properties are being creating to allow the template to form a valid CloudFormation stack.

As an early Christmas present to anyone working with CloudFormation AWS recently announced the introduction of a new CloudFormation editor as part of the AWS Toolkits for Visual Studio and Eclipse. I have now had a chance to download and experiment with the Visual Studio version of this and am really impressed with how much easier it makes the creation and maintenance of CloudFormation templates.

As a .Net developer I have grown used to regularly relying upon IntelliSense features to aid with code creation, particularly when it comes to accessing and updating object properties. The CloudFormation editor provides this for the objects defined within a template as well as code snippets for all the object types you might want to define within your template. This greatly reduces the number of errors caused by ‘finger problems’ that used to occur when creating a template by hand.

The other really useful feature of the editor is the ability to estimate the costs of a stack before creating it. In the past when quoting for customers we have tended to pull together a design, plug the figures into the AWS Simple Monthly Calculator and then once we have received the go ahead provision the environment. With the ability to create costs from a template we are now looking at generating a base template at the design phase and then costing and building from this, which should help with the speed of environment creation and clarity around the prices for altering the design.

Based on our experiences so far  it’s a big thank-you to AWS Santa and his helper elves for the early Christmas present of the CloudFormation Editor and we are all looking forward to further presents from AWS  throughout next year :-)

DATABASE at Postmasters, March 2009DATABASE at Postmasters, March 2009 to Michael Mandiberg

“NoSQL” is an unfortunate term for the currently hype around non-relational database systems. Many of the ideas presented at the NoSQL Roadshow in London of the new wave of different databases are not new. More than one presenter used the term preSQL, and during a break Brian Bulkowski from Aerospike explained that Oracle had created these ideas many times over, but had not considered them commercially worthwhile. What has changed in recent years though is the business need. There are new problems to solve such as online and mobile gaming and advert-serving that require users to trade-off consistency, availability, and partition tolerance.

For example, Amazon require a horizontally scalable system (partition tolerance), so that when, and it can be any time of day, a customer adds an item to their shopping cart, it is captured in the database (availability). They are less concerned about the time it takes for this to filter through their other data stores (eventual consistency), or how long it takes to fulfil the order. In the mid-2000s Amazon realised that the current relational database were not meeting their needs and they created Dynamo, a highly-available and scalable technology for key-value storage.

Papers by Amazon on Dynamo, and Google on their technology BigTable, were a major contributor to the current early adopter market. Today there are many competitor NoSQL products, including the aggregate-oriented databases (key-value stores, document stores and column stores), and graph databases.

Key-value stores are the simplest store type, with keys mapping to binary objects. They allow low-latency writes and scale easily across multiple servers, but can only offer single key/value access. David Dawson and Marcus Kern of MIG gave an example of using the key-value store Riak as a persistence store for a bespoke queuing system in their SMS gateway product. The biggest difficulty was finding a way to simplify the retrieval of messages in the event of a node failure; their solution involved the use of predictable keys.

Column stores manage structured data, stored in columns, with multiple-attribute access. Apache Cassandra, originally developed by Facebook, is a well known example. These are also optimised for writes and used for high throughput uses such as activity feeds or message queues.

In document stores keys are unique references to “documents” which encapsulate and encode data in a standard format. These database systems hold hierarchal data structures that reduce the need for table joins and allow for variety and evolving schemas. Akmal B. Chaudhri of IBM presented his investigations into the popularity of the various NoSQL offerings, showing that MongoDB, a document store for JSON documents, is leading the way. Some of our Smart consultants are using MongoDB from an application development perspective and are very positive about their experience so far. It will be interesting to follow these projects and understand the effects on administration, support and future change. What impact will the schemaless nature of the database have?

Graph databases use the concept of nodes and edges to store information about entities and the relationships between them. Jim Webber of Neo Technolgy gave an example of the use of the open source Neo4j graph database in modelling the relationships in Doctor Who.

Each type of database system has its own strengths and weaknesses, and the reality is that NoSQL databases will only be used as part of a solution. Choosing different data storage techonologies for different persistence needs has been termed polyglot persistence. Every example provided at the roadshow included relational database systems alongside NoSQL technology. Wes Biggs of Adfonics, an independent advertising marketplace, explained the architecture of their solution for buying advertising on mobile devices on behalf of advertising agencies. They use the relational MySQL with data on hard drives for long running information such as campaign details, MySQL Cluster with data on flash drives for aggregate instructions such as user details, and Aerospike with data in RAM for raw instructions such as the inflight data.

The overall message from the NoSQL Roadshow was that this is still very early days for NoSQL database systems, and it is not yet clear whether the future popularity will be closer to that of OO or relational databases.

Many presenters offered words of caution. Security is a big issue and many of the major NoSQL database systems must be run in a trusted environment. Wes Biggs discussed the issue of the huge number of vendors and the lack of evidence for their claims. At this moment any system choices are basically faith based, and should only be taken if someone else has used it for a similar use case; they were burned with a few early choices for a key/value store before they settled on Aerospike.

The Fusion-io presentation on their new directFS filesystem for flash drivers was only one example with obsession with performance, and the importance of the hardware architecture.

At the moment there are some exciting potentials for NoSQL technology, but anyone getting involved at this stage will be making some brave choices. It will be fascinating to see how the market shakes out over the next few months and years and I’ll be following with interest.

Update: 18 Dec 2012 – interested to learn more about MongoDB ? Click here.

Please Like and Rate this blog. If you can, please leave a Comment.

Top of the City Room

Top of the City Room

Jeremy Clarkson, Richard Hammond, James May and other petrol-heads are obsessed with figures about performance from 0 – 60 mph in n seconds. For those who don’t understand why, the figures celebrate engineering design and manufacturing achievement.

So here is another performance figure for you…  from 0 – 400 members in 6 months.

Ignite talk presenters

Ignite talk presenters take questions and answers

This milestone number is significant and also deserves to be marked.

You cannot fail to be impressed with the achievement made by the the five co-founders of SyncNorwich, the geek-friendly interest group which was only launched 5th July this year and which has already proven to be a big hit with start-ups, developers and technologists from many tribes..

Last week’s meetup in the Top of the City Room at Carrow Road (home of Norwich City Football Club) showcased all that is good about this particular group. For example:

  • The hospitality was warm and welcoming
  • The venue was courtesy of a great Norwich company, Aviva
  • The beer was free
  • The geek factor was limitless (and almost off the scale – no names, won’t tell)
  • The raft of presentations were varied and inspiring in the main, and humorous in all the right places
  • The standard was high
  • The networking was quality and relevant
  • The entertainment was… er, well, entertaining (table-top ‘robot wars’ went down well)
  • The spirit of collaboration and enterprise was genuine and strong

146 people made it. The place was buzzing. 

When it comes to numbers, it was the best turnout to date. And probably indicative of the interest levels surrounding this group.

syncdec (51 of 118) cropYes, of course the core members were there in force. I spoke to many of them on their way in. But I also spoke with people who had travelled in from some distance to find out for themselves because, some way or another, they had heard about SyncNorwich.

For a recap on the evening, I can’t find a better the account than the one on Paul Grenyer’s blog so recommend you visit…  after you’ve finished reading this post.

Mark Page at Aviva deserves a medal for his part in helping to bring together so many people from Aviva. They have a big contribution to bring to a group like SyncNorwich and it would be tremendous to see more of them joining in as much as possible.

And so…

The future looks very bright for SyncNorwich and for the tech community in Norwich as a whole.

Rob Houghton of Aviva

Rob Houghton of Aviva

Already with a packed future calendar in place, starting 02 January 2013 with the January lunch and  24 January 2013 with the monthly meetup, and a full day conference lined up for 15 February 2013 (see SyncConf.com ) SyncNorwich has filled a gap that has been vacant and needed for too long.

All we know is that it’s been our pleasure to support SyncNorwich with sponsorship from its launch in July. Supporting the initiative and the co-founders in the early stages has been the ‘right thing to do’. Getting support in the early stages is never easy but when it comes it means so much.  We know – once upon a time, we were a tech start-up (read our company history).

And we have been pleased to see how SyncNorwich’s magnetic personality has attracted a host of others. The roll call of sponsors is growing. Room for more too.

But the final word belongs to the people. It has to belong with the people because that where it all starts.

SyncNorwich, perhaps above all else, is a tech /dev group “for the people, by the people”.  The members are front and centre of everything. And that’s what makes it great.

And as “one of the people” we’re pleased to be a small part of it.

Table-top robot warsIf 6 months is all it took for 5 founders to ramp SyncNorwich from a standing start to 400 people, what does that tell you about the UK IT sector?

What this tells us about the UK IT sector is that it is bristling with talent and entrepreneurial ambition. It tells us that in the East of England there are concentrations of outstanding professionals. We work for some of them (not enough of them!). Some of them work for us  - and we’re still hiring).

Perhaps the SyncCity concept will be the shape of things to come for all tech start-up / developer groups? It certainly seems like a good model. We’ll find out soon enough.

Have you heard? – there’s talk of SyncIpswich coming in March 2013.

And on that bombshell… 

Related Links Twitter:  @SyncNorwich
Read the feed:  #SyncNorwich

All photos by kind permission of James Neale Photography

Please remember to Rate and Like this post. If you can, please leave a Comment.

I had my first real experience of mobile train ticketing today. The Greater Anglia mobile app on Android has the capability to purchase single tickets which come with a mobile barcode (QR Code) that you activate as you get on the train (or just before you pass through the barrier if there is one).

As a long-time follower of mobile technologies this was actually an exciting moment for me. The purchase process was pretty standard last night – choose the trains to travel outward and return and buy the ticket.

I used the app for the first time last week and successfully collected my ticket at the station using the RSP Ticket-on-Demand (ToD) functionality that I happen to be working on… but this time, looking at the ticket options, the return was actually more expensive than two singles so I went for the two singles. It was only then that I noticed the option to buy as mTickets! So that’s what I did.

I’m fairly sure this app comes from Masabi who are leaders in the UK on mobile ticketing apps – see their description for how mTicketing works

There are obvious advantages of mobile tickets over conventional paper tickets (no need to print them being one) but there are also in my opinion a lot of advantages for train companies and businesses using the trains for travel.

There are also questions that arise: what if my mobile battery dies? What if I forget to activate it at the start of my journey? How does it cease to be active? Checking the Greater Anglia Terms and Conditions there are some answers (extract reproduced verbatim below)

… you must check that your mobile phone is compatible with our tickets by downloading a test ticket where indicated prior to purchase.

It is your responsibility to ensure that you carry your mobile phone on the relevant journey and that your phone is charged, functional and that you are able to display the ticket for inspection when you travel.

Due to the wide variety of mobile phone handsets and networks we are unable to offer technical support or assistance.

You may incur data usage charges from your mobile phone operator for downloading a ticket. You should check with your network provider as to what charges may apply.

I also noted this extra requirement which still links to a payment card:

For identification purposes you must also carry the credit/debit card used to make the booking.

It appears that currently there isn’t much recourse if you do lose or forget your phone:

We shall not provide duplicate or replacement tickets. The ticket must be stored on your mobile phone until the date and time of travel and such safekeeping shall be your responsibility. M-Tickets are non-transferable.

By purchasing a M-Ticket, you agree to cooperate with the train inspector and let him/her clearly view the ticket on your mobile phone and you acknowledge that you may be requested to hand over your mobile phone voluntarily for inspection. If you do not produce your ticket or hand over your mobile phone upon a request to do so by the train inspector, the train inspector shall be entitled to consider that you are travelling without a ticket.

Fortunately, my experience was very positive.

On the outward journey the 12:19 train was a couple of minutes late so I activated the ticket as it came in at 12:20. The first interesting thing to note was that it was taking the time from my phone (as it put up a message asking me to check my phone clock was correct).

Image

The second interesting thing to note was that the place where the “Activate Ticket” button had been replaced by an animation of the current time against a colourful background. I’m not sure, but assume the colours are to prove the App is real and not some kind of spoof as anyone with a moderate knowledge of HTML could quickly spoof a ticket otherwise.

When the conductor/guard/whatever they are called these days appeared he took some time to study my phone before saying it was fine. The App does generate a QR Code but he said they hadn’t got the equipment to scan them yet so this is technology leading the way it feels like.

As of this moment, 9 hours after my journey completed, the mTicket still seems to be active on the phone so it doesn’t look like the App times out a ticket (UPDATE: It seems to time out overnight as it showed “Expired Ticket” the next morning.

There are plans to introduce interoperable centralised fulfilment and centralised, real-time validation through the Rail Settlement Plan (RSP) modernisation programme but in the meantime if you’re willing to take the plunge and try out new ticket Apps it would appear that there could be some good prices available for mobile tickets and for the convenience alone it is worth checking out.

Having recently spent time working on the IBM Worklight platform, I thought it would only be fair if I documented some of my findings. No disrespect to the IBM’ers, but its reasonably fair to say that documentation is a little sparse in places, so lets give a little back to the community by discussing some of the hurdles. Lets not dwell on what Worklight is, Andy has already covered this well in a previous post; but lets just dive right into some of the technical aspects.

General Thoughts

Development on the whole is a relatively straightforward process, even for someone like myself that often steers well clear of anything that involves web presentation technologies (it reminds me of dark nights at the university labs spending hours trying to get a button to align correctly, the night before coursework submission *shudder*).

The Worklight eclipse plugin provides a good drag & drop GUI builder, but with support only for dojo. I opted to drop dojo and go for jQuery. jQuery is very well documented, and is easy to get help should you require it. One of the main things I like about jQuery is its showcase and examples, they are documented very well and the learning curve is generally quite small, but also the themeroller, it becomes incredibly easy to customise the default colour scheme and drop the generated CSS into your app. It always amazes me how excited the marketing guys will get if you can add in the corporate colour scheme to your app (thanks Joseph!).

Continuous Integration

We’re big fans of CI here, so I was quite keen to understand how easy it would be to have our Worklight apps built from the command line, and ultimately on a Jenkins CI box. The chaps over at IBM have done a fantastic job of exposing an array of Ant tasks that help with building and deploying apps, you’ll almost certainly want to read through module 42 on the getting started page that covers these tasks:

  • adapter-builder – Use this task to build your adapter and create the .adapter file
  • adapter-deployer – Use this to deploy a .adapter file to a Worklight server (very  useful for deploying to a remote AWS instance)
  • war-builder – Use this to build the server .war file that you will deploy to the application server (some manual tweaks are required)
  • app-builder – Use this to build the .wlapp files that you will deploy into your Worklight container
  • app-deployer – Use this to deploy your .wlapp files onto a Worklight server (useful again for remote deployments)

Lets have a closer look at each of those targets, and how we’re using them here at Smart421:

Getting the party started, with init

Firstly, grab the worklight ant jar (you’ll need to have purchased the WL Enterprise edition for this) and add it into your ant context like so :

<target name="init">
 <echo message="Loading ANT Tool"/>
 <taskdef resource="com/worklight/ant/defaults.properties">
 <classpath>
 <pathelement location="./build-config/worklight-ant.jar"/>
 </classpath>
 </taskdef>
 <property environment="env"/>
 </target>

Now you’re free to use the ant tasks anywhere in your build script.

Building & Deploying WL Adapters

You need to build each adapter individually, and then deploy each one. You can create the following ant targets to do that for you:

<target name="buildAdapters" depends="init">
 <echo message="Building all adapters"/>
 <adapter-builder
 folder="./adapters/TwitterAdapter"
 destinationfolder="./bin"/>
 <!-- Build your other adapters here, same as above-->
</target>

<target name="deployAdapters" depends="init">
 <property name="WLSERVERHOST" value="http://my_aws_ip_here:8080/SmartConf"/>
 <echo message="Deploying all adapters"/>
 <adapter-deployer
 worklightServerHost="${WLSERVERHOST}"
 deployable="./bin/TwitterAdapter.adapter"/>
 <!-- Deploy your other adapters here, same as above-->
</target>

Building the Server WAR

You can build the server war file using the war-builder task, as shown below. It is important to note however, that I needed to do some tweaking to the war file to avoid any post-installation configuration tasks. According to the Worklight forums, there doesn’t appear to be a way to include files in the WEB-INF when the war is created, which means that once you’ve expanded the war on the application server you’d need to manually replace the default web.xml and context.xml files (to set your datasources), this can be quite frustrating, so in true Blue Peter fashion, I’m updating the war file with files I created earlier.

<target name="warBuilder" depends="init">
 <echo message="Building the war file"/>
 <war-builder
 projectfolder="./"
 destinationfolder="./bin"
 warfile="./bin/SmartConf.war"
 classesFolder="./bin/classes"/>
</target>

<target name="updateWar">
 <echo message="Updating the war file"/>
 <war destfile="./bin/SmartConf.war" update="true" webxml="./build-config/web.xml">
 <metainf dir="./build-config" includes="context.xml"/>
 </war>
</target>

Building & Deploying the WL Apps

You’ll also want to automate the building and deploying of the wlapp files, you can do this with the following :

<target name="buildApps">
 <echo message="Building all WL Apps"/>
 <app-builder
 applicationFolder="./apps/Smartconf"
 nativeProjectPrefix="SmartConf"
 outputfolder="./bin"/>
</target>

<target name="deployApps">
 <property name="WLSERVERHOST" value="http://my_aws_ip_here:8080/SmartConf"/>
 <echo message="Deploying all WL Apps"/>
 <app-deployer
 worklightServerHost="${WLSERVERHOST}"
 deployable="./bin/SmartConf-all.wlapp"/>
</target>

Building the Native Application Distributable Binaries You’ve survived this far, and I’m thankful to you for that, however we’re not quite finished yet. Worklight will generate the native projects for you, but its your own responsibility to take those project directories and build the Android APK, or the iOS IPA etc. IBM will draw the line at this point, so you need to build them yourself, you can do this for all of the environments quite easily using additional ant tasks, android is the easiest :

<target name="client-android" depends="buildAndroid">
 <!-- Run the android native build, in its own directory -->
 <ant antfile="./apps/SmartConf/android/native/build.xml" target="release" useNativeBasedir="true"/>
 <!-- Copy up the apk into the bin area, for consistency -->
 <copy file="./apps/SmartConf/android/native/bin/SmartConf-release-unsigned.apk" tofile="./bin/SmartConfSmartConfAndroid.apk" overwrite="true"/>
 </target>

Building Blackberry and iOS apps from the command line is slightly more involved, and I feel they warrant their own blog post on that, alternatively, get in touch and we’d be glad to offer some assistance. Bear in mind you will need an Apple MAC to build iOS, for which we’ve installed a shared box in our build environment.

Other Gotchas

As with taking on board any emerging technology, there will always be plenty of head-scratching moments where the documentation is thin, and Uncle Google doesn’t provide much help, fortunately for you, we’re a nice bunch of guys here at Smart421 so we’ll share some of the things that had us pondering over a coffee:

  • The trailing “/” in the Worklight server host URL is required, don’t ask why, it just is.
  • The versioning conventions for Worklight are a little strange5.0.0.270 = v5.0 GA, but the developer edition is 5.0.2.407-developer-edition = 5.0.0.3.
  • If you have an existing 5.0.0.2 WL server installation, don’t upgrade it to 5.0.0.3, it fails to upgrade all components and leaves you with some obscure error messages that are hard to trace. The best plan of action is to uninstall, install again, but make sure you check for updates at time of installing, via the wizard
  • App crashes with Unreachable host? When you build and deploy the app to your device, it has the WL server IP hardcoded into it. The next day when you arrive at the office and hop onto the Wifi, DHCP gives you a different IP address…It’s a classic schoolboy error, but catches us out from time to time. A simple solution if you don’t have a spare box lying around is to install the Worklight server on AWS and deploy to the cloud, bearing in mind that it needs to be open to your mobile devices over the Internet in a real-life installation anyway.
  • Results is undefined on adapter call. A subtle difference here, HTTP adapters use invocationResult.results, whereas SQL adapters use invocationResults.result. That last character makes all the difference.
  • Response cannot be parsed, please contact support; this is an annoying error that you often see in the developer preview, just make sure you set the body onload to WL.Client.init() as mentioned here.
  • Unable to use geolocation services on android? You’re probably seeing Caught security exception registering for location updates from the system, this should only happen in DumpRenderTree. Make sure you have the geolocations permission in your android manifest as detailed here.

Conclusion

On the whole, I was very impressed with Worklight, they are offering a lot of functionality over and above the standard Cordova project. Some of the errors I’ve encountered have been a little frustrating, as often my only source of help was the forums, but I can accept that it is a product in its early stages of adoption, and will probably go very far. I’m looking forward to working with it in the future.

If you’d like to have a look at some of the apps we’re creating, or generally just want a chat about Worklight and some of its capabilities, or Mobility in general, we’d love to hear from you.

Next Page »

Follow

Get every new post delivered to your Inbox.

Join 808 other followers