Skip to main content

Ben Cromwell

Ensuring better git commit messages with a global template

I read the advice here some time ago, and I’ve been following it by and large.

However, only recently I discovered how to enforce a line limit when git-commit starts up nano:

~/.gitconifg:

[core]
    editor = nano -r 72

The problem is that doesn’t help limit the summary to 50 characters, which is what you need for log, shortlog, Github and general readability.

I’ve now expanded this into a full replacement for git’s commit template. It’s automated with ansible as part of my local-setup.

Logging

Logging is an important thing to get right. It is a window into what’s happening in your application, right now and [x] days ago. Keeping a close eye on the error logs allows you to find bugs that users haven’t reported, or haven’t noticed. Doing logging right involves a few different strategies in conjunction with each other.

# UTC All The Things (TM)

Your server and application are both running UTC, right? Otherwise, you’re gonna have a hard time (or a harder time, depending on your timezone) marrying up log messages from syslog, your webserver and your application. Sometimes you need to locate the HTTP request in the Apache access logs that resulted in a particular application-side error log message. It’s easy to forget during BST that the time you’re grepping the logs for is offset by an hour! When you’re investigating an isssue on production the last thing yo want to do is increase your cognitive load by remembering which set of logs you need to subtract an hour from. Worse if you’re in a +3h45m timezone.

Laravel Facades pollute the mindset of junior developers

Laravel Facades came in for some criticism a couple of years ago.

https://www.reddit.com/r/PHP/comments/1zpm0y/laravel_lets_talk_about_facades/ http://paul-m-jones.com/archives/5952 https://www.brandonsavage.net/lets-talk-about-facades/

I’ve got a greenfield project at work using Lumen (Laravel Lite), which is what’s brought it back to my attention.

Lumen, by default, switches off the Facades feature.

However, a bunch of the documentation asks for you to uncomment the line $app->withFacades() to switch them back on.

Sadly, it doesn’t state the alternative. It’s as though the intention as that you’ll end up using them and you don’t have a choice. The way around it is to use the string you find in the facade accessor in a call to $app->make which you can do in a service locator. I’m not too keen on the service locator (anti-)pattern either but it does the job, keeps the link between config and instantiation in one place. (I’m open to alternatives, here.)

UX and security, so often traded off against each other. Can’t we have both?

In this day and age of frequent large scale data breaches and compromising of passwords, security is rightly being talked about more.

Unfortunately, this is often at the expense of user experience. Can’t we have both?

The simple answer is no, but the longer answer is a more complicated yes and no.

As with most things it boils down to context. Context that’s specific to the requirements of the individual.

Password managers and data breaches

If the LinkedIn hack has told us anything, it’s some stuff that we already knew.

You can’t really on even massive, well known sites to store passwords correctly, or to have been doing so since they started out.

## Get your family and friends setup

We as techies have a responsibility to our less technical family members to get them up to speed on password managers. We’re all agreed that password managers are the way to go, right?