Is it still possible to muddle through?

I was reading this article while waiting for some code to deploy this morning, and a couple of sentences really leapt out at me...

The British way is to muddle through on the basis of vaguely understood traditions and conventions. Our entire culture, from our political constitution to the way we queue, is based on that principle of minimal principles.
— https://www.theguardian.com/commentisfree/2017/sep/18/level-playing-field-commuters-british-green-lanes-tube

The same has been true in the IT world, or at least my IT world, for the longest time. Getting code from my machine into production is never a consistent process. It depends where I'm working, what regulatory framework is in place, what technology is being used, how advanced the organisation is.

In my current job we use a lot of the latest and greatest technologies: node.js, microservices, Docker, Kubernetes, Splunk and so on. And the philosophy we try and adopt is called "build, run, own". That is, you take ownership over every element of the code you write, from conception through to support. 

It's a good theory, but every so often we get stuck. I do own my code, but someone else owns the Kubernetes platform, a different team is responsible for splunk and they don't all necessarily do the right thing, especially in test environments. In some environments I'd have the ability work around these sorts of problems - muddling through - but it is not possible in this highly connected architecture where various elements present themselves as black boxes. 

It makes for some interesting challenges and dependencies and means that muddling through is no longer an option. The positive is, or at least should be, that, because we have to do everything within well known, tightly defined constraints, that when my code finally reaches production it is far more stable.

Evernote to Bear

I’ve been an Evernote user for years. But recently it’s been an on and off thing as I get more and more annoyed with their service. The problem is that I keep trying to find something that will do everything I need, find a tool that I think might work and it never quite does so I crawl back to Evernote with my tail between my legs.

The issues with Evernote are several, I use it all day long for note taking in meetings, writing blog posts, planning out code changes and so on. Over time, the software has just become a bit too bloated, the editor doesn’t support Markdown which is de rigueur these days, and then there’s the pricing changes, the data leaks. Basically, if I can find something better then I will jump ship.

Well, I think I may have finally done just that. Bear is a much cut down note taking tool, it syncs beautifully across Mac / iOS, supports Markdown and it’s a really nice text editor to use.

The only issue I struggled with so far was bringing across tags and notebooks from Evernote. There is no concept of a notebook in Bear (that I can see), but you can "sub tag" content. So you'll need to work out a strategy to bring across your Evernote documents. For me it was a case of doing it a notebook at a time, but YMMV.

So, for the moment, this is what I’m trying out. Do you have any better suggestions?

Do you know what your users are doing?

There are levels to this question. I'm sure most of us that run web apps know to some degree what our users are doing, but, if you have the need, you can find out in real detail what they're doing and in what order.

Obviously there are paid tools, entire companies that make this their business such as SessionCam. And what they do is great if you have the budget. But what about for those of us with slightly smaller wallets?

My usual approach to the problem these days is to use Google Analytics (or GA as it is inevitably shortened to). I suspect most people know that you can drop a simple GA JavaScript file onto a web page and any visits to the page will be automatically recorded, analysed to identify what type of user is visiting so that you can get a picture, even real time, of traffic to your site. 

What's maybe less well known is that you can actually use that GA JavaScript to record events on your page so that you can really drill down into what is happening once the user loads the page.

ga('send', 'event', 'MySuperPage_OKButton', 'Clicked');

If you add the above line to the onclick event on a button on your page then, in your GA analysis you'll be able to see how often that particular button is clicked. And, really, you can track everything that the user does, every single key press, click and page load. 

Well whoop-de-do you might say. That's a lot of data, but what use is it? Well, imagine you're adding or testing a new feature, wouldn't it be good to know how often it's actually being used. Or you may need to keep an eye on the volume of usage for a particular feature. Or your management may want to understand better how far through a process people are getting before dropping out. The point is that having more data is very rarely a bad thing and the development cost of adding this to an application is surprisingly low.

The question really is why you wouldn't do something like this for an application.

Oh, ah-linting I will go

Often when I talk with developers who are firmly in the C# or Java camp their main objection to JavaScript is that it’s not strongly typed. And indeed, if you’re new to the world of JavaScript, this is a big thing to get over.

But there are strategies, best practices if you will, which can make the transition easier. One I thought worth mentioning is ESLint. This is a process whereby you statically validate your code to make sure it adheres to a set of rules you define. These rules can be as lax or strict as you like, but, applied properly they make your code more supportable, more readable and less error-prone.

So, how to get started I hear you ask? A lot depends on your working environment. If you use a modern editor like VS Code, Atom or Sublime Text then there will be a plugin you can install to help you along. In your project, you add a .eslintrc file which defines the rules you want to apply and then you look, with horror, at the hundreds of errors that have suddenly appeared in your code.

But fear not, things aren’t as bad as they appear. Your ESLint plugin will probably have a command to automatically fix “easily fixable issues” such as using single quotes rather than double quotes for strings, or indentation of your code. Once these are all addressed you can fix the rest of the issues manually, and relatively quickly.

I’ve recently completed this exercise with a large code base primarily because we want to put some focus on performance: if I have code that is predictably organised, then this makes the process a lot easier.

A great side effect is that the rest of the developers on the team can pick up the code I’ve been butchering and immediately have some familiarity with the style.

The most popular eslint configuration is published by AirBnB as an open source project. It’s a great starting point, but the beauty of these configurations is that if you don’t like a rule then you can simply turn it off. Or, on a case by case basis you can also turn off the rule in your code. As an example, here is the LDC Via .eslintrc file.

Linting your code is not, in itself going to make it great code, but it will be a big help to you and, at the end of the day you can go home with a slightly smug feeling that you’ve gone that extra step to be a good programmer. And who doesn’t like to feel a bit smug sometimes?

This blog post was originally published on blog.ldcvia.com.

Do you use your own product?

We're just back from holidays down in Cornwall and Devon and a lovely time was had by all.

View of Falmouth

A view of Falmouth from one of our walks

Of course there has to be one exception: whenever we do any travel in the UK, I rarely carry change with me these days. And so, when parking the car, we rely on the various mobile parking apps to pay for our spaces.

Parkingapps.png

After a couple of weeks away, I end up with a page of parking apps installed like this.

Some of the apps have nice features, but not one of them is actually staying on my phone now that I'm home.

And what's the point of this post? Well, not a single one of the many different parking apps that I've installed, used and then deleted as quickly as possible over the years is any good to use. The registration process is awful and opaque. You have to enter your name, a card type (why?), a card number, expiration date, CVC and only then is validation run and a single mistake clears out all the fields and you have to start again.

I've reached the point where I'm pretty sure that the people responsible for the apps have ever actually tried to use them, while standing in a car park, in the rain, with impatient children tugging at your shirt because they want to get to the beach. NOW!

If you write apps that people have to use in sub optimal locations, as opposed to behind your desk with fast wifi, please, please, please think about how they will be used in the real world. Even if the app will be used from the comfort of a sofa, why not actually try using it for real yourself before inflicting it on the rest of the world?