This blog post is based on the HackerRank Interview Preparation Kit array New Year Chaos problem. HackerRank provides programming challenges…
What's a Code Sloth?
Optimality in Simplicity
To be sloth is to be lazy or slow, but is this true of the sloth itself? These fascinating creatures sustain themselves on toxic, rubbery leaves that contain little nutrition, take weeks to digest and produce barely enough energy to move at a deathly pace. Ok… It’s no wonder they’ve got a bad rap.
However, as we zoom out, high in the tree tops away from the danger of predators, a different picture starts to form. Without a need to flee or fight, they’ve no need for speed or brute. Why then feast on energy dense food when that energy would go unspent? Sure, toxic leaves aren’t exactly ideal, but we software engineers know there’s no golden solution, am I right?
It is observant eyes that see the sloth for what it truly is; a beautifully optimal system. No fancy bells or whistles, just a happy, humble, hairy thing doing only what it needs and nothing more. This cute little coconut head isn’t lazy; he’s exceptionally efficient. And just look at that smile.
The Sloth Approach to Software Engineering: a Personal Ideology
Many engineers in the industry would do well to take heed of the sloth. All too common is a solution that overcomplicates the task at hand. Ephemerally trending design patterns, obsessive need for optimisation or blatant “brag-worthy” complexity poison the environment in which we would otherwise thrive. However, unlike the sloth, our tolerance for toxicity is far less robust. It is in this realisation that a Code Sloth is born.
Pronoun: Code Sloth
(Any or all) A software engineer who:
1. Proudly authors sloth code
2. Lazily (optimally) leverages the code or solution of another to solve a problem, or learn about it
3. Is hairy, moves slowly and enjoys lengthy naps
Usage 1
Hi, my name is Trent and my pronouns are he/him/Code Sloth.
Usage 2
My inner Code Sloth lead me to a StackOverflow article that had an amazingly accurate solution for calculating the distance between two geo coordinates on the surface of the earth. Now I don't have to be a subject matter expert because I've been able to reuse this solution, confirmed it to be accurate with a suite of unit tests and can move on with solving the remainder of this business problem!
Usage 3
Ugh, I need a coffee. I'm a major Code Sloth today
Noun: sloth code
An engineering solution or piece of code that on the outside is basic or simple, but when viewed in its full context is well considered and fit for purpose.
Usage
I'm proud of this new piece of sloth code that I wrote! Sure, this loop could be optimised to use a hashtable for big O(1) constant time lookups, but I'd get a diminishing return optimising it; there's no business case requiring us to process the data any faster. The current code is really simple and doesn't consume unnecessary memory, so I'll leave it here for the moment and revisit it in the future if our requirements change.
This blog aims to deliver simple and insightful information on software engineering, technology and beyond to help emerging Code Sloths climb to the highest of trees (goals). Enjoy, my furry little friends!
This Code Sloth
About the Author
Trent is a Technical Lead Software Engineer and proud Code Sloth living high in the tree tops of Sydney. Over 10 years of industry experience have taught this furry little coconut head that simple solutions trump technical wizardry in monoliths through to microservices. This blog is an expression of his passion for engineering in the hopes of helping other emerging Code Sloths alike.
Here's some food for thought
-
-
This post is based on the HackerRank Interview Preparation Kit Arrays: Minimum Swaps 2 question. HackerRank provides programming challenges that can be…
-
This post is based on the HackerRank Interview Preparation Kit Arrays: Left Rotation question. HackerRank provides programming challenges that can…
-
.NetProgramming Challenge
[.Net HackerRank Challenge] 2 Dimensional Array Hourglass Sum
by Trentby TrentThis blog post is based on the HackerRank Interview Preparation Kit 2D Array – DS question. HackerRank provides programming challenges…
-
2. Indexing in OpenSearchOpenSearch
[Tutorial] Creating an OpenSearch Custom Analyzer
by Trentby TrentOpenSearch comes with a rich set of built-in analyzers. As we explored in our indexing the OpenSearch Text Field Data…
-
2. Indexing in OpenSearchOpenSearch
[Tutorial] Indexing the OpenSearch Text Field Data Type
by Trentby TrentThis article will explore the OpenSearch Text field data type using samples from the CodeSloth GitHub code sample repository. These examples…