{"id":3578,"date":"2021-09-21T23:47:17","date_gmt":"2021-09-21T18:17:17","guid":{"rendered":"https:\/\/lgconsultancy.wpcomstaging.com\/?p=3578"},"modified":"2022-08-02T09:47:34","modified_gmt":"2022-08-02T09:47:34","slug":"clean-code-function","status":"publish","type":"post","link":"https:\/\/lng-consultancy.com\/staging\/5474\/clean-code-function\/","title":{"rendered":"Clean Code &#8211; Function"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">Cost of Owning a Mess<\/p>\n\n\n\n<p class=\"has-text-align-left wp-block-paragraph\">If you have been a programmer for more than two or three years, you have probably been significantly slowed down by someone else\u2019s messy code. If you have been a programmer for longer than two or three years, you have probably been slowed down by messy code. The degree of the slowdown can be significant. Over the span of a year or two, teams that were moving very fast at the beginning of a project can find themselves moving at a snail\u2019s pace. Every change they make to the code breaks two or three other parts of the code. No change is trivial. Every addition or modification to the system requires that the tangles, twists, and knots be \u201cunderstood\u201d so that more tangles, twists, and knots can be added. Over time the mess becomes so big and so deep and so tall, they can not clean it up. There is no way at all.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/lgconsultancy.wpcomstaging.com\/wp-content\/uploads\/2021\/09\/mess-fb97aa4b05c7ea0f06cdd00694d6a9af-bf397.png?ssl=1\" alt=\"\" class=\"wp-image-3587\"\/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">What is Clean Code?<\/h2>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Bjarne Stroustrup, inventor of C++<\/p><cite>I like my code to be elegant and efficient. The logic should be straightforward to make it hard for bugs to hide, the dependencies minimal to ease maintenance, error handling complete according to an articulated strategy, and performance close to optimal so as not to tempt people to make the code messy with unprincipled optimizations. Clean code does one thing well.<\/cite><\/blockquote>\n<\/div>\n<\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Dave Thomas,Founder of OTI<\/p><cite>Clean code can be read, and enhanced by a developer other than its original author. It has unit and acceptance tests. It has meaningful names. It provides one way rather than many ways for doing one thing. It has minimal dependencies, which are explicitly defined, and provides a clear and minimal API. Code should be literate since depending on the language, not all necessary information can be expressed clearly in code alone.<\/cite><\/blockquote>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Functions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Sample Function<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Read through this function and let me know what you understand.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" height=\"1024\" width=\"829\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/lgconsultancy.wpcomstaging.com\/wp-content\/uploads\/2021\/09\/image-5-829x1024.png?resize=829%2C1024&ssl=1\" alt=\"\" class=\"wp-image-3630\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/lgconsultancy.wpcomstaging.com\/wp-content\/uploads\/2021\/09\/image-6.png?ssl=1\" alt=\"\" class=\"wp-image-3631\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Do you understand the function after five minutes of study? Probably not. There\u2019s too much going on in there at too many different levels of abstraction. <br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, with just a few simple method extractions, some renaming, and a little<br>restructuring the above will look like this.<br><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/lgconsultancy.wpcomstaging.com\/wp-content\/uploads\/2021\/09\/image-7.png?ssl=1\" alt=\"\" class=\"wp-image-3633\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br><strong>SMALL!<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that.<br><br><strong>BLOCKS AND INDENTING<\/strong><br><br>This implies that the blocks within if statements, else statements, while statements, and so on should be one line long. Probably that line should be a function call. Not only does this keep the enclosing function small, but it also adds documentary value because the function called within the block can have a nicely descriptive name. This also implies that functions should not be large enough to hold nested structures. Therefore, the indent level of a function should not be greater than one or two. This, of course, makes the functions easier to read and understand.<br><br><strong>DO ONE THING<\/strong><br><br>Functions should do one thing. They should do it well. They should do it only.<br><br><strong>SWITCH STATEMENTS<\/strong><br><br>It\u2019s hard to make a small switch statement. Even a switch statement with only two cases is larger than I\u2019d like a single block or function to be. It\u2019s also hard to make a switch statement that does one thing. By their nature, switch statements always do N things. Unfortunately, we can\u2019t always avoid switch statements, but we can make sure that each switch statement is buried in a low-level class and is never repeated. We do this, of course, with polymorphism.<br><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/lgconsultancy.wpcomstaging.com\/wp-content\/uploads\/2021\/09\/image-8.png?ssl=1\" alt=\"\" class=\"wp-image-3638\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">There are several problems with this function. First, it\u2019s large, and when new employee types are added, it will grow. Second, it very clearly does more than one thing. Third, it violates the Single Responsibility Principle7 (SRP) because there is more than one reason for it to change. Fourth, it violates the Open-Closed Principle8 (OCP) because it must change whenever new types are added. But possibly the worst problem with this function is that there is an unlimited number of other functions that will have the same structure. For example, we could have<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">isPayDay(Employee e, Date date)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">or<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">deliverPay(Employee e, Money pay)<br><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The solution to this problem is to bury the switch statement in the basement of an ABSTRACT FACTORY, and never let anyone see it. The factory will use the switch statement to create appropriate instances of the derivatives of Employee, and the various functions, such as calculatePay, isPayday, and deliverPay, will be dispatched polymorphically through the Employee interface.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/lgconsultancy.wpcomstaging.com\/wp-content\/uploads\/2021\/09\/image-9.png?ssl=1\" alt=\"\" class=\"wp-image-3643\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">OTHER THINGS TO BE TAKEN CARE OF<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Extract Try\/Catch Block<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Try\/catch blocks are ugly in their own right. They confuse the structure of the code and<br>mix error processing with normal processing. So it is better to extract the bodies of the try<br>and catch blocks out into functions of their own.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public void delete(Page page) \n{\n try \n {\n    deletePageAndAllReferences(page);\n }\n catch(Exception e)\n {\n   logError(e);\n }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">DRY (Don\u2019t Repeat Yourself)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Look at the code below and figure out if we are breaking the DRY principle?<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class CsvValidation\n{\n    public function validateProduct(array product)\n    {\n        if (product['color']==null) {\n            throw new Exception('Import fail: the product attribute color is missing');\n        }\n\n        if (product['size']==null) {\n            throw new Exception('Import fail: the product attribute size is missing');\n        }\n\n        if (product['type']==null) {\n            throw new Exception('Import fail: the product attribute type is missing');\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>Implementing DRY Principle<\/em><\/strong>\n\nclass CsvValidation\n{\n    private productAttributes = [\n        'color',\n        'size',\n        'type',\n    ];\n\n    public function validateProduct(array product)\n    {\n        foreach (attributes in productAttributes) {\n            if ((product[attribute]==null)) {\n                throw new Exception(sprintf($'Import fail: the product attribute {attribute} is missing'));\n            }\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Naming Varibales<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Use Intention Revealing Names<br><br>Wrong Naming : <strong>int eTD; \/\/ elapsed time in days<\/strong><br>Correct Naming:  <strong>int elapsedTimeInDays;<\/strong><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Use Searchables Names<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">LAST IMPORTANT RULE<\/h2>\n\n\n\n<figure class=\"wp-block-pullquote\"><blockquote><p>The Boy Scout Rule<\/p><cite>Leave the campground cleaner than you found it<br><\/cite><\/blockquote><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">References: Clean Code (Robert C. Martin Series)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cost of Owning a Mess If you have been a programmer for more than two or three years, you have probably been significantly slowed down by someone else\u2019s messy code. If you have been a programmer for longer than two or three years, you have probably been slowed down by messy code. The degree of [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":7277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"nf_dc_page":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32],"tags":[],"class_list":["post-3578","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Clean Code - Function - L&amp;G Consultancy<\/title>\n<meta name=\"description\" content=\"Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. (Source: Clean Code By James O. Coplin)\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/landg-consultancy.com\/clean-code-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clean Code - Function - L&amp;G Consultancy\" \/>\n<meta property=\"og:description\" content=\"Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. (Source: Clean Code By James O. Coplin)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/landg-consultancy.com\/clean-code-function\/\" \/>\n<meta property=\"og:site_name\" content=\"L&amp;G Consultancy\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-21T18:17:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-02T09:47:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/landg-consultancy.com\/wp-content\/uploads\/2021\/09\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Vikas Nischal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vikas Nischal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/\"},\"author\":{\"name\":\"Vikas Nischal\",\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#\\\/schema\\\/person\\\/d560d6fb8a51d230ff9229f34695e532\"},\"headline\":\"Clean Code &#8211; Function\",\"datePublished\":\"2021-09-21T18:17:17+00:00\",\"dateModified\":\"2022-08-02T09:47:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/\"},\"wordCount\":882,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/\",\"url\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/\",\"name\":\"Clean Code - Function - L&amp;G Consultancy\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1\",\"datePublished\":\"2021-09-21T18:17:17+00:00\",\"dateModified\":\"2022-08-02T09:47:34+00:00\",\"author\":{\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#\\\/schema\\\/person\\\/d560d6fb8a51d230ff9229f34695e532\"},\"description\":\"Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. (Source: Clean Code By James O. Coplin)\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/clean-code-function\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/lng-consultancy.com\\\/staging\\\/5474\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Clean Code &#8211; Function\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#website\",\"url\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/\",\"name\":\"L&amp;G Consultancy\",\"description\":\"Your Technology Partner\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#\\\/schema\\\/person\\\/d560d6fb8a51d230ff9229f34695e532\",\"name\":\"Vikas Nischal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/034504f4504c9b7a9591412df928818f55518fd3376f4a01e64e5811ceac5b9a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/034504f4504c9b7a9591412df928818f55518fd3376f4a01e64e5811ceac5b9a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/034504f4504c9b7a9591412df928818f55518fd3376f4a01e64e5811ceac5b9a?s=96&d=mm&r=g\",\"caption\":\"Vikas Nischal\"},\"url\":\"https:\\\/\\\/lng-consultancy.com\\\/staging\\\/5474\\\/author\\\/nischalvn\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Clean Code - Function - L&amp;G Consultancy","description":"Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. (Source: Clean Code By James O. Coplin)","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:\/\/landg-consultancy.com\/clean-code-function\/","og_locale":"en_US","og_type":"article","og_title":"Clean Code - Function - L&amp;G Consultancy","og_description":"Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. (Source: Clean Code By James O. Coplin)","og_url":"https:\/\/landg-consultancy.com\/clean-code-function\/","og_site_name":"L&amp;G Consultancy","article_published_time":"2021-09-21T18:17:17+00:00","article_modified_time":"2022-08-02T09:47:34+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/i0.wp.com\/landg-consultancy.com\/wp-content\/uploads\/2021\/09\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1","type":"image\/jpeg"}],"author":"Vikas Nischal","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vikas Nischal","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/landg-consultancy.com\/clean-code-function\/#article","isPartOf":{"@id":"https:\/\/landg-consultancy.com\/clean-code-function\/"},"author":{"name":"Vikas Nischal","@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#\/schema\/person\/d560d6fb8a51d230ff9229f34695e532"},"headline":"Clean Code &#8211; Function","datePublished":"2021-09-21T18:17:17+00:00","dateModified":"2022-08-02T09:47:34+00:00","mainEntityOfPage":{"@id":"https:\/\/landg-consultancy.com\/clean-code-function\/"},"wordCount":882,"commentCount":0,"image":{"@id":"https:\/\/landg-consultancy.com\/clean-code-function\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2021\/09\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1","articleSection":["Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/landg-consultancy.com\/clean-code-function\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/landg-consultancy.com\/clean-code-function\/","url":"https:\/\/landg-consultancy.com\/clean-code-function\/","name":"Clean Code - Function - L&amp;G Consultancy","isPartOf":{"@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#website"},"primaryImageOfPage":{"@id":"https:\/\/landg-consultancy.com\/clean-code-function\/#primaryimage"},"image":{"@id":"https:\/\/landg-consultancy.com\/clean-code-function\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2021\/09\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1","datePublished":"2021-09-21T18:17:17+00:00","dateModified":"2022-08-02T09:47:34+00:00","author":{"@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#\/schema\/person\/d560d6fb8a51d230ff9229f34695e532"},"description":"Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. (Source: Clean Code By James O. Coplin)","breadcrumb":{"@id":"https:\/\/landg-consultancy.com\/clean-code-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/landg-consultancy.com\/clean-code-function\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/landg-consultancy.com\/clean-code-function\/#primaryimage","url":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2021\/09\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1","contentUrl":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2021\/09\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/landg-consultancy.com\/clean-code-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lng-consultancy.com\/staging\/5474\/"},{"@type":"ListItem","position":2,"name":"Clean Code &#8211; Function"}]},{"@type":"WebSite","@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#website","url":"http:\/\/sh024.global.temp.domains\/~landgcon\/","name":"L&amp;G Consultancy","description":"Your Technology Partner","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/sh024.global.temp.domains\/~landgcon\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#\/schema\/person\/d560d6fb8a51d230ff9229f34695e532","name":"Vikas Nischal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/034504f4504c9b7a9591412df928818f55518fd3376f4a01e64e5811ceac5b9a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/034504f4504c9b7a9591412df928818f55518fd3376f4a01e64e5811ceac5b9a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/034504f4504c9b7a9591412df928818f55518fd3376f4a01e64e5811ceac5b9a?s=96&d=mm&r=g","caption":"Vikas Nischal"},"url":"https:\/\/lng-consultancy.com\/staging\/5474\/author\/nischalvn\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2021\/09\/Untitled-design-13.jpg?fit=1200%2C628&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts\/3578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/comments?post=3578"}],"version-history":[{"count":1,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts\/3578\/revisions"}],"predecessor-version":[{"id":7278,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts\/3578\/revisions\/7278"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/media\/7277"}],"wp:attachment":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/media?parent=3578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/categories?post=3578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/tags?post=3578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}