“It’s not about the money, it’s about sending a message. Everything burns!” — The Joker

Photo by Ryunosuke Kikuno on Unsplash

Most investors would kill for the kind of power that Elon has over markets. With simple tweets, he is able to move markets in a matter of minutes.

Not an investor, but an influencer. The supreme one. Tesla, Game Stop, and Etsy have all been on rollercoasters thanks to Elon’s tweets. Maybe the funniest of them all is “Use Signal”. Back in January 2021, in a bid against Facebook’s Whatsapp, Elon encouraged people to switch from the world’s most popular messenger application.

Investors listened like students in a class and bought in the first company named Signal. Little did they…

Or the check that the other SOLID principles were applied.

©Mihai Sandu

No, it doesn’t mean that dependencies should be inverted. The principle states that there should be no direct link between your low-level and high-level modules. In practice, the principle is the easiest of the five and

Think about a car. What if a steering wheel was connected directly to the car wheels? Every time you would change a wheel, some adjustments to the steering wheel would be required.

Now, we know this would be a bad design. So we have an “interface” between them that takes care of the communication so they don’t have a direct link.

Robert C. Martin…

How granularity will improve your code resilience to changing requirements in real-world applications.

©Mihai Sandu

Both images above are formed from the same number of pixels, but while one looks like a bear, the other one looks more like a shocked square. It is not a difference of quantity, but one of granularity. It is easier to compose something with smaller pieces.

The same logic can be applied to writing good, resilient code. Client code shouldn’t be forced to implement methods that it doesn’t use. This is the Interface Segregation Principle as defined by Robert C. Martin.

Code should be flexible enough to allow client code to use only the needed abstractions. …

Or when to extend a base class and when to compose objects.

©Mihai Sandu

And the number one spot for the most overlooked SOLID principle goes to… Liskov substitution. No surprises here.

I’m not going to bore you with the scientific definition. In short, the principle states that all object types should be substitutable for their subtypes without changing the correct behavior.

The key to understanding the principle stays in “correct behavior”. Let’s look at the principle with an example.

The Autonomous Driving System Problem

As part of the software engineering team at AutoPilotCars AI startup, we have to come up with a solution to control normal cars (like a Toyota Camry).

After much thought, the team has decided…

Specialize in a niche to make money. Step outside it to get the wallet to hold them.

©Mihai Sandu

In 1955 Raymond Kroc, a mixer salesman, opened his first franchised McDonald restaurant. He was 53 years old. At an age when most think about retirement, he was searching for new enterprises. Were he to focus on his niche, he would have never built the World’s largest restaurant chain.

Our writing can benefit immensely from the same type of courage. Online writing, for example, used to be reserved for high school teenagers and computer geeks. Now there is a blog for everything, like fashion, finance, gaming, sex, physics. More and more writers are moving away from traditional media to online.

Following this principle should spare you from new bugs when adding new features to existing code.

©Mihai Sandu

Trucks are one versatile piece of equipment. They can do different tasks based on the type of trailer attached to them. We can even chain trailers (if the load-weight allows it).

In short, trucks are open for extension with different trailers but closed to modifications (like engine or cabin). Writing extensible code should be just as easy as swapping trailers on a truck.

The Ice-Cream maker problem

Let’s imagine we have to write a program that makes cacao ice cream for Ted&Kelly Ice-Cream Corp.

The code, although basic, looks ok. No principle seems to be broken. …

Why this principle is often misunderstood and how should it be applied in real-world code.

©Mihai Sandu

In the picture above, what would you rather own, the Swiss army knife or all the tools on the right? When traveling, portability is the most important thing. The Swiss army knife is the appropriate tool.

But for day-to-day life — would you cut bread, mend the car, or open cans with a Swiss army knife? Probably not. You can do it, but it’s much easier to use a bread knife, a set of screwdrivers, or a can-opener.

Real-life code should be treated the same. A do-it-all class (god object) it’s ok, it will get the job done when you…

Spending more time on reading rather than writing code is a clear sign of mistrust in the codebase. Command Query Separation (CQS) principle can fix that.

©Mihai Sandu

Imagine every time you listen to “Single Ladies” the song would change.

1st time: “All the single ladies...”

2nd time: “Every single lady…”

3rd time: “All sole ladies…”

If that were the case, no-one would have shared the song, it wouldn’t have become a hit and we wouldn’t have laughed at the “Single Ladies” baby dance. Humans expect things to remain the same when all they do is observe. “Friends” must remain the same every time we rewatch it.

Code makes sense when it is a natural extension of familiar things. …

Hint: probably never

Image by yino19700 from Pixabay

The hydrogen propulsion dream has been around for quite some time. Harnessing the most common gas in the universe with water as the only byproduct was seen for a long time as something belonging to Jules Verne’s novels.

The thing with SciFi novels is that you never know when it will become reality. 100 years after the launch of “The Mysterious Island”, the world was introduced with the first working prototype, the Chevrolet Electrovan. But there is a long way from prototype to mass-adoption.

mind-bogglingly stupid”, Elon Musk

A key player in the electrification of our cars, Elon Musk has…

Multitasking has become synonymous with productivity. While that might make you look busy, it’s hindering your ability to learn fast.

©Mihai Sandu

Tell me if this sounds familiar to you: you just started to watch a tutorial/read an article. You find the concepts interesting so you promise yourself you’ll pay attention. But then, disaster. Your attention gets stolen. How did they manage to squeeze a DSLR quality camera in such a small phone? Why did my friend buy that stupidly expensive jacket, it’s not worth the money. Have they truly put a man on the moon?

5 seconds. That’s how long your mind wandered. Now nothing makes sense. So, scroll back and rewatch it. Or re-read the last paragraph. …

Mihai Sandu

A software developer interested in writing about programming, technology, environment, and self-development. Twitter @mihais77

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store