Cognitive load 🧠, Health for SE 🧘🏻‍♂️, child process 🤖 VS worker threads 👷‍♂️

By Prajwal Haniya

Techletter #62 | March 02, 2024

Write clean code to reduce cognitive load

Cognitive load is nothing but the mental effort needed to accomplish a task. You must retain details like variable values, conditional logic, loop counters, data structure states, and interface agreements when reading code. As code complexity rises, so does cognitive load*.*

The cognitive load will be more for other people when reading the code you have written than for yourself.

The key to reducing cognitive load:

  1. Limit the amount of code in a function or file
  2. Create abstraction to hide implementation details
  3. Simplify control flow
  4. Minimize mutable state
  5. Include only relevant details in the test

Original Link | Archive Link


Health for software engineers

Sitting for long hours is not good for us as engineers. Especially, if you are a software engineer then chances are that you will be sitting for a long time, sometimes 12-13 hours a day.

Sitting is the new smoking

Our body structure is built for movement and not to sit for long hours. This will start showing its effect in terms of maybe back/neck pain and other body pains. So we must be proactive in tackling this issue early.

I am reading a book called Deskbound. It clearly states to avoid sitting without a requirement. (It has more information, and will be shared in the upcoming days).

However, I got to know about the book through an article called Movement for Engineers.


Child Process VS Worker Threads in nodejs

Child process

How to create a child process?

To create a child process you can make use of child_process module.

child_process

Worker threads

How to create worker threads?

To create worker threads we use the worker_threads module of nodejs.

worker_threads


Why use the Zustand store instead of Redux?

Using redux can be complex. As your app grows, maintaining it won’t be an easy task. Especially redux is not beginner friendly.

Recently, I have started migrating redux to the zustand in of our apps. And believe me, zustand is so simple and you will fall in love with it when you start using it.

Zustand Package


What does ‘use strict’ do?

The purpose of "use strict" is to indicate that the code should be executed in “strict mode”. What do you mean by that?

With strict mode you:

To check more about what you can or cannot do in the strict mode, you can visit this link

Videos worth watching

  1. Ashish Tulsian Interview
  2. Understanding react’s UI rendering process
  3. Processing blue berries with the help of AI
  4. How Dutch Gouda Cheese Is Made On A 150-Year-Old Family Farm?