DEV Community

21 Lessons
21 Lessons

Posted on

If Hemingway Wrote JavaScript

This Post originally was published in the Junior Dev Insights Newsletter. Sign up here to receive more of these every week:

It is better to learn JavaScript late than never to learn it at all.
- Sir Arthur Conan Doyle

This is a quote from "If Hemingway Wrote JavaScript". If you haven't read it, it's showcasing JavaScript Code as it had been written by famous book authors such as Virginia Woolf or Franz Kafka. It's humoring to read the code and the comments, written in a similar fashion as their books. Every chapter is about solving a particular programming problem such as writing a function that returns the Fibonacci numbers. Then, a handful of authors showcase their solution.

I like the book very much for the excellent stories but also because it's illustrating pretty well that there's always more than one solution available for a given problem.

I spent a good deal thinking about the reasons why this book is so fascinating.
When I grew up, I got taught implicitly that there's always a definite solution for a given problem or task. Any deviation would cost points. I had a hard time learning this but also an even harder time to unlearn it again when I started with programming. When you're sitting in front of the computer and wondering how to write these specific lines of code in the best way, it's up to you to figure out the best way. Most of this will come from experience. Going over the same code over and over again, you develop a feeling for readability but also maintainability.

There are standard applications that solve common problems such as spreadsheet calculations or word processing, but there will always be the need for more niche solutions. It's a bit like the Red Ocean vs. Blue Ocean Strategy. In short, the red ocean describes a world where market share is finite, and in order to increase your share you need to compete with others.
In contrast, the Blue Ocean describes a world where there's uncontested market space, without relevant competition. The latter comes with a mindset of finding solutions that might not be standard, not written down in any books. It's a "thinking out of the box" exercise where you need to combine various aspects from existing methods or procedures to create something new. It's challenging, because of the lack of definite instructions but also exciting. You get to design the world as you like.

In order to get there, you need to build up your own personal toolbox. This consists of Design Patterns, patterns you learn from other people's code, knowledge of available libraries and so on. This helps to build up knowledge you can draw from when the next new project comes your way.

Top comments (0)