<< User-Agent detection in Java | Home | mdadm: replacing a disk >>

Embrace boredom

I know, I'm a programmer. And as such, everyday or so of my life for the last 20 years I've written code. Most of it has been thrown away by now, but a good chunk is still alive and kicking. And what happens to this code now? Well, from time to time someone take a look at it and try to think "how am I going to make this code do what I want it to be doing". And if this person finds an answer quickly, the code I wrote was good.

As Dan McKinley puts it very well, the best way for this code to make things easy for other people is to be understandable at first glance. Smart and clever code doesn't meet this standard. Boring code does.

Boring code means code that meets long-established standards. It's boring because those standards have been known for a long time and you're smart! You can do better! Yes, you can, but no, you shouldn't. Because the next person modifying your code won't have a clue about your smart idea of the day.

In the same way, when choosing a library to answer a need you have, before jumping into the latest shiny bandwagon, ask yourself if the old and rock-stable lib everyone knows can do the job. If it can, there is probably no better choice. If and when it fails, you're more likely to have at least a few people onboard that know about that failure. When you push it to the limits, you also have experienced people that can better predict what will happen.

The only exception to this rule is areas in which you innovate, and there should be very few of them. You can't innovate on every front. Because innovation is draining your resources: it is longer to setup, harder to pickup for newcomers, harder to fine tune, more prone to bugs which are harder to debug. Just because it's new and no one has any experience with it. So choose those areas very carefully.

This is where the GTD (Get Things Done) should kick in. Use rock-solid and proven libs. Use rock-solid and proven patterns. You will be more likely to build a rock-solid platform that works without a glitch. And it will be faster and less expensive to build.

Avatar: Daniel Hellerstein

Re: Embrace boredom

I just obtained and tested you lz-string.js library -- for the reason you stated 10 years ago! Which is: saving to localStorage (or to indexDb). Alas, it was a bit stressful doing so. At the risk of not sounding appreciative, it wasn't a fine example of "embrace boredom" What I did: a) Google " javascript zip string" https://pieroxy.net/blog/pages/lz-string/index.html is the 3rd choice b) go there ... YES, this is what I want. The install is (<script>...</script>) is simple, and the usage (straight function calls) is Simple. Yaay! And the several options (utf16, etc. are a good touch)!! c) Per the instructions https://github.com/pieroxy/lz-string/ -- look for lz-string-1.3.0.js. And that's where the boredom ceased. I looked all over, and nothing. But perhaps I am being too bitchy -- there is a tip stating "The "old style" minified AMD file is available as dist/index.umd.js via various CDNs or package managers. But where is "dist/" ??? Not on the gitHub page -- https://github.com/pieroxy/lz-string/dist/index.umd.js returns "Not Found" d) Somehow (I can't remember how) I found https://github.com/pieroxy/lz-string/releases/tag/1.5.0 e) And it was easy enough to download lz-string.js in the libs/ folder The specRunner.html tester was kind of useless -- do I have to learn how use "jasmine" just to understand the demo?? Oh well, it wasn't that hard to write my own little test html, and as noted in step 1 above-- the functions do work! https://github.com/pieroxy/lz-string/ And it was tricky for me to get the code! Call me obsolete, but I like working with .js files loaded using clunky <script ...> statements. If for no other reason that I don't have to mess with npm etc, and code can run in standalone. Again, a sincere thank you. But I wonder if in the last decade it has become declasset to .js files? Is it considered ill mannered NOT to use NPM? Am I that out of touch with acceptable practice? I am not sure how I finally fond
Home