{"id":1514,"date":"2023-11-26T17:20:50","date_gmt":"2023-11-26T13:50:50","guid":{"rendered":"https:\/\/mshaeri.com\/blog\/?p=1514"},"modified":"2026-06-22T18:42:56","modified_gmt":"2026-06-23T04:42:56","slug":"pragmatic-programmer-at-a-glance","status":"publish","type":"post","link":"https:\/\/mshaeri.com\/blog\/pragmatic-programmer-at-a-glance\/","title":{"rendered":"The Pragmatic Programmer at a Glance"},"content":{"rendered":"\n<p>I think &#8220;The Pragmatic Programmer&#8221; book by David Thomas and Andrew Hunt is a timeless treasure that remains ever-relevant in software development context. Filled with practical wisdom and approachable techniques, it equips developers with superpowers to tackle challenges and excel the process of software development. These 12 subjects are what I&#8217;ve gathered from the book, yet it offers learnings that surpass these 12:<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Use Version Control<\/h2>\n\n\n\n<p>Record every change in your code base using version control. If you mess up, you can always go back to the previous code version. But a version control system does far more than reverting the mistakes. A good version control enable you to track changes, and helps in tracking modifications, identifying contributors to specific code lines, highlighting differences between versions, measuring code alterations, and recognizing frequently modified files. This kind of information is invaluable for bug-tracking, audit, performance, and ensuring quality. (Topic 19, Version Control, Page 84)<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/vcs.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/vcs-1024x570.jpg\" alt=\"git branch will be isolated from all other branches.\" class=\"wp-image-1604\" width=\"512\" height=\"285\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/vcs-1024x570.jpg 1024w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/vcs-300x167.jpg 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/vcs-768x428.jpg 768w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/vcs-1536x856.jpg 1536w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/vcs.jpg 1571w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>You can create a branch at any point in your project\u2019s history, and any work you do in that branch will be isolated from all other branches.<\/figcaption><\/figure><\/div>\n\n\n\n<p><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Good Enough Software<\/h2>\n\n\n\n<p>Seeking perfection often prolongs projects indefinitely. If you don\u2019t know when to stop, you&#8217;ll end up in over-embellishment and over-refinement. Instead, aim for &#8220;good enough&#8221; and iterate. Deliver value early and often. Write code that works, prove it by writing tests, and ensure they are executed automatically. However, the phrase \u201cgood enough\u2019\u2019 does not imply sloppy or poorly produced code.  (Topic 5, Good-Enough Software,  Page 11) <br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Refactoring<\/h2>\n\n\n\n<p>Refactoring isn&#8217;t about big changes. Avoid starting a huge refactor. It&#8217;s more like tidying up your garden while weeding as a day-to-day process, not a major change. It&#8217;s the art of making small, low-risk changes to keep the code clean and efficient. And, last but not the least, unit testing is your trusty sidekick for keeping the code&#8217;s behavior consistent and dependable during refactoring.  (Topic 40, Refactoring,  Page 209) <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/refactoring-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/refactoring-1.jpg\" alt=\"Refactoring is a day-to-day activity\" class=\"wp-image-1529\" width=\"350\" height=\"250\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/refactoring-1.jpg 700w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/refactoring-1-300x214.jpg 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/refactoring-1-120x85.jpg 120w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/a><figcaption>Refactoring is a day-to-day activity<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">4. Don&#8217;t blame, just fix it<br><\/h2>\n\n\n\n<p>Sometimes, you will find lousy code that someone else wrote. Sometimes, you will find bad code that you wrote some time ago. Pragmatic programmers don&#8217;t say, &#8220;I didn&#8217;t write this, so I will not fix it&#8221; but do something about it and open a debate in a team about why.  Avoid spending time and effort in assigning fault to the creator. The responsibility of fixing a bug remains, it doesn\u2019t really matter whether the bug is your fault or someone else\u2019s. It is still your problem.(Top 20, Debugging, Page 89)<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Broken Window Theory<\/h2>\n\n\n\n<p>The Broken Window Theory suggests that if something is broken, others will break it even more in the future. As a pragmatic programmer, you should fix all significant problems you find in the system while working on it. Don&#8217;t continue walking on the wrong path the last developer walked on. Don\u2019t be a slave to history. Don\u2019t let existing code dictate future code. I&#8217;ve recently worked on a legacy code-base where the original coder used incredibly poor variable names. Whenever I encountered these confusing variables during development, I took the initiative to rename them. Gradually, I managed to update the entire code-base, significantly improving the clarity of variable naming. However, I must admit that my initial plan was to rectify all names at once, which contradicted the refactoring principle of making incremental changes as a day-to-day activity rather than undertaking a massive overhaul.   (Topic 3, Software Entropy, Page 7)  <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/broken_window-theory-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/broken_window-theory-1024x683.jpg\" alt=\"Don\u2019t live with broken windows.\" class=\"wp-image-1540\" width=\"512\" height=\"342\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/broken_window-theory-1024x683.jpg 1024w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/broken_window-theory-300x200.jpg 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/broken_window-theory-768x512.jpg 768w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/broken_window-theory-1536x1024.jpg 1536w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/broken_window-theory-2048x1365.jpg 2048w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>Don\u2019t live with broken windows.<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">6. Stay Up To Date<\/h2>\n\n\n\n<p>Continuous learning is essential in software development world. Stay updated with new tools, technologies, and best practices. Learn at least one programming language, tech stack or framework every year. It doesn\u2019t matter whether you ever use any of these technologies. Once you feel comfortable with some new language or bit of technology, move on, learn another one. Investing in your skills yields substantial returns in your career advancement. ( Tip 9, A Pragmatic Philosophy, Page 15)<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/continues_learining.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/continues_learining.png\" alt=\"The process of learning will expand your thinking\" class=\"wp-image-1555\" width=\"420\" height=\"294\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/continues_learining.png 840w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/continues_learining-300x210.png 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/continues_learining-768x538.png 768w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/continues_learining-120x85.png 120w\" sizes=\"(max-width: 420px) 100vw, 420px\" \/><\/a><figcaption>The process of learning will expand your thinking<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">7. DRY (Don&#8217;t Repeat Yourself)<\/h2>\n\n\n\n<p>Try not to repeat the codes, and when you notice duplication, refactor it into a shared function or module, because redundant code is more complex to maintain, and duplication is the root of all evil. DRY is not limited to code. Wherever you have to change code and documentation, or a database schema and a structure that holds it, your code isn\u2019t DRY. (Topic 9, DRY\u2014The Evils of Duplication, Page 30)<\/p>\n\n\n\n<p> <br><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/dont_repeate_yourself-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/dont_repeate_yourself-1-1024x480.png\" alt=\"Don\u2019t copy-and-paste lines of source.\" class=\"wp-image-1528\" width=\"512\" height=\"240\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/dont_repeate_yourself-1-1024x480.png 1024w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/dont_repeate_yourself-1-300x141.png 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/dont_repeate_yourself-1-768x360.png 768w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/dont_repeate_yourself-1.png 1200w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>Don\u2019t copy-and-paste lines of source.<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><br>8. Programming By Coincident<\/h2>\n\n\n\n<p>Understand your code deeply; don&#8217;t rely on coincidental successes. If you\u2019re not sure why it works, you won\u2019t know why it fails. Make sure you know why your code works, not just that it works. Understanding the underlying mechanisms and environment in which the code works ensures confidence in the reliability and efficiency of your solutions.  (Topic 38, Programming by Coincidence, Page 197) <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/coincidental_programming.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/coincidental_programming.jpg\" alt=\"Don\u2019t Program by Coincidence\" class=\"wp-image-1611\" width=\"360\" height=\"360\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/coincidental_programming.jpg 720w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/coincidental_programming-300x300.jpg 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/coincidental_programming-150x150.jpg 150w\" sizes=\"(max-width: 360px) 100vw, 360px\" \/><\/a><figcaption>Don\u2019t Program by Coincidence<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">9. Keep Your System Orthogonal<\/h2>\n\n\n\n<p>Two or more things are orthogonal if changes in one do not affect any of the others. In a well-designed system, the database code will be orthogonal to the user interface: you can change the interface without affecting the database, and swap databases without changing the interface. Enhanced productivity and reduced risks through modular, reusable, and isolated components are benefits of an orthogonal system. Three most important techniques to maintain your system orthogonal during development are :<\/p>\n\n\n\n<ul><li>Keep your code decoupled<\/li><li>Avoid global data<\/li><li>Avoid similar functions<\/li><\/ul>\n\n\n\n<p> (Topic 10, Orthogonality, Page 39)  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10. Be a Good Listener<\/h2>\n\n\n\n<p>To help your users, you&#8217;ll need to understand them first. Be careful when others speak, and ask good questions. When engaging with individuals such as product managers, developers, and business analysts, remain attentive and discerning to extract meaningful insights. The art of posing insightful questions plays a key role in uncovering comprehensive information, enabling you to craft solutions that resonate deeply with user requirements and expectations. Good questions comes after good listening, and well understanding. (Chapter 1, A Pragmatic Philosophy, Page 22)<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/Active-Listening-Featured-Image.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/Active-Listening-Featured-Image-1024x638.jpg\" alt=\"If you don\u2019t listen to them, they won\u2019t listen to you\" class=\"wp-image-1575\" width=\"512\" height=\"319\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/Active-Listening-Featured-Image-1024x638.jpg 1024w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/Active-Listening-Featured-Image-300x187.jpg 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/Active-Listening-Featured-Image-768x479.jpg 768w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/Active-Listening-Featured-Image.jpg 1200w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>If you don\u2019t listen to them, they won\u2019t listen to you<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">11. Take Responsibility<\/h2>\n\n\n\n<p>Before you explain limitations or problems, assess yourself: talks to the rubber duck beside your laptop, evaluate the validity of your reasoning, anticipate your boss&#8217;s response, consider alternatives, and offer solutions rather than excuses. need to spend more time? need to learn some technique or technology? Don\u2019t be afraid to ask, or to admit that you need help. (Chapter 1, A Pragmatic Philosophy , Page 4)<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1-1024x682.jpg\" alt=\"Talk to the rubber duck before telling your boss the excuse why it can't be done\" class=\"wp-image-1589\" width=\"512\" height=\"341\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1-1024x682.jpg 1024w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1-300x200.jpg 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1-768x512.jpg 768w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1-1536x1024.jpg 1536w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1-700x465.jpg 700w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/rubber_dock-1.jpg 2000w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>Talk to the rubber duck before telling your boss the excuse why it can&#8217;t be done<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">12. Culture of Testing<\/h2>\n\n\n\n<p>For all software, thorough testing is essential for minimizing future costs and issues. Your options boil down to: Test First, Test During coding, or Test Later. Testing early is the best, and testing during coding is good, but testing later is the worst choice because &#8230;, emm,  let&#8217;s be honest \u201cTest Later\u201d really means \u201cTest Never&#8221;. Keep in mind that all software you write will be tested, if not by you and your team, then by the eventual users.  (Chapter 7, While You Are Coding, Page 222)   <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/test_or_will_be_tested.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/test_or_will_be_tested.jpg\" alt=\"Test Your Software, or Your Users Will\" class=\"wp-image-1596\" width=\"503\" height=\"420\" srcset=\"https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/test_or_will_be_tested.jpg 1006w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/test_or_will_be_tested-300x250.jpg 300w, https:\/\/mshaeri.com\/blog\/wp-content\/uploads\/2023\/11\/test_or_will_be_tested-768x641.jpg 768w\" sizes=\"(max-width: 503px) 100vw, 503px\" \/><\/a><figcaption>Test Your Software, or Your Users Will<\/figcaption><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I think &#8220;The Pragmatic Programmer&#8221; book by David Thomas and Andrew Hunt is a timeless treasure that remains ever-relevant in software development context. Filled with &hellip; <\/p>\n","protected":false},"author":1,"featured_media":1515,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,69,216,35],"tags":[11,189,369,188,9,366,368,15,39,367],"_links":{"self":[{"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/posts\/1514"}],"collection":[{"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/comments?post=1514"}],"version-history":[{"count":1,"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/posts\/1514\/revisions"}],"predecessor-version":[{"id":2577,"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/posts\/1514\/revisions\/2577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/media\/1515"}],"wp:attachment":[{"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/media?parent=1514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/categories?post=1514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mshaeri.com\/blog\/wp-json\/wp\/v2\/tags?post=1514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}