{"id":43,"date":"2023-05-04T04:04:33","date_gmt":"2023-05-04T04:04:33","guid":{"rendered":"https:\/\/blog.gwadej.org\/micro-musings\/?p=43"},"modified":"2023-05-05T00:46:47","modified_gmt":"2023-05-05T00:46:47","slug":"are-5-line-methods-a-great-idea","status":"publish","type":"post","link":"https:\/\/blog.gwadej.org\/micro-musings\/2023\/05\/are-5-line-methods-a-great-idea\/","title":{"rendered":"Are 5-line methods a great idea?"},"content":{"rendered":"\n<p>I need to write up a rebuttal of <a rel=\"noreferrer noopener\" href=\"https:\/\/dev.to\/kanani_nirav\/the-five-lines-of-code-principle-why-less-is-more-in-programming-31j6\" target=\"_blank\">5 line code principle<\/a>.<\/p>\n\n\n\n<ul>\n<li>Not every function can be represented cleanly in 5 lines<\/li>\n\n\n\n<li>Slicing up functionality arbitrarily into 5 line methods is unlikely to result in maintainable concepts.<\/li>\n\n\n\n<li>Forth examples<\/li>\n\n\n\n<li>Harder to maintain if you need to go through a large number of methods to understand what&#8217;s happening.<\/li>\n<\/ul>\n\n\n\n<p>My experience has been that it is sometimes useful to extract a <em>concept<\/em> as a method when it makes sense by itself and can be named. If you can&#8217;t think of a good name that covers the concept, then you don&#8217;t have a coherent method.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I need to write up a rebuttal of 5 line code principle. My experience has been that it is sometimes useful to extract a concept as a method when it makes sense by itself and can be named. If you can&#8217;t think of a good name that covers the concept, then you don&#8217;t have a\u2026 <span class=\"read-more\"><a href=\"https:\/\/blog.gwadej.org\/micro-musings\/2023\/05\/are-5-line-methods-a-great-idea\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[22,27,28,25],"_links":{"self":[{"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/posts\/43"}],"collection":[{"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":1,"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":44,"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/posts\/43\/revisions\/44"}],"wp:attachment":[{"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gwadej.org\/micro-musings\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}