Code, code, code, but have you ever spent time exploring your programming mindset?

Code, code, code, but have you ever spent time exploring your programming mindset?

Daily short news for you
  • Here! A question that I've been wondering about for ages, and until yesterday, everything was finally clarified.

    Normally, people use height: 100vh to set the height equal to the viewport of the screen. On computers, there's no issue, and even simulating the size of a smartphone works fine. But when opened on a phone, height: 100vh always exceeds the viewport. Huh!? What's going on???

    The explanation for this is that mobile devices have a different way of calculating the viewport compared to computers. It is often interfered with or affected by the address bar and navigation bar of the platform you are using. Therefore, if you want 100vh on mobile to truly equal the viewport, you need to take an additional step to reset the viewport.

    It's easy, first, you need to create a CSS variable --vh right in the script tag at the top of the page.

    function updateViewportHeight() { const viewportHeight = globalThis.innerHeight; document.documentElement.style.setProperty('--vh', `${viewportHeight * 0.01}px`); } updateViewportHeight(); window.addEventListener('resize', updateViewportHeight);

    Then instead of using height: 100vh, change it to height: calc(var(--vh, 1vh) * 100). And that's it.

    » Read more
  • Nowadays, how much memory will 1 million (1M) concurrent tasks consume? That is the question posed by hez2010, and he decided to find the answer by experimenting with a simple program in various programming languages: How Much Memory Do You Need in 2024 to Run 1 Million Concurrent Tasks?

    To summarize, Rust remains unbeatable, but the second position surprised me 😳

    » Read more
  • Is something coming? 😱🥶

    » Read more

The Problem

We all want to improve our coding skills. By learning and practicing more, we accumulate more experience in problem-solving. When facing a familiar problem in the future, we can easily solve it because we have prior experience in handling similar issues.

Many people rely on years of experience to judge whether someone is a good coder or not. This is a reasonable approach when there is limited time to evaluate someone or when there is a lack of expertise to make the assessment. However, there are still young individuals who possess excellent problem-solving skills despite having fewer years of experience. Therefore, the number of years of experience is only a reference, and there is no certainty that more years of coding will make someone better than those with fewer years of experience.

As Malcolm Gladwell wrote in his book "Outliers: The Story of Success," "10,000 hours is the magic number of greatness." This means that you become truly skilled in something after spending at least 10,000 hours working on it. However, the concept of the 10,000-hour rule is still debatable. Is it necessary to reach this specific milestone to become excellent, or are there other ways to surpass the obsession with this number?

What is a Programming Mindset?

Simply put, it is the ability to effectively solve the problems you encounter. But what does it mean to solve a problem effectively? It depends on each individual's knowledge and experience.

Imagine you are given three tools: a fork, scissors, and a shovel to open a snack package. Which one would you choose? You would probably choose the scissors because you know that they are the simplest tool to open the package. However, would a child know which tool is best among the three? In essence, all three tools can open the snack package, but you are more familiar with them, so you know how to use them effectively.

In the world of programmers, knowing how to apply a tool or method to solve a problem in the most appropriate and accurate way is your programming mindset.

A common mistake that beginners make in coding is focusing solely on learning (memorizing) the syntax without cultivating problem-solving skills. There are many programming languages, each with its own syntax that can be overwhelming to remember. However, problem-solving skills are a continuous process that exists across languages.

To achieve this, you need to dedicate hours to explore and practice all aspects of programming. This will develop your programming mindset. The 10,000-hour rule is only a reference point to help you prioritize where to focus your efforts to reach your goals more efficiently.

Programmers with a strong programming mindset often think similarly when it comes to problem-solving. As interns, when you listen to experienced programmers discuss how to solve a particular problem, you may find it difficult to understand their smooth exchange. This is simply because you have not reached the level of programming mindset that they possess.

How to Cultivate a Programming Mindset?

How to cultivate a programming mindset?

Advice: Keep doing and experimenting until you find the best way to solve a problem. Never settle for one solution because each solution has its pros and cons.

To achieve this, there are four steps to simulate this process:

Understand

First, you need to understand the requirements accurately. Most difficult problems arise from a lack of understanding. How can you understand them? Try explaining them. This is also part of the famous "rubber duck" method. The key idea is to explain the problem to a rubber duck, and if it works, you will discover gaps in your knowledge.

A rubber duck is a famous method in the programming world. Basically, when you explain the problem to a rubber duck, it becomes a way to test if you truly understand the problem, because only when you understand can you explain it. Moreover, during the explanation, you may discover new issues that need to be addressed and find ways to solve them.

There is a famous saying in this case: "If you can't explain something in simple terms, you don't understand it." When receiving a requirement, take the time to "understand" it before starting to work on it. This is also the content of the next step.

Plan

Don't rush to code immediately. Take the time to plan how to solve the problem. Although you may understand the problem, writing out the steps of solutions will help you have a clearer understanding and discover unexpected cases.

Repeat the question "With input X, what steps are necessary to return output Y?" while planning. Identifying each input and output means you know what you need and how to solve them.

Divide and Conquer

Divide the problem into smaller pieces, the smaller the better. A large problem may seem complex, but when broken down into smaller parts, it becomes simpler, to the point where you may already be familiar with the individual components. If you encounter a problem you have never faced before, it is an opportunity for you to learn.

Ultimately, when you solve all the smaller problems, the original problem will be resolved. Remember that the divide-and-conquer method is effective in all aspects of life.

Deadlock

Sometimes, you may not fully master the smaller problems. Don't worry; everyone experiences this. The difference between a good problem solver and an average one is curiosity about the occurrence of errors rather than frustration. Essentially, during this stage, you need to practice your debugging skills to gain experience when facing similar errors. Understanding the nature of an error also means understanding how to avoid it.

Getting out of a deadlock is not the end. Apply the "evaluate and retreat" method, which means going back to a previous step to see if there is a faster way to solve the problem. Even if you have solved the problem, take the time to evaluate whether the solution is truly effective. Is there anything you can do differently to improve the outcome?

Conclusion

The programming mindset exists within all of us. You can truly master it through daily practice and training. Understanding the importance of a programming mindset helps you focus on your personal and professional development.

Premium
Hello

5 profound lessons

Every product comes with stories. The success of others is an inspiration for many to follow. 5 lessons learned have changed me forever. How about you? Click now!

Every product comes with stories. The success of others is an inspiration for many to follow. 5 lessons learned have changed me forever. How about you? Click now!

View all

Subscribe to receive new article notifications

or
* The summary newsletter is sent every 1-2 weeks, cancel anytime.
Author

Hello, my name is Hoai - a developer who tells stories through writing ✍️ and creating products 🚀. With many years of programming experience, I have contributed to various products that bring value to users at my workplace as well as to myself. My hobbies include reading, writing, and researching... I created this blog with the mission of delivering quality articles to the readers of 2coffee.dev.Follow me through these channels LinkedIn, Facebook, Instagram, Telegram.

Did you find this article helpful?
NoYes

Comments (2)

Leave a comment...
Avatar
Gin Na2 years ago
Bài viết truyền động lực ghê
Reply
Avatar
Xuân Hoài Tống2 years ago
Nhớ ghé đọc thêm nhiều bài hơn nữa nhé bạn
Avatar
Nhí Nhố Tí2 years ago
@gif [10uEX5kfeodYgo]
Reply
Avatar
Xuân Hoài Tống2 years ago
@gif [v4kSqUsNg9i1XxO6L7] Bạn đọc đến đâu rồi?
Avatar
Xuân Hoài Tống2 years ago
@gif [xHnGkoz0KjGa0ixLzk]