{"id":17407,"date":"2022-04-01T08:59:00","date_gmt":"2022-04-01T06:59:00","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=17407"},"modified":"2022-06-10T16:41:00","modified_gmt":"2022-06-10T14:41:00","slug":"is-it-always-best-to-reduce-code-lines","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/","title":{"rendered":"Is It Always Best to Reduce Code Lines?"},"content":{"rendered":"\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-916f6f68      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tTable Of Contents\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#reducing-code-lines-less-is-more\" class=\"uagb-toc-link__trigger\">Reducing Code Lines: Less is more?<\/a><li class=\"uagb-toc__list\"><a href=\"#some-benefits-of-reducing-sloc\" class=\"uagb-toc-link__trigger\">Some Benefits of Reducing SLOC<\/a><ul class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#fewer-bugs\" class=\"uagb-toc-link__trigger\">Fewer Bugs<\/a><li class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#same-results-as-longer-code\" class=\"uagb-toc-link__trigger\">Same Results as Longer Code<\/a><li class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#less-code-maintenance-work\" class=\"uagb-toc-link__trigger\">Less Code Maintenance Work<\/a><li class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#more-adaptability-to-other-languages\" class=\"uagb-toc-link__trigger\">More Adaptability to Other Languages<\/a><\/li><\/ul><\/li><li class=\"uagb-toc__list\"><a href=\"#best-practices-for-reducing-code\" class=\"uagb-toc-link__trigger\">Best Practices For Reducing Code<\/a><ul class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#think-before-coding\" class=\"uagb-toc-link__trigger\">Think Before Coding<\/a><li class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#have-your-peers-review-your-code\" class=\"uagb-toc-link__trigger\">Have Your Peers Review Your Code<\/a><li class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#use-performance-analysis-tools\" class=\"uagb-toc-link__trigger\">Use Performance Analysis Tools<\/a><li class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#follow-the-dry-rules-dont-repeat-yourself\" class=\"uagb-toc-link__trigger\">Follow the DRY rules (Don\u2019t Repeat Yourself)<\/a><\/li><\/ul><\/li><\/ul><\/li><li class=\"uagb-toc__list\"><a href=\"#languages-with-fewer-code-lines\" class=\"uagb-toc-link__trigger\">Languages With Fewer Code Lines<\/a><\/ul><\/ul><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\r\n\r\n\r\n<h2 class=\"gb-headline gb-headline-3e7aef85 gb-headline-text\">Reducing Code Lines: Less is more?<\/h2>\r\n\r\n\r\n\r\n<p>In the past, when the size of a typical storage medium was measured in kilobytes, <strong>there was a pressing reason to reduce the lines of code used in a program or game<\/strong>. After all, you can only fit so much data on a five-and-a-quarter floppy disk. <strong>Storage is less of a concern these days<\/strong>, though there is still a school of thought that the fewer lines of code there are, the better, especially when it comes to maintaining your code.<br \/>But is that really the case?<br \/><br \/>Naturally, there are developers who disagree\u2014 those who say that it is not necessary to reduce the number of lines in order to write good code, so which is it?<br \/><br \/>As with many things in life, the answer is far from black and white. It is certainly the case that unnecessary code should be avoided. Code that doesn\u2019t need to be there can cause unforeseen problems, make your software less performant, and make it harder for other developers to perform code maintenance.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-pullquote\">\r\n<blockquote>\r\n<p>Removing unnecessary code will reduce code lines in your software, <strong>but it is the removal of unnecessary code what matters<\/strong>, not the act of reducing the quantity of code.<\/p>\r\n<\/blockquote>\r\n<\/figure>\r\n\r\n\r\n\r\n<p><br \/>The reality is that the answer to this dilemma depends on a few factors, the most significant of which being;<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>The programming language being used<\/li>\r\n<li>The development environment<\/li>\r\n<li>The hardware being developed for<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Some programming languages are particularly verbose, <strong>making it impossible to reduce code lines beyond a certain level because the fundamental components of the code are themselves large. <\/strong>An example of this is Python, which is a high-level language. However, Python is also one of the most popular languages, and needs to be used in an efficient manner.<br \/><br \/>On the other hand, <strong>while <a class=\"ek-link\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/big-data\/logging-in-python-a-broad-gentle-introduction\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Python  (opens in a new tab)\">Python <\/a>is far from cumbersome<\/strong>, some languages are far more streamlined, and not only lend themselves well to a reduced codebase, but even perform noticeably better when less code is being used.<br \/><br \/>Regarding the development environment, it is always good <strong>practice to make your code clear and understandable<\/strong>, even if you have no reason to believe anyone else will ever see it. If you are working in a team environment, however, it is essentially a responsibility to ensure your code can be understood by others, and that sometimes means utilising more lines of code than you would otherwise have needed.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"682\" class=\"wp-image-17268\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/dual-screen-gf53dfbc32_1280-1024x682.png\" alt=\"\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/dual-screen-gf53dfbc32_1280-1024x682.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/dual-screen-gf53dfbc32_1280-300x200.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/dual-screen-gf53dfbc32_1280-768x511.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/dual-screen-gf53dfbc32_1280-600x400.png 600w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/dual-screen-gf53dfbc32_1280.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/>\r\n<figcaption>Fewer code lines are not necessarily always better, but there are many best practices for better code maintenance and performance to keep in mind.<\/figcaption>\r\n<\/figure>\r\n\r\n\r\n\r\n<p>Finally, the hardware being developed for is relevant, even in an age where the average phone has tens of gigabytes of storage. For example <strong>when developing for the web, the less data that needs to be transmitted, the better<\/strong>.<\/p>\r\n\r\n\r\n\r\n<p>So, clearly, whether fewer lines of code is inherently better depends on a lot of things, but for professional developers, there is a deciding factor. <strong>Lines of Code (LOC, or SLOC) is one of the most widely used metrics for code.<\/strong> It is often used as a \u201cfirst-glance\u201d indicator of how complex a codebase is, and, as a result, how difficult it is to carry out code maintenance. In other words, while there may be reasons for and against the arbitrary reduction of code size in a pure coding sense, <strong>the industry as a whole sees reduced SLOC as desirable<\/strong>.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-some-benefits-of-reducing-sloc\">Some Benefits of Reducing SLOC<\/h2>\r\n\r\n\r\n\r\n<p>You can\u2019t make an informed decision on whether to reduce code lines <strong><a class=\"ek-link\" href=\"https:\/\/ieeexplore.ieee.org\/document\/7012875\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"without first knowing what the benefits are (opens in a new tab)\">without first knowing what the benefits are<\/a><\/strong>. Here are some of the most significant reasons to trim the fat from your code;<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-fewer-bugs\">Fewer Bugs<\/h3>\r\n\r\n\r\n\r\n<p>Removing SLOC doesn\u2019t guarantee fewer bugs\u2014in fact, it can create bugs if you\u2019re not careful\u2014but it does reduce the chances of them cropping up. <strong>The longer your code, the more complex it becomes, and the more complex it becomes, the more room there is for things to go wrong<\/strong>. With any program, there is the possibility of new additions causing problems with existing code. This possibility is significantly increased by having more existing code.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-same-results-as-longer-code\">Same Results as Longer Code<\/h3>\r\n\r\n\r\n\r\n<p>Assuming you are not just slicing out essential bits of your code, the end result of trimming down your source code will still be the same output. Given all of the advantages of reducing your code, this removes one critical potential downside. <strong>If the result is going to be the same, why not just make your codebase smaller?<\/strong><\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-less-code-maintenance-work\">Less Code Maintenance Work<\/h3>\r\n\r\n\r\n\r\n<p>Code maintenance is an integral part of modern development. Hardware changes so fast these days, and new methods are always being developed. Having a smaller, less cumbersome codebase makes maintaining your code much easier.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-more-adaptability-to-other-languages\">More Adaptability to Other Languages<\/h3>\r\n\r\n\r\n\r\n<p>In today\u2019s age of interconnected systems, <strong>cross-platform software is a must<\/strong>. Sometimes, making your application cross-platform means porting it to another language. There are other reasons to port your code to another language, of course, but when you do, having fewer lines of code to port will make your life much easier.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-best-practices-for-reducing-code\">Best Practices For Reducing Code<\/h2>\r\n\r\n\r\n\r\n<p>If you that less is more when it comes to SLOC, there are some <strong>best practices<\/strong> to observe that can also be applied in other areas and activities of programming, and that will <strong>help you keep your code light and functional<\/strong>.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-think-before-coding\">Think Before Coding<\/h3>\r\n\r\n\r\n\r\n<p>Few things can lead to messy, bloated code as easily as writing code without a plan. By working through the logic before you start writing your code, you essentially create the shape of what is to come. <strong>Think of working through the logic as drawing the outline of a picture, which you will then \u201ccolour in\u201d with your code<\/strong>. This should help you avoid writing unnecessary code that will later need to be reworked or removed.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-have-your-peers-review-your-code\">Have Your Peers Review Your Code<\/h3>\r\n\r\n\r\n\r\n<p>In almost any process of creation,<strong> it helps to have your work looked over by a new set of eyes<\/strong>, especially when you\u2019ve been working on the same project for a long time. A colleague will often be able to spot problems that you have been missing.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-use-performance-analysis-tools\">Use Performance Analysis Tools<\/h3>\r\n\r\n\r\n\r\n<p>If you are something of a perfectionist, you may run the risk of falling into a spiral of constantly trying to remove just one more line, but there will come a time when you need to stop. <strong>Using performance analysis tools<\/strong> can help you decide when that time is. If you are finding it increasingly hard to find ways to reduce code lines and the performance is unaffected by your changes, it\u2019s probably time to move on.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"h-follow-the-dry-rules-don-t-repeat-yourself\">Follow the DRY rules (Don\u2019t Repeat Yourself)<\/h3>\r\n\r\n\r\n\r\n<p>One of the biggest causes of unnecessarily long code is repetition. Wherever possible, write your code in such a way that your code is reusable, such as by enclosing code blocks in a function if the language supports that (such as Python, or Java). This not only reduces the length of your code, it makes it much easier to make wide-reaching changes on those parts of the code, since one change will take effect across the whole codebase, wherever that function is used.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"724\" class=\"wp-image-16832\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/07\/frontend-4342425_1280-1024x724.png\" alt=\"\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/07\/frontend-4342425_1280-1024x724.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/07\/frontend-4342425_1280-300x212.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/07\/frontend-4342425_1280-768x543.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/07\/frontend-4342425_1280-180x128.png 180w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/07\/frontend-4342425_1280.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/>\r\n<figcaption>Some programming languages are better for achieving less SLOC.<\/figcaption>\r\n<\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-languages-with-fewer-code-lines\">Languages With Fewer Code Lines<\/h2>\r\n\r\n\r\n\r\n<p>As mentioned above, some languages lend themselves better to more efficient use of code lines than others. Here are some good languages for developers who like to keep things compact;<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Python<\/li>\r\n<li>Slant<\/li>\r\n<li>Elixir<\/li>\r\n<li>Smalltalk<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Of course, this is by no means a comprehensive list of languages that involve fewer lines of code in general, but it\u2019s a good starting point. And, generally speaking, <strong>it\u2019s good practice to make your code as efficient as possible regardless of the language<\/strong>. Just remember not to do this at the expense of other necessities, such as making your code clear and understandable to your colleagues, especially if it&#8217;s a program or software that will require lots of code maintenance later on.<\/p>\r\n<p>Recommended article: <a href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/devtools-boosting-your-web-development-workflow-on-chrome-and-firefox\/\">Devtools: Boosting Your Web Development Workflow on Chrome and Firefox<\/a><\/p>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Reducing Code Lines: Less is more? In the past, when the size of a typical storage medium was measured in kilobytes, there was a pressing reason to reduce the lines of code used in a program or game. After all, you can only fit so much data on a five-and-a-quarter floppy disk. Storage is less&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/\">Read more<\/a><\/p>\n","protected":false},"author":64,"featured_media":17414,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":5,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[36],"tags":[6281,9952],"collections":[],"class_list":{"0":"post-17407","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-backend","8":"tag-full-stack-developer","9":"tag-languages","10":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Is It Always Best to Reduce Code Lines? - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"Many devs follow the &quot;Less is More&quot; approach. But are fewer code lines always better? Find out more in this article!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Is It Always Best to Reduce Code Lines?\" \/>\n<meta property=\"og:description\" content=\"Many devs follow the &quot;Less is More&quot; approach. But are fewer code lines always better? Find out more in this article!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-01T06:59:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-10T14:41:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Codemotion\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Codemotion\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/\"},\"author\":{\"name\":\"Codemotion\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/201bb98b02412383686cced7521b861c\"},\"headline\":\"Is It Always Best to Reduce Code Lines?\",\"datePublished\":\"2022-04-01T06:59:00+00:00\",\"dateModified\":\"2022-06-10T14:41:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/\"},\"wordCount\":1347,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/irvan-smith-5eBW5GomfhY-unsplash.jpg\",\"keywords\":[\"Full Stack Developer\",\"Languages\"],\"articleSection\":[\"Backend\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/\",\"name\":\"Is It Always Best to Reduce Code Lines? - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/irvan-smith-5eBW5GomfhY-unsplash.jpg\",\"datePublished\":\"2022-04-01T06:59:00+00:00\",\"dateModified\":\"2022-06-10T14:41:00+00:00\",\"description\":\"Many devs follow the \\\"Less is More\\\" approach. But are fewer code lines always better? Find out more in this article!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/irvan-smith-5eBW5GomfhY-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/irvan-smith-5eBW5GomfhY-unsplash.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/is-it-always-best-to-reduce-code-lines\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Backend\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/backend\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Is It Always Best to Reduce Code Lines?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Codemotion.Italy\\\/\",\"https:\\\/\\\/x.com\\\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/201bb98b02412383686cced7521b861c\",\"name\":\"Codemotion\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/cropped-codemotionlogo-150x150.png\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/cropped-codemotionlogo-150x150.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/cropped-codemotionlogo-150x150.png\",\"caption\":\"Codemotion\"},\"description\":\"Articles wirtten by the Codemotion staff. Tech news, inspiration, latest treends in software development and more.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/CodemotionIT\"],\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/author\\\/codemotion-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Is It Always Best to Reduce Code Lines? - Codemotion Magazine","description":"Many devs follow the \"Less is More\" approach. But are fewer code lines always better? Find out more in this article!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/","og_locale":"en_US","og_type":"article","og_title":"Is It Always Best to Reduce Code Lines?","og_description":"Many devs follow the \"Less is More\" approach. But are fewer code lines always better? Find out more in this article!","og_url":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2022-04-01T06:59:00+00:00","article_modified_time":"2022-06-10T14:41:00+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg","type":"image\/jpeg"}],"author":"Codemotion","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Codemotion","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/"},"author":{"name":"Codemotion","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/201bb98b02412383686cced7521b861c"},"headline":"Is It Always Best to Reduce Code Lines?","datePublished":"2022-04-01T06:59:00+00:00","dateModified":"2022-06-10T14:41:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/"},"wordCount":1347,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg","keywords":["Full Stack Developer","Languages"],"articleSection":["Backend"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/","url":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/","name":"Is It Always Best to Reduce Code Lines? - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg","datePublished":"2022-04-01T06:59:00+00:00","dateModified":"2022-06-10T14:41:00+00:00","description":"Many devs follow the \"Less is More\" approach. But are fewer code lines always better? Find out more in this article!","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/backend\/is-it-always-best-to-reduce-code-lines\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"Backend","item":"https:\/\/www.codemotion.com\/magazine\/backend\/"},{"@type":"ListItem","position":3,"name":"Is It Always Best to Reduce Code Lines?"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/201bb98b02412383686cced7521b861c","name":"Codemotion","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/cropped-codemotionlogo-150x150.png","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/cropped-codemotionlogo-150x150.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/cropped-codemotionlogo-150x150.png","caption":"Codemotion"},"description":"Articles wirtten by the Codemotion staff. Tech news, inspiration, latest treends in software development and more.","sameAs":["https:\/\/x.com\/CodemotionIT"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/codemotion-2\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-600x400.jpg","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-600x600.jpg","author_info":{"display_name":"Codemotion","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/codemotion-2\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg",1920,1080,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-150x150.jpg",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-768x432.jpg",768,432,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-1024x576.jpg",1024,576,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-1536x864.jpg",1536,864,true],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg",1920,1080,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash.jpg",100,56,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-180x128.jpg",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-896x504.jpg",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-400x225.jpg",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-600x400.jpg",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/03\/irvan-smith-5eBW5GomfhY-unsplash-600x600.jpg",600,600,true]},"uagb_author_info":{"display_name":"Codemotion","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/codemotion-2\/"},"uagb_comment_info":0,"uagb_excerpt":"Reducing Code Lines: Less is more? In the past, when the size of a typical storage medium was measured in kilobytes, there was a pressing reason to reduce the lines of code used in a program or game. After all, you can only fit so much data on a five-and-a-quarter floppy disk. Storage is less&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/17407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=17407"}],"version-history":[{"count":7,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/17407\/revisions"}],"predecessor-version":[{"id":18006,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/17407\/revisions\/18006"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/17414"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=17407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=17407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=17407"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=17407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}