{"id":409936,"date":"2022-02-25T19:00:52","date_gmt":"2022-02-25T16:00:52","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/oi-developers-best-practices-can-turn-you-into-complacent-a-holes\/"},"modified":"2022-02-25T19:00:52","modified_gmt":"2022-02-25T16:00:52","slug":"oi-developers-best-practices-can-turn-you-into-complacent-a-holes","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/oi-developers-best-practices-can-turn-you-into-complacent-a-holes\/","title":{"rendered":"#Oi, developers! \u2018Best practices\u2019 can turn you into complacent a-holes"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a43be94b133a\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a43be94b133a\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/oi-developers-best-practices-can-turn-you-into-complacent-a-holes\/#Simultaneous_%E2%80%9Cdont_repeat_yourself%E2%80%9D_and_separation_of_concerns_doesnt_work\" >Simultaneous \u201cdon\u2019t repeat yourself\u201d and separation of concerns doesn\u2019t work<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/oi-developers-best-practices-can-turn-you-into-complacent-a-holes\/#Please_reinvent_the_wheel_from_time_to_time\" >Please reinvent the wheel from time to time<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/oi-developers-best-practices-can-turn-you-into-complacent-a-holes\/#Quantity_over_quality\" >Quantity over quality<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/oi-developers-best-practices-can-turn-you-into-complacent-a-holes\/#Best_practices_turn_you_into_a_complacent_a-hole\" >Best practices turn you into a complacent a-hole<\/a><\/li><\/ul><\/nav><\/div>\n<p>&#8220;<strong>#Oi, developers! \u2018Best practices\u2019 can turn you into complacent a-holes<\/strong>&#8221;<br \/>\n<img decoding=\"async\" src=\"https:\/\/img-cdn.tnwcdn.com\/image?fit=796%2C417&amp;url=https%3A%2F%2Fcdn0.tnwcdn.com%2Fwp-content%2Fblogs.dir%2F1%2Ffiles%2F2022%2F02%2Fdev-burnout-issue-gq.jpg&amp;signature=d095a8563b88df0f3cafa2ce799e9df8\" \/><\/p>\n<div>\n                            Have you ever baked cookies and wondered why the recipe is exactly that way and no other? If you changed this ingredient up or that temperature, would it make the cookies even better?<\/p>\n<p>I certainly have had these thoughts. It\u2019s the reason why most of the things I bake aren\u2019t very edible\u2026<\/p>\n<p>When it comes to programming, these thoughts arise too. What if I wrote this part as a separate function? If I hard-coded this bit over there, would it make the code easier? Can I rewrite those ten ugly lines into two elegant ones?<\/p>\n<p>There are no recipes in programming, but there are best practices. They\u2019re not precise like a recipe, but clear enough that it\u2019s evident if you haven\u2019t implemented them. Like with recipes, some best practices get repeated over generations of programmers. Sometimes it makes sense to do so; sometimes that\u2019s nothing more than a tradition. <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/blog.ndepend.com\/cargo-cult-programming\/\">Cargo cult programming<\/a>, if you wish to call it that way.<\/p>\n<p>But eventually, even the coolest tradition dies out or evolves into something more useful. The same will h<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>en with some, but not all, best practices in programming.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Simultaneous_%E2%80%9Cdont_repeat_yourself%E2%80%9D_and_separation_of_concerns_doesnt_work\"><\/span><strong>Simultaneous \u201cdon\u2019t repeat yourself\u201d and separation of concerns doesn\u2019t work<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Recently I reviewed some of my old code and noticed that the same four lines of code popped up three times in the same file.<\/p>\n<p>Now, any person who has studied any formal computer <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/sciencee\/\" data-internallinksmanager029f6b8e52c=\"5\" title=\"Science\" target=\"_blank\" rel=\"noopener\">science<\/a> (not me, I did physics) will tell you that this is silly because you need to keep your code DRY. Don\u2019t Repeat Yourself has become a mantra of sorts.<\/p>\n<p>I\u2019m not a computer science major, but I do read a bit, and I\u2019d internalized that mantra. So I took those four lines and put them in a function.<\/p>\n<p>Then I noticed that I couldn\u2019t do that so easily because those four lines weren\u2019t completely identical. A small change on the third line meant that I\u2019d have to add at least one option to my new function. I\u2019d also need an if-clause and perhaps a new boolean parameter to invoke that option.<\/p>\n<p>That would\u2019ve made the code as complicated as it was before.<\/p>\n<p>But then I noticed that those four lines always get invoked after calling other functions, two different functions across three different places, and so I thought I might as well add the four lines to those functions. This worked well because the small change on the third line would be handled by each of the preceding functions, and one of the two already contained a matching parameter.<\/p>\n<p>This did simplify my code slightly. I did end up repeating myself, but only twice instead of three times. And I violated the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/stackify.com\/solid-design-principles\/\">Single Responsibility Principle<\/a> because my two functions were doing more than they were advertised for.<\/p>\n<p>You could argue that I probably just wrote bad code and that there might be much more elegant workarounds for what I was trying to accomplish. And these workarounds might have even satisfied both principles.<\/p>\n<p>Fair enough. It\u2019s hard to disprove a claim like that.<\/p>\n<p>But programmers aren\u2019t paid to write the most elegant and beautiful code of the decade. They\u2019re paid to make something work.<\/p>\n<p>My project works. And more code-cosmetics would cost me valuable time that I\u2019d rather spend on other projects that aren\u2019t working yet.<\/p>\n<p>Maybe I\u2019m just so dumb I can\u2019t even get two programming principles two work. But I guarantee you that there are whole swathes of programmers that are on a similar level as me.<\/p>\n<p>Swathes of people who can\u2019t get DRY and SRP to work together either.<\/p>\n<p>It\u2019s unlikely that this would cause DRY to dry out (sorry, the pun had to be). It\u2019s an extremely useful principle for example in functional programming, <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/why-developers-are-falling-in-love-with-functional-programming-13514df4048e\">which is taking up steam these days<\/a>.<\/p>\n<p>The Single Responsibility Principle, on the other hand, might become rarer. Think about neural networks, for example. They don\u2019t figure out one single thing. The more sophisticated ones understand, and react to, <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.quantamagazine.org\/a-new-link-to-an-old-model-could-crack-the-mystery-of-deep-learning-20211011\/\">millions of different images<\/a>, text messages, or complicated proteins. That\u2019s the opposite of SRP.<\/p>\n<p>In other words\u2026 SRP is DRYing out.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Please_reinvent_the_wheel_from_time_to_time\"><\/span><strong>Please reinvent the wheel from time to time<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Like DRY and SRP, this practice was popularized by people with good intentions. But that doesn\u2019t change the fact that it isn\u2019t always sensible to implement.<\/p>\n<p>The idea is that if a solution to your problem already exists, you should use it. It\u2019s probably less buggy and more efficient than your home-cooked solution.<\/p>\n<p>There are a few problems with this thought.<\/p>\n<p>First of all, existing solutions rarely match your specific problem 100 percent. So it\u2019s quite likely that you\u2019ll solve, say, 75 percent by importing a solution or a package that addresses your issue. But you\u2019ll still have to do a substantial part of the legwork yourself, plus testing, debugging, and maintaining.<\/p>\n<p>Second, existing solutions often have more than one feature. And you\u2019ll probably not use all the features. So you\u2019ll be introducing a certain amount of superfluous code to your project, which makes it harder to understand and harder to maintain. You could have avoided that by custom-building your own.<\/p>\n<p>Third, beware of <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/medium.com\/geekculture\/want-to-be-unproductive-follow-best-programming-practices-d32e72b9b338\">incorporating open-source solutions<\/a> in proprietary projects. This is a violation of copyright and can, in the worst case, get you into legal trouble. If you use open-source code in your project, your project should be open-source too.<\/p>\n<p>Finally, reinventing the wheel won\u2019t guarantee freedom of bugs anyway. Even if it\u2019s tried, tested, and up-to-date (which is rare enough), you still have to incorporate it right and write the boilerplate code around it.<\/p>\n<p>So why not write your own custom solution, make a few mistakes in the process, and learn from them? These kinds of lessons can be extremely valuable, and they\u2019ll make you a much more valuable programmer in the long run.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Quantity_over_quality\"><\/span><strong>Quantity over quality<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Writer Sean Kernan (he\u2019s great, check him out) has a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/medium.com\/mind-cafe\/quantity-is-talent-ammo-its-your-low-key-secret-super-power-810b51a27d0b\">great piece<\/a> about how you should push for quantity, not for quality when you\u2019re doing creative work.<\/p>\n<p>For writing, this means that if you write one article a month and polish it until it\u2019s great, it\u2019s going to be around about okay. Not great, because you haven\u2019t used your writing muscles very much with only one article. But not bad-bad because you\u2019ve polished it up quite a bit.<\/p>\n<p>But if you wrote 30 articles in one month, it\u2019s quite unlikely that all of them would only be bad-bad or okay. Some of them will be great, and one or two of them might even be excellent.<\/p>\n<p>Of course, you haven\u2019t had the time to polish your work as much, but your writing muscles will be Arnold-Schwarzenegger-size once the month is over. And you\u2019ll have had the time to make every possible mistake, from typos to treading on other people\u2019s feet, and hopefully internalized the lessons.<\/p>\n<p>Now, you might object that programming is rather different to free writing.<\/p>\n<p>Yes, programming is more technical than writing and you might need a lot more background knowledge to even start. But programming is, in its essence, quite a creative discipline.<\/p>\n<p>Programming is basically about finding interesting, elegant, and efficient ways to solve problems with a computer. That\u2019s creative!<\/p>\n<p>Detractors <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.beningo.com\/code-quality-over-quantity\/\">might say<\/a> that 100 pieces of mediocre code are still mediocre, and one piece of great code is therefore better.<\/p>\n<p>But seriously, if you have 100 shots surely you\u2019ll shoot one in the right direction! By the laws of statistics, if 100 pieces of on-average mediocre code, ten will be great and two will be excellent \u2014 and that\u2019s better than one piece of great code.<\/p>\n<p>So code more, make more mistakes, and learn more.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Best_practices_turn_you_into_a_complacent_a-hole\"><\/span>Best practices turn you into a complacent a-hole<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>It boils down to this: You\u2018re free to follow all best practices.<\/p>\n<p>But they might limit your thinking and blind you to more innovative solutions.<\/p>\n<p>If you really want to stand out in a positive way, use best practices as guidelines. Break those guidelines when that seems appropriate to you.<\/p>\n<p>People who always follow the rules become complacent. And complacency, over time, kills success.<\/p>\n<p>Start breaking the rules and you have a shot at joining the great heads.<\/p>\n<p>Repeat yourself if that\u2019s better for you.<\/p>\n<p>Leave your responsibilities tangled if that\u2019s easier to maintain.<\/p>\n<p>Code your own solutions instead of importing existing ones that don\u2019t fit perfectly.<\/p>\n<p>And code more. Much more. Even if it\u2019s bad or buggy. There\u2019ll be a few gemstones in the mess you create.<\/p>\n<p><em>This article was originally published on Medium. You can read it<span>\u00a0<\/span><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/medium.com\/geekculture\/these-best-programming-practices-wont-hold-in-the-future-3eb7b0b9672e\"><span>here<\/span><\/a>.<\/em>\n                        <\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/thenextweb.com\/news\/developers-best-practices-can-turn-you-complacent\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#Oi, developers! \u2018Best practices\u2019 can turn you into complacent a-holes&#8221; Have you ever baked cookies and wondered why the recipe is exactly that way and no other? If you changed this ingredient up or that temperature, would it make the cookies even better? I certainly have had these thoughts. It\u2019s the reason why most of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":409937,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/img-cdn.tnwcdn.com\/image\/tnw?filter_last=1&fit=1280,640&url=https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/dev-burnout-issue-gq.jpg&signature=4ef8fb37e18ff1b6cf7afe843dd089bf","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-409936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/409936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=409936"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/409936\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/409937"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=409936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=409936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=409936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}