Creating an SPA with Polymer

I maintain a medium sized Microsoft Access application that is the operational system for a small business.  This business has offices in London, Birmingham Leeds and a copy of the Access application runs on PCs within the office system of these offices, allowing the staff to run the business.  A SQL Server database runs in the London office and all the Microsoft Access clients connect to it.

For reasons of confidentiality I wont give too many more details about the business, but this article and those that follow will concentrate on the technical aspects of creating a web based replacement that can sit alongside (but maybe eventually replace) the existing Access client.  The reasons for taking this path are both business driven and technical.  The key drivers are:-

  • Access is Windows only, but there is a desire to connect from other devices (such as iPads and Macintosh laptops).
  • Difficulties in distributing each new release of the Access client to all offices.  A web application doesn’t have this problem
  • Difficulties in doing multiple changes to the Access client simultaneously through lack of version control. The web application is essentially textual source code and can be version controlled (I will use git).
  • Ability to explore different UI approaches to existing processes to improve usability.

I am undertaking this project in the background, and expect it to take quite a while to complete.  For this reason, a key underlying driver is that the new and old applications sit side by side.

I have decided to build the web application as a Single Page Application (SPA) .  I did start this project before, about two years ago, and at that time started with JQuery Mobile.  A characteristic of this was I started to see quite large and complex files that would have become increasingly difficult to maintain.  The essence of using Polymer is that it possible to build relatively small self contained custom web elements, that comprise both the html user interface, but also the control logic surrounding it.  This encapsulation is what I am looking for.

The SPA will communicate with the database with small self contained PHP scripts called via AJAX requests.  They will use PDO to access the SQL Server database.  I could have chosen from a wide range of approaches, but this one is one I know and feel confident with.

My efforts at writing a series of posts to cover a project have, in the past, led to nothing.  I write the first post like this, then get dragged into the project and by the time I have emerged from the other side I have no desire to talk about it further.  This may go the same way, or maybe not.  Polymer, and web components in general, is a new technology that has yet to be fully explored.  I have some opinions about application structure and approaches that I hope to discuss in further articles.  Whether they see the light of day is another matter.  Lets just wait and see.

 

 

 

 

 

Author: Alan

I am Alan Chandler.

2 thoughts on “Creating an SPA with Polymer”

  1. True to form things change.

    I got a few of my top level files created – and had gulp running module and integration tests just how I wanted, when Polymer 0.8 came out and changed everything.

    I am waiting until I have more time next winter to continue with this, but I don’t fancy wasting the summer months writing code, when I could be outside enjoying the sunshine

  2. I look back at this and think “Where did the time go”. The summer turned into winter and I experimented with node.js to provide the server element. That allowed me to program the server in javascript. I then spent the following year (including the Summer) developing using Polymer 1.0 for the client and nodejs and specifically with the http2 module for the web server, and with “Tedious” module to connect to sql server. This all runs on a Raspberry Pi as the application server.

    I can produce both spreadsheets and pdf reports on the fly in the server, and I can even send mail using api calls from the client. This api is secured with Json Web Tokens (JWT).

    In addition I have written some extra node modules to do daily batch updates, provide a post code lookup simulator (that replicates an external service that we use in the production system but which we have to pay for. The simulator enables testing using a very out of date database).

    I am now about half way through the complete application and have learnt a lot about architecting the client as the application grows. How easy it is to let the client turn into a jumbled mess but that grabbing the code early and reworking it is a way out. So I am now adopting unidirectional data flow as an architectural tool to simplify things.

    I am aiming for the end of 2017 to complete things, but during the year I will expect to migrate from Polymer 1.0 to Polymer 2.0 and for node to have a native http2 module that I will have to migrate to.

    I have been documenting key information during development using latex.

    As expected I haven’t been blogging about it – its always easier just to get on developing the next bit, rather than taking time out to talk about it. I now don’t see myself as a blogger.

Leave a Reply

Your email address will not be published. Required fields are marked *