CodeBork | Tales from the Codeface

The coding blog of Alastair Smith, a software developer based in Cambridge, UK. Interested in DevOps, Azure, Kubernetes, .NET Core, and VueJS.


Project maintained by Hosted on GitHub Pages — Theme by mattgraham

I’ve been doing a lot more JavaScript development at work over the last few months, working on a site that is AJAX’d up to the hilt. Everything’s done with fancy jQuery effects and asynchronous calls back to the web server. The page in the browser literally never reloads.

Something that caught me out today: there’s no String.equals(String) in JavaScript. My first thought was “what kind of half-baked language doesn’t provide an equals method for strings?!”. Then it occurred to me that select isn’t broken (or “Horses, not Zebras”). Hell, I’ve been doing Java and C# for so long now, that I’d forgotten that most times you can just do "string" == "string" and you don’t need .equals().

“Select isn’t broken” is Tip No. 26 from The Pragmatic Programmer, an excellent book for professional devs that is on quite a few “must-read” lists. If you’re a dev and you haven’t read this book, do so; although some of it is starting to look dated, and a chunk of it is pretty *nix-oriented (but not specific to those platforms), it’s one of the classic texts that helps you look at your job in a different way. I found it quite an enlightening read, and it’s relatively cheap on Amazon.