{"id":10299,"date":"2022-02-17T15:02:35","date_gmt":"2022-02-17T15:02:35","guid":{"rendered":"http:\/\/TheNextWeb=1380730"},"modified":"2022-02-17T15:02:35","modified_gmt":"2022-02-17T15:02:35","slug":"following-programming-best-practices-will-slow-you-down","status":"publish","type":"post","link":"https:\/\/www.londonchiropracter.com\/?p=10299","title":{"rendered":"Following programming \u2018best practices\u2019 will slow you down"},"content":{"rendered":"\n<p>Who hasn\u2019t stolen a cookie from the jar when Mom wasn\u2019t looking?<\/p>\n<p>Or stayed out with friends long after bedtime?<\/p>\n<p>Or \u2014 God forbid \u2014 taken the shortcut through the park where shady people lurk, instead of going the long way over the main road?<\/p>\n<p>Or, yes oh yes, which programmer hasn\u2019t violated one of those etched-in-stone best practices, you know, one of the ones that you should <em>follow at all costs?<\/em><\/p>\n<p>It\u2019s safe to say that many, if not most, of us have done this before. But maybe your rule-breaking is exactly why your code was better than average. At least it didn\u2019t make you lose your job. Or make your computer explode at runtime.<\/p>\n<p>Sure, breaking rules is never without risk. If you\u2019re a brain surgeon, you really should follow the rule of \u201cnever cut this piece off.\u201d (Forgive me for my bluntness, I\u2019m no medical expert.)<\/p>\n<p>But if you\u2019re building software, what\u2019s the worst case? Sure, if you\u2019re designing killer drones or software for electric grids or support systems for spaceships you might want to go slow and follow the rules.<\/p>\n<p>But those programmers who don\u2019t have high stakes like that \u2014 and that\u2019s most of us \u2014 you might want to question your rulebook from time to time.<\/p>\n<h2>Copy-pasting code isn\u2019t the root of all evil<\/h2>\n<p>The <a href=\"https:\/\/www.whitesourcesoftware.com\/resources\/blog\/copy-and-paste-code\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">die-hard open-sourcers<\/a> and the <a href=\"https:\/\/levelup.gitconnected.com\/why-you-should-never-copy-and-paste-code-from-the-web-41584544036\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">die-hard purists<\/a> may argue otherwise. But, in all earnesty, who hasn\u2019t copy-pasted code snippets from StackOverflow and other places of the big wide internet?<\/p>\n<p>First of all, if you have a problem that takes five seconds to google, you wouldn\u2019t go annoy your coworker for ten minutes to make them fix it. And if the answer is on Stack, then, well, the answer is there.<\/p>\n<p>The purists would argue that you shouldn\u2019t copy anything because you might not understand what\u2019s going on in the copied code. And they have a point.<\/p>\n<p>But if you\u2019re googling around anyway, you\u2019re quite likely going to check the manual pages of the function that you\u2019re copying over anyway. Plus, you\u2019re probably going to need to adjust a few variable names and understand where to put that snippet of code. That\u2019s not possible without a minimum of understanding.<\/p>\n<p>Another point for the purists is that your ready-to-copy-paste code may contain non-printable characters. These are characters like a backspace or a horizontal tab that you can\u2019t see on your screen, but that can have an effect on the output anyway.<\/p>\n<p>Purists would therefore argue that if you\u2019re going to copy code, at least type it yourself so you don\u2019t accidentally copy non-printable characters and make a mess of your project.<\/p>\n<p>That\u2019s cool advice, but personally I don\u2019t know anyone who has ever bumped into a <a href=\"https:\/\/climserv.ipsl.polytechnique.fr\/documentation\/idl_help\/Non-Printing_Characters.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">non-printable character<\/a> and messed up their code. I do know someone, though, who introduces typos everywhere: me.<\/p>\n<figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-featured_img wp-image-1380759 js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-796x531.jpeg\" alt=\"Some bugs you\u2019ll never see with a naked eye. Image by author\" width=\"796\" height=\"531\" sizes=\"(max-width: 796px) 100vw, 796px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-796x531.jpeg 796w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-280x187.jpeg 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-202x135.jpeg 202w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-405x270.jpeg 405w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw.jpeg 1400w\"><figcaption><a href=\"https:\/\/thenextweb.com\/news\/following-programming-best-practices-will-slow-you-down#\" data-url=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Feditorial.thenextweb.com%2Fhouse-of-talent%2F2022%2F02%2F17%2Ffollowing-programming-best-practices-will-slow-you-down%2F&amp;via=thenextweb&amp;related=thenextweb&amp;text=Check out this picture on: Some bugs you\u2019ll never see with a naked eye. Image by author\" data-title=\"Share Some bugs you\u2019ll never see with a naked eye. Image by author on Twitter\" data-width=\"685\" data-height=\"500\" class=\"post-image-share popitup\" title=\"Share Some bugs you\u2019ll never see with a naked eye. Image by author on Twitter\"><i class=\"icon icon--inline icon--twitter--dark\"><\/i><\/a>Some bugs you\u2019ll never see with a naked eye. Image by author<\/figcaption><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-featured_img wp-image-1380759\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-796x531.jpeg\" alt=\"Some bugs you\u2019ll never see with a naked eye. Image by author\" width=\"796\" height=\"531\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-796x531.jpeg 796w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-280x187.jpeg 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-202x135.jpeg 202w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw-405x270.jpeg 405w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_OuWK2jzKr_zcHuD4gMWSjw.jpeg 1400w\"><\/noscript><\/figure>\n<p>To be clear, I agree with the open-sourcers that copying entire open-source codebases to a proprietary project is bad. Not only is it unethical; it also makes your code vulnerable because you might not be in the loop for important security updates any more.<\/p>\n<p>Unfortunately, there will always be programmers who leech of open-source code and pay a bitter price later. Log4j, for example, is a piece of open-source code that parses log information to system administrators. In late 2021, news broke that a vulnerability had allowed hackers to hijack the servers of <a href=\"https:\/\/www.pcmag.com\/news\/countless-serves-are-vulnerable-to-apache-log4j-zero-day-exploit\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare<\/a>, <a href=\"https:\/\/arstechnica.com\/information-technology\/2021\/12\/minecraft-and-other-apps-face-serious-threat-from-new-code-execution-bug\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Minecraft<\/a>, and <a href=\"https:\/\/arstechnica.com\/information-technology\/2021\/12\/the-critical-log4shell-zero-day-affects-a-whos-who-of-big-cloud-services\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Twitter<\/a>, among many others.<\/p>\n<p>We don\u2019t want this to happen of course. So go ahead and copy code, but do so ethically and open-source your code if you can.<\/p>\n<h2>Always owning your code is silly at best<\/h2>\n<p>Back in the old days, people used to argue that your code is like your child: you built it, so you\u2019ll be responsible for anything it does until the day you die. Or some version of this.<\/p>\n<p>That\u2019s B.S. at its best. Yes, you can\u2019t hand off your code to a colleague and put your hands up in the air whenever they have a question about it. And questions will arise even with the best documentation.<\/p>\n<p>So be available when your coworkers use your code, especially in the first few weeks and months after you hand it off.<\/p>\n<p>That being said, of course you should hand off your code! Life gets in the way sometimes, your family needs more attention or you have two dozen other projects on your plate, and stressful deadlines lurking everywhere. And hey, <a href=\"https:\/\/towardsdatascience.com\/7-reasons-why-programmers-burn-out-44a40bf8948d\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">programmers\u2019 burnout is real<\/a>.<\/p>\n<p>Plus, if a seasoned developer has amassed eight dozen different projects and needs to maintain them all, it\u2019s going to be very hard to take another one or two projects onboard, however interesting they may be.<\/p>\n<p>That\u2019s incredibly silly because it stunts future growth. And if there\u2019s one thing that developers want, it\u2019s learning more and growing.<\/p>\n<p>Also, not every code project is a free-time endeavor. People change jobs, you know? You can\u2019t really ask a coder to maintain their old projects at Microsoft when they\u2019ve been working at Facebook for the last two-and-a-half years now. Now it\u2019s the team\u2019s responsibility to keep the code in shape.<\/p>\n<p>Also, teams shouldn\u2019t fall into the pitfall of assigning different pieces of code to different people. This seems cool in the short term, but quite quickly you\u2019ll get <a href=\"https:\/\/www.lightercapital.com\/blog\/what-are-organizational-silos\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">silos<\/a>, and that\u2019s not good at all.<\/p>\n<p>Of course people will know the sections best that they\u2019ve written themselves. But if you make the authors responsible for their code, no-one else will look at it unless they really have to. The authors miss out on important feedback and fresh ideas for their code.<\/p>\n<p>Ownership is important because it adds a sense of responsibility and an incentive to keep bugs and vulnerabilities far, far away. But it should always be a <a href=\"https:\/\/www.freecodecamp.org\/news\/why-code-ownership-sucks-and-you-should-never-work-somewhere-that-practices-it-b8fc1c694074\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">shared responsibility<\/a>, where several people maintain a project.<\/p>\n<figure class=\"post-image post-mediaBleed aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"size-featured_img wp-image-1380760 js-lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-796x531.jpeg\" alt=\"Ownership should always be a shared responsibility. Image by author\" width=\"796\" height=\"531\" sizes=\"(max-width: 796px) 100vw, 796px\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-796x531.jpeg 796w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-280x187.jpeg 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-202x135.jpeg 202w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-405x270.jpeg 405w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA.jpeg 1400w\"><figcaption><a href=\"https:\/\/thenextweb.com\/news\/following-programming-best-practices-will-slow-you-down#\" data-url=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Feditorial.thenextweb.com%2Fhouse-of-talent%2F2022%2F02%2F17%2Ffollowing-programming-best-practices-will-slow-you-down%2F&amp;via=thenextweb&amp;related=thenextweb&amp;text=Check out this picture on: Ownership should always be a shared responsibility. Image by author\" data-title=\"Share Ownership should always be a shared responsibility. Image by author on Twitter\" data-width=\"685\" data-height=\"500\" class=\"post-image-share popitup\" title=\"Share Ownership should always be a shared responsibility. Image by author on Twitter\"><i class=\"icon icon--inline icon--twitter--dark\"><\/i><\/a>Ownership should always be a shared responsibility. Image by author<\/figcaption><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-featured_img wp-image-1380760\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-796x531.jpeg\" alt=\"Ownership should always be a shared responsibility. Image by author\" width=\"796\" height=\"531\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-796x531.jpeg 796w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-280x187.jpeg 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-202x135.jpeg 202w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA-405x270.jpeg 405w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/02\/1_0fc5RzMzeH-pYSUiVrOjaA.jpeg 1400w\"><\/noscript><\/figure>\n<h2>Unit tests slow you down massively \u2014 the experts agree<\/h2>\n<p>Back in 2008, when <a href=\"https:\/\/blog.codinghorror.com\/introducing-stackoverflow-com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">StackOverflow was founded<\/a>, there was no obvious way to build a Q&amp;A site at a large scale.<\/p>\n<p>Today this type of project is a <a href=\"https:\/\/dev.to\/codicacom\/key-ways-to-build-a-q-a-website-192d\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">textbook task<\/a>. But back then, before AWS, no-code web development, and graphic point-and-click database management\u2026<\/p>\n<p>StackOverflow, above everything else, wanted to be a website that works for the user. So they decided to make performance their number-one priority and put testing somewhere in the lower end of the list.<\/p>\n<p>Yes, StackOverflow, home to the gurus of programming, <a href=\"https:\/\/stackoverflow.blog\/2021\/12\/22\/best-practices-can-slow-your-application-down\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">didn\u2019t test everything<\/a>. They didn\u2019t test very much at all in the beginning!<\/p>\n<p>These days, not only is testing mandatory, but there are even <em><a href=\"https:\/\/www.clouddefense.ai\/blog\/10-best-practices-for-software-testing-projects\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">best practices for testing itself<\/a><\/em>. Yup, you heard me right. This best practice breaks down to many more best practices, that\u2019s just how important it is to some people.<\/p>\n<p>So what\u2019s the deal? Don\u2019t you want to make sure that your code works?<\/p>\n<p>Yes, but\u2026 <a href=\"https:\/\/techbeacon.com\/app-dev-testing\/are-your-app-tests-slowing-you-down\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Tests take time<\/a>. You don\u2019t always have time galore.<\/p>\n<p>First of all, tests take time to execute. You don\u2019t want to spend 20 minutes executing a website\u2019s tests to death when the user on the other end just wants to, say, read a blog post.<\/p>\n<p>Second, tests take time out of developers\u2019 days. Every time a developer wants to add a new feature, they will have to add or custom-build the necessary tests and find the right place for their tests in the existing test suite.<\/p>\n<p>Over time, this just gets expensive.<\/p>\n<p>There are two ways around this: Either you have a full test suite but only test for the most important things when a user wants something. Or you only write the most necessary tests in the first place.<\/p>\n<p>This sounds very shaky, but you can make the architecture itself more robust so you don\u2019t need so many tests.<\/p>\n<p>Need an example? <a href=\"https:\/\/stackoverflow.blog\/2021\/12\/22\/best-practices-can-slow-your-application-down\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">StackOverflow is your friend<\/a>, as usual.<\/p>\n<h2>The bottom line: Best practices get in the way of speed<\/h2>\n<p>I don\u2019t want you to throw your whole rulebook out the window and code like a chaotic berserker. But if you can, please don\u2019t follow the rulebook to the letter either.<\/p>\n<p>If you copy-paste a snippet from StackOverflow or any other site, you won\u2019t be punished. As long as you understand that piece of code and are able to make the necessary adjustments anyway.<\/p>\n<p>Copy-paste an whole open-source project into your own proprietary project and <a href=\"https:\/\/opensource.guide\/legal\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">you\u2019re in legal trouble<\/a>. Don\u2019t keep your copy-pasted stuff up-to-date and you might get in trouble with hackers who exploit your vulnerabilities.<\/p>\n<p>Ownership, certainly single ownership, is bogus. Try to assign every project to multiple people. Learn to let go of your code projects and give them to other people. Free your mind and your calendar for new things!<\/p>\n<p>And don\u2019t test your code to death. Test where things could go wrong, and where you suspect hackers could do harm. Test where it\u2019s necessary, and let the architecture take care of the rest.<\/p>\n<p>I\u2019m not suggesting you do a 180 to everything you did. Instead, try breaking every rule in ways that make sense for the task at hand. Besides, breaking the rules is fun \u2014 whether it\u2019s having a forbidden cookie, hanging out with friends for too long, or coding in unconventional ways.<\/p>\n<p>You can build good things by following all the rules. You\u2019ll build great things by following all the rules that make sense, and throwing all the rest away.<\/p>\n<p><em>This article was originally published on Medium. You can read it<a href=\"https:\/\/medium.com\/geekculture\/want-to-be-unproductive-follow-best-programming-practices-d32e72b9b338\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span> here<\/span><\/a>.<\/em><\/p>\n<p> <a href=\"https:\/\/thenextweb.com\/news\/following-programming-best-practices-will-slow-you-down\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Who hasn\u2019t stolen a cookie from the jar when Mom wasn\u2019t looking? Or stayed out with friends long after bedtime? Or \u2014 God forbid \u2014 taken the shortcut through the park where&#8230;<\/p>\n","protected":false},"author":1,"featured_media":10300,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts\/10299"}],"collection":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10299"}],"version-history":[{"count":0,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts\/10299\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/media\/10300"}],"wp:attachment":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}