Programming directly against a C# concrete class is one of the easiest ways to degrade the unit testability of your code, as they introduce overlapping test cases that exponentially increase …
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
-
-
Welcome to the second post in the .Net Unit Testing series: escaping the sticky trap of infinite or C# CancellationToken based loops! In this article we’ll dive head first into …
-
Welcome to the first post in the Dot Net Core Unit Testing series! In this post we will take a look at the first form of our spaghetti code and …
-
.NetFeaturedSloth SeriesTest Refactoring
[Series] Your .Net Unit Tests Are Judging You: Why You Should Listen to them
by Trentby TrentI’ll just do a little more manual regression testing… Is unit testing C# code tedious or difficult? So tedious or difficult that you need to add many extra story points …
-
5. Aggregating in OpenSearchKeywordsOpenSearch
[Tutorial] OpenSearch Keyword Composite Aggregation
by Trentby TrentThis article will use the .Net OpenSearch.Client NuGet package. Prior to completing the tutorial please read the Keyword Field Data Type Indexing Deep Dive article as it contains useful prerequisite information. At time …
-
5. Aggregating in OpenSearchKeywordsOpenSearch
[Tutorial] OpenSearch Keyword Adjacency Matrix Aggregation
by Trentby TrentThis article will use the .Net OpenSearch.Client NuGet package. Prior to completing the tutorial please read the Keyword Field Data Type Indexing Deep Dive article as it contains useful prerequisite information. At time …