Typical C++, But Why?

As much as I like new cool C++ features, I’m a big fan of small habits like this video provides that can easily be applied to a codebase that I everyday sees. And with no surprise, I’ve seen all of those problems in our codebase :P

Writing Functions

Got to learn some new points regarding functions() in CleanCode.

  1. Functions should be small.
  2. They should do one thing only.

    FUNCTIONS SHOULD DO ONE THING. THEY SHOULD DO IT WELL. THEY SHOULD DO IT ONLY.

  3. To know if a function is doing more than “one thing” see if you can extract another function from it with a name that is not merely a restatement of its implementation.
  4. Function arguments should NEVER be greater than 3.
  5. We should never ignore any part of code.The parts we ignore are where the bugs will hide.

PS : I have been reading CleanCode for a while & logging what I learn here.

Atomic Habits Book Summary

Things I learned by reading atomic habits

The big idea 1% improvement = 37% better

Why should you buy the book?

I was skeptical when I saw all the hype the book was creating when it came to the market, I listened to the audiobook last year, This year I wanted to assimilate every page of this book and I hope the reflections ahead will make you want to read the book too, because it’s worth it.

Top 5 Takeaways

  1. Habits are easy to form if it’s based on building your identity
  2. Make good habits easy and satisfying
  3. Showing up is as important as doing things
  4. Cue - Desire - Response - Reward

What I liked about the book?

  • The book is short, crisp and to the point.
  • The chapters are just 5-7 minutes long making it easy to read
  • Every chapter starts with a title that induces interest followed by a story, that puts things in perspective before reading the actual content
  • The ideas and perspective in the book are new. For eg., Instead of punishing ourselves for eating junk, watching television, overusing social media, James clear points out an alternative perspective of how we are all the victims of billions of dollars spent by these companies.

Techniques to build Good habits

Habit Stacking

Stack new habits with existing habits. For eg, “After waking up I’ll meditate for 5 minutes, after meditating I will brush my teeth, after brushing I will write my journal”

Make It Attractive

It is an upgraded version of habit stacking, instead of stacking habits randomly, add new habits with habits you are excited about. For eg., After finishing this blog, I’ll go out with friends.

Feedback loops Habit -> Identity

Feedback loops are yet another human nature that happens in the background. If you take moment to pause and reflect on your behavior and course-correct along the way the habit will soon become your identity

One space one use

Let’s say you want to start meditating, it is better to have a separate space for it. Association of a habit with a place makes it easier to implement it.

Pointing and calling

One of the biggest problems with bad habits is that it’s so ingrained that we are unaware of it. Pointing and calling is when you stack habits and call it out loud when you do it. Next time you grab that smoke shout out loud “I am going to smoke!!!”

Habit Contract

Call up a friend and tell them you are going to quit/finish something and if you fail to do it, you would give them a big treat. You might miss a few times but the negative reinforcement that comes along will make the bad habit boring and keep you committed to the good habit. Keeping the promise is the key here.

Use Friction to your advantage

Keep the good habit triggers closer and bad habit triggers far far away.

  • Put your gym clothes on
  • Never roll up your gym mat
  • Have books lying around you
  • Hide the cigarettes or even better lock it

Goldilocks Rule - To Stay motivated

The Goldilocks Rule states that humans experience peak motivation when working on tasks that are right on the edge of their current abilities. Not too hard. Not too easy. Just right.

When trying to incorporate new habits don’t push yourself. Stretch yourself just enough such that it’s both challenging and amusing.

2-minutes rule

To get beyond procrastination break good habits into 2-minute chunks

“Read before bed each night” becomes “Read one page.”
“Do thirty minutes of yoga” becomes “Take out my yoga mat<
“Study for class” becomes “Open my notes.”
“Fold the laundry” becomes “Fold one pair of socks.”
“Run three miles” becomes “Tie my running shoes.”

Parallel Ideas

Good Habits vs positivity

The more you do good habits, the easier it becomes, I was writing my yearly reflections and most of it was positive, I looked back 10 years and most of the moments I remembered are positive. It’s not like nothing negative had ever happened to me but, The more you reinforce your brain to look at positive things, the hazier the negative things become.

Little bits of improvement

One of the famous ruling entertainment channel is known their games and reality shows, despite their competitors trying to invest more money, make it big, bringing in more celebrities but nothing can beat them.

One day I happen to stumble upon a spiritual channel with singers performing. It caught my attention because all the singers and musicians were making eye contact, smiling at each other, nodding their heads as to how much they enjoy it, transferring their enthusiasm across television. Though their backdrop was boring, their equipment is not fancy, It still got my attention.

Now coming back to the successful channel, they have every piece right, from lighting, camera angle, editing, anchoring and so on.

That’s when it hit me if we focus on little pieces of our lives and improve it by a percent it would make a huge difference.

Environment Induces Habits

Some habits are not noticeable until there is a presence of higher power, this can be peer pressure, a more authoritative person or just the environment.

For eg., when I was in college I used to have long nails. After I started my job for the last 3 years I never had nails . I thought I just grew out of it. But when I took a break last November the nails grew back but when I went back to the job in October all nails gone.

Turns out I have the habit of ripping them off when I work on problems. Some habits like these are environmentally induced and are so grained that it goes unnoticed unless you make a major change to your environment.

Ready for some Good Habits?

Choosing the right habit is an explore exploit the problem, The book states that not all habits fit you People tend to beat themselves up if they can’t get a habit right but, with the right activity, you do more, the more you do the more it becomes a habit.

SOLID: Design Principles

  1. Single Responsibility Principle
    • An object should do exactly one thing, and should be the only object in the codebase that does that one thing.
    • A class should have one, and only reason to change
  2. Open-closed principle
    • A class should be open to extension, but closed to change.
    • You should be able to extend classes behaviour, without modifying it.

Show Your Work

Notes and takeaways from Austin Kleon’s book Show Your Work

Show your work is the follow-up to Steal Like An Artist, where he emphasizes the importance of sharing your work and the perks of doing the same.

You’re the only one interested in a craft, hobby, or idea. How do you meet and work with people with similar interests as you? - By showing your work. Initially, it might feel like a lonely journey, but soon you will realize you’re not alone.

Inorder for people to find you, you need to be findable

That brings us to the first point of the book

I’m not a Genius - So what? Be a Scenius

The word Genius gives us an illusion that great talent is built in isolation or mom’s womb, but that isn’t the case in reality.

Great ideas are birthed by group of creative individuals

Scenius is a group of people who comes together to share ideas about a shared interest. An example of Scenius is Renaissance, but you don’t have to worry about that. Today’s internet has a community for everything. Finding a group of Scenius is a no brainer.

How to Share Without Fear of Judgement - Be an Amateur

Amateur - An enthusiast who pursues work in the spirit of love, regardless of potential fame or money

Often when it comes to putting your work online biggest fear is the fear of judgment. To get over this, think of sharing (Tweeting, blogging, Youtubing) as a way of sharing what you learn.

When you’re an Amateur and say it openly people will swoop in to help you to get better. Being an Amateur also gives you an unfair advantage in looking at knowledge gaps. Look for them and fill them

[How to look for knowledge gaps when learning something new?]

But I don’t have anything to Share - Think Process, not Product

You’re not alone. With the amount of information overload, it’s common to feel that you don’t have anything new to say. Another problem in some cultures and education systems is that it shrinks our voices and thoughts so much that we believe we have nothing interesting to say.

Trust me, you do.

You can’t find your voice if you don’t use it

So how to find it? Writing is a great way to find a voice. You can find it almost everywhere. Here is a simple exercise that can help. Next time you read an article, watch a movie or have a conversation with a friend you liked and enjoyed, come back and write about it. Write about what you liked, what resonated with you, and which parts could have been better. Right there is your voice.

Now you can take this exercise and expand it to other parts of your work. At the end of each day, write a log about your work. Think about the parts other people might find useful. Maybe you can change your email and publish it as a template.

It doesn’t matter what the world thinks about your taste. If you like something share it. Be open and honest about what you like, even if it’s trash. Own your interests.

All it takes to uncover hidden gem is a clear eye, open mind, willingness to search for inpsiration where other people won’t

Anxiety with Sharing - Daily Dispatch

We all know that sinking feeling before hitting that submit/publish button, right? Will I be judged? Will people care? Is it worthy enough? The only way to find answers to this is by putting your work out there.

Make it a habit to send out a daily dispatch of your work. Became a documentarian of what you do. Whatever the nature of your work, there are people interested in what you do everyday

  • Start a project, Do.
  • Start a work journal.
  • Journal your thoughts
  • Journal your process
  • Journal your problems
  • Take pictures of your work at different times

Use this as your source of daily dispatch. Remember you are doing this for yourself, not for others.

Don’t think of your website as a self promotion machine it is a self invention machine

Your Work Doesn’t Speak for Itself

You have to do that too. I liked this story that was mentioned in the book.

Imagine you are at a museum where there are two identical paintings that no human can tell apart. The curator comes around, and you ask them, “What is the difference between these paintings”

The curator explains how Painting 1 was from the 80th century by an unsung artist who appreciated certain aspects of art and continues to explain it for another 10 mins. When you question the other painting, they say it was a replica made by an art student.

Now, which painting do you value the most? 15 mins earlier, both paintings had the same value, but the story by the curator changed the whole dynamic of how you look at it. The same applies to your work. Yes, you have to do good work, no doubts there. But the story you add to it takes it to the next level.

How to Produce Good Work? - The “So What?” Test

Initial days of your creative work, go ahead and share as much as possible. Share the little steps and the big ones. Don’t filter out anything.

The so what test - Before you post something online, ask yourself, “so what?”

The act of sharing should come from generosity.

  • Is this helpful?
  • Is this entertaining?
  • Am I comfortable with others seeing my work?

Share stuff because you like the content, not for the eyeballs.

Teach what you know. Share your trade secrets. There is an intuition that you develop through years and years of practice. Teaching doesn’t mean instant competition just because someone knows how you do things. They can’t become you. The minute you learn something, turn around and teach it.

Make people better at something they wanna be better at

Go to Rust: Why Discord is Making the Switch

In this blog, we explore the reasons behind Discord’s switch from the Go programming language to Rust.

Hey everyone,

Have you ever heard of an LRU cache? It’s a type of cache that stores data temporarily in order to improve the performance of a system. Recently, the team at Discord made the decision to switch the language that they use to implement their LRU cache from Go to Rust. In this blog, I’m going to explain why they made this decision and how it will impact the performance of Discord.

ABCs of Computer

“what’s the first thing you should done when your code throws an error obviously you should change nothing and try to run it again a few times”

Hello, this time i have put everything i got in this blog from the very school-level basics to the university level(intermediate) of knowledge about different computer science terms and concepts in a understandable way.

NOTE: This blog doesn’t contain any picture or graphical explanation considering the length of the content.

Pagination