Reign of the Front End
The first paid project is a system to support sales functions of an established firm in the nutritional supplements space. The system is essentially an add-on to an existing CRM system. It uses the APIs to discover incomplete orders in the CRM system, then issues reminder emails to the prospects, and provides a convenient single-click method of completing those orders.
The second paid project is a multitenant SaaS in the eLearning space. The goal is to create a minimum viable product (MVP) to serve as a beta, and potentially to attract seed capital. This eLearning project has consumed most of my attention this year, and the challenges I have encountered are the impetus for this post.
We have little choice but to allocate more engineering bandwidth to the UI. Applications that look like they were designed before the tablet revolution will go the way of the dodo bird.
In the nine months since my last post, I’ve been immersed in the front end. I have come to see myself as a curator, scanning the globe for best-of-breed open-source offerings to facilitate our ambitious UX. Our front-end stack currently includes:
- Bootstrap 3-LESS
- Bootstrap Context Menus
- Bootstrap DateTime Picker
- Bootstrap Switches
- Bootstrap Tags Input
- Jasny Bootstrap Extensions
- jQuery Sortable
- jQuery Touch Punch
Evaluating open-source offerings can be time consuming. Bootstrap and jQuery add-ons tend to be in a constant state of flux as developers struggle to maintain compatibility with other systems, while simultaneously dealing with bugs and feature backlogs.
There are competing offerings, each with strengths and weaknesses. It can be helpful to first research what other developers are saying about the tools, and to take into account the sizes of their user bases.
Be forewarned that choosing any tool will entail compromises: some features may work great but at the expense of others. You have to pick your poison.
The Meteor Blaze release has been lauded as the solution for reconciling Meteor with jQuery. If you are not aware of the issue, it boils down to this: both Meteor and jQuery-based offerings want to control the document object model (DOM). When conflicts occur, you must intercede. Earlier versions of Meteor had template directives to allow you to declare certain areas of your web page constant (i.e., off limits for Meteor’s reactive updates). This would allow you to use tools such as jQuery Sortable, albeit foregoing reactive updates for constant regions.
The Blaze release is widely believed to have reconciled Meteor with many jQuery-based tools, but it is only a first step. The Meteor development team deprecated the constant template directive, implying that Blaze has solved the problem completely. I can say with considerable authority that this is not true. I have spent hours reconciling the behaviors of tools such as jQuery Sortable and Jasny Bootstrap with Blaze. I have reported issues to the Meteor development team and they have graciously acknowledged them.
Notwithstanding, Blaze is an enormous improvement. But there is still work to do to make it truly seamless, and until then UI developers will face extra effort, in some cases patching jQuery tools to get them to work correctly with Meteor.
Desktop computers and touch devices have different event models. jQuery Touch Punch provides a means to convert touch events into traditional events so the same code can work on desktop and touch devices. But even when using Touch Punch, you have to be careful about the set of gestures your application supports. For example, there is no obvious gesture corresponding to right-mouse-click on a touch device, even though right-mouse-click is the standard event to display context menu or properties on desktop apps. This means that a modern web application will tend to avoid context menus, or at minimum provide a touchable icon (i.e., button) to display the menu, for example, a down-chevron, which seems to be all the rage these days:
The down-chevron should not always be visible, but should appear only when the division that contains the menu is “hovered” over or touched. I refer to this as a hover control. This clutter-resisting design pattern has been made popular by Facebook.
There is no touch equivalent for double-clicking, so that gesture should be avoided entirely.
Other differences include the absence of movable dividers (sashes) in the touch world, and the fact that drag/drop gestures must be reconciled with scrolling: in the touch world the two gestures can be ambiguous unless explicit “handles” are designated for dragging.
A modern web site must work well on desktop and touch devices, and with all popular browsers at any screen resolution. Bootstrap is helpful for coping with differences in screen sizes, but it is no panacea. Media queries can help in limited cases by targeting CSS rules to particular devices, but complexity grows with each exception added; therefore, it is necessary to code your HTML and CSS carefully and test frequently to avoid changes that break the UI on one or more platforms.
Consider this: the popular website JSFiddle is loaded with tens of thousands of hacks to beat the browser into submission. That such a web site is even necessary speaks volumes about the current frustrating state of affairs.
Occasionally, when I complain about this, some hot-shot UI developer will respond “we use LESS” as if LESS somehow ameliorates these issues. The implication is that the problems are attributable to the CSS language; unfortunately, the problem isn’t the syntax of CSS, it is how browsers interpret the rules, particularly in complex cases with heavily nested divisions and dealing with issues like dynamic resizing, justification, visibility, scrolling and truncation.
We use LESS for all of our projects, specifically the advanced configuration offered by package Bootstrap-LESS. But LESS doesn’t address the core issue: the difficulty of finding the magic set of rules that will yield the desired dynamic-resize behaviors. Your pages must behave beautifully on any desktop or mobile device, at any size.
CSS requires discipline and continuous refactoring. The never-ending battle to keep your CSS DRY (don’t repeat yourself) is thankless. Unless you pay careful attention to class naming conventions and rule granularity, your CSS can spin out of control. Seemingly innocent changes will begin to have unwelcome side-effects.
Lately, I’ve been adding detailed comments to my CSS. Whenever I code a complex set of rules to overcome some layout issue, I write comments as clearly as possible to explain the intent of those rules, particularly in cases where the intent is to circumvent a browser bug. When the CSS has to be changed, comments regarding the original intent can help minimize costs.
The Front End Remains the Same
Last year, I went on a quest to find the best full-stack framework to develop modern web applications. I evaluated Ruby on Rails, Grails, ASP.NET and Meteor/Node.js. I imagined that I would find the best framework, try to learn it inside-out, and then use it to develop exciting applications.
When Will Our MVP Be Ready?
Notwithstanding great tools, project durations can be difficult to estimate, because no one can anticipate the snags that will arise. One thing is predictable: a given project will take longer than one would wish. A modern web site that works beautifully on all devices and has cutting-edge behaviors will be expensive.
Today, one factor seems irreducible: the cost of research. When you embark on creating a new subsystem that requires advanced behaviors, you’ll be forced into research mode to evaluate open-source offerings or custom coding. When you run into a snag, such as unacceptable behavior on some device, you will have choices (1) ignore the issue (2) consult with a knowledgeable colleague (3) fight harder by Googling, looking at the source code and experimenting.
In research mode, it is difficult to estimate how long it might take to find a solution. To estimate the cost, you must rely on your instincts, comparing each new challenge to similar challenges in the past. Sometimes you get lucky, but more often you don’t.
Today, it may be drag and drop. Tomorrow it may be streaming video. The next day you may be working with 3D graphics in WebGL. You’ll have to learn many APIs, and use them defensively with robust error control and graceful degradation. Your system is not an island but an amalgamation of services, each of which is another potential point of failure.
We are all constantly learning. What we don’t know today, we will learn tomorrow. We must look at new challenges with a sense of wonder, with the eyes of a child. We must take the time to help and support one another, to share what we have learned.