Have a look at this (deliberately untidy) JavaScript code example, and consider what the if
condition is. Try and keep in mind how you’re working it out.
I’d bet good money you started reading through the inside of the if
block. The first two or three lines don’t tell you much, but as you worked through that statement you realised that it’s a form being submitted, and a moment later became aware that the name
and telephone
values in the condition are required fields for the form. …
Sorry if any of the pictures are too small to read on mobile. They are only supplementary (and mostly for my own amusement). Inspired by XKCD.
Many programming concepts exist beyond the libraries that implement them. It can be confusing. Sometimes I feel like I don’t know about a subject because people are talking about a specific library, or using convoluted terminology, even though I know the concept well.
I’ve compiled this list so that — like me — you can see that you know a lot more than you realise. …
There is a road sign in the UK which gets mocked more than any other. I’m not sure if it’s used in other countries too. It looks like this:
It indicates that there may be falling rocks ahead. The running joke when you drive past one is to say “thanks, I’ll try not to drive under any”.
Once you’ve noticed it you start to see quite a few signs like this.
DRY is a coding acronym, it’s short for Don’t Repeat Yourself, and I have a bone to pick with it. Some of the most painful work of my career has revolved around tidying up the mess left behind by hardcore DRY practitioners.
It’s a useful mental model. It’s kind of like driving a car. You get up and running fastest by learning that one pedal makes you go, another makes you stop, and the wheel makes you turn. You don’t have to understand how an engine works, how brakes work, or how the car grips to the road. That mental model will serve you well to start with. Until you drive on an icy day. …
Micro-front-ends (MFEs) is a UI architecture philosophy. It’s been gaining traction recently, but it brings a lot of unanswered questions as well.
MFEs have emerged alongside micro-service back-end architecture, and as such have a lot of aligned ideas. Here are the key concepts:
The self-contained code-base means separate Webpack builds (if Webpack is your bundler of choice). One of the biggest advantages of MFEs is the ability to update parts of your project incrementally. I once lead a project where we refactored ~500,000 lines of code from Backbone to React. That was only possible, because it was in ~50,000 line chunks that could be refactored individually— I should mention that 50,000 lines is too big for a MFE, we were using a kind of hybrid-approach. …
I’m pretty new to TypeScript. I’ve been coding with JavaScript for about 10 years, and I’ve been starting to see problems that I believe can be addressed with TypeScript. I’m still not 100% sure it’s useful in all projects, but the rising tide of library authors migrating is not a coincidence.
Unfortunately the idea that if you know JavaScript, you basically already know TypeScript turns out not to be true. Don’t get me wrong, if you’re writing JavaScript then you can definitely learn TypeScript. But it is a learning process. Alas, nothing comes for free.
Generics demonstrate why TypeScript can seem daunting. …
I first entered the ‘permanent’ work place — ie. not freelancing/bits-and-bobs kind of work—at the age of 23. I joined one of the largest magazine/radio publishing companies in Europe, and I thought I’d made it.
I started on 3 days a week on a central tech team, and was quickly picked up by one of the magazine departments to do the extra 2 to make it up to full-time work.
A couple of people in our office were leaving on quite short notice, but I didn’t think anything of it, I was flying. …
In the wake of Covid I’ve been thinking about charity. Specifically how we as coders can use our skills to help our local communities. The idea being that enthusiastic coders could offer a small amount of time for free to local individuals/businesses to build modern, responsive websites.
A quick search around found no shortage of sports teams, shops, and individual businesses who have dated or non-responsive websites.
I was offering my services for free, but even so the discussion around hosting costs can be awkward. I’ve hosted with AWS, and Azure before. Both are fairly affordable as web hosting goes. …
When I first started developing software I was introduced to the Test Pyramid. For the uninitiated the Test Pyramid is a philosophy for how to balance the different types of testing. The idea is that unit tests are cheap—fast to write, and run—so there should be a lot of them, and end-to-end tests are expensive—slow to write, and run—so there should only be a few.
One of the criticisms you can level at the Test Pyramid is that it doesn’t take in to account the value of the tests. …
I always find during times of change it can be hard to keep up exercise. I’m not sure why it is. I don’t feel less motivated. My best guess is that it comes down to micro-second decisions that err on the side of staying in over getting out followed by a downward spiral of lower fitness, and thus lower rewards—less PBs, and that kind of thing.
Around September last year my company moved office. That meant I had to give up my local gym membership that was less than a minute walk from our entrance. …
About