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.
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…
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. …
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.
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…
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.
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.
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. …
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…
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. …
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…
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. …
A software developer interested in writing about programming, technology, environment, and self-development. Twitter @mihais77