# Insights from a Professional Programmer on Effective Coding
Written on
Chapter 1: The Art of Code
Years ago, I came across some code crafted by a developer at Intel. It was a desktop application built with QT in C++, a language I was not very familiar with at the time. Despite my lack of expertise, I found the downloaded code to be impressive, contrasting sharply with my own coding efforts.
What stood out to me was the clarity of the code. It resembled a polished class assignment, free from unnecessary comments. Instead, the comments provided were succinct and served their purpose well. The variable and method names were clear and intuitive, contributing to a straightforward and linear structure. The application performed its intended functions flawlessly.
While I'm not sure of the author's experience level, I can confidently say that these traits are indicative of high-quality code.
Section 1.1: The Evolution of Programming
Two decades ago, programming was often viewed as an amateur endeavor. In American companies, the roles of designer and programmer were distinct and often at odds with one another. This division stifled innovation and led to the downfall of companies that resisted change. Thankfully, the landscape has shifted. Nowadays, code often documents itself, with tests created for each unit, class, and function. These tests serve as formal descriptions of the code’s functionality.
Moreover, these tests are automated, which significantly reduces the risk of regression bugs when new test cases or features are introduced. While existing test cases provide some assurance, they do not account for edge cases that may not have been considered initially.
Every programmer today should be proficient with automated testing tools, version control, task management, and UML. They should also prioritize peer reviews of their code whenever feasible.
Subsection 1.1.1: Modern Code Repositories
Today, platforms like GitHub and GitLab host a wealth of well-written code that integrates automated testing tools. The Mozilla and Chromium projects are prime examples, but navigating their various compilation tools can be daunting.
When codebases grow large, the tools used become as crucial as the code itself. The linking phase in a compiler is complex, making it essential to maintain well-organized code in conjunction with robust compilation tools. The Linux kernel code, though lower level, exemplifies cleanliness and structure.
Chapter 2: Lessons from Linux
One aspect I admire about the Linux code is its choice of an 8-character tab stop. This decision was not merely about the tab size; it was based on the principle that if code requires more than two nested blocks, it likely needs refactoring.
While there are many conventions to uphold in coding, some rules, like the prohibition of GOTO statements, can be disregarded. Despite the occasional break from these norms, Linux code remains readable and comprehensible.
The first video titled "If Your Code Looks Like This... You're A GOOD Programmer" discusses the characteristics of effective coding practices and illustrates how to recognize good code.
The second video, "The KEY To Thinking Like a Programmer (Fix This Or Keep Struggling)," emphasizes the importance of mindset and approach in programming, offering insights on overcoming common coding challenges.
To conclude, it’s vital to recognize that reading code is just as crucial as writing it. Relying solely on training demonstrations is insufficient; one must engage with real code to enhance understanding. Admittedly, the first attempts at deciphering code can be challenging, particularly in knowing where to begin.
Thank you for sticking with me until the end. If you found this insightful, please consider showing support and following my work! Connect with us on X | LinkedIn | YouTube | Discord. Explore more content on our platforms: In Plain English | CoFeed | Venture | Cubed. Visit Stackademic.com for additional resources.