{"id":2807,"date":"2009-04-14T11:06:00","date_gmt":"2009-04-14T11:06:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/what-is-maintainable-code\/"},"modified":"2017-08-10T12:53:59","modified_gmt":"2017-08-10T12:53:59","slug":"what-is-maintainable-code","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/what-is-maintainable-code\/","title":{"rendered":"What is &quot;maintainable code&quot;?"},"content":{"rendered":"<p class=\"MsoNormal\">&#8220;Maintainable code&#8221; does not mean the same thing to a DBA as it does to a developer. Production Support staff will want something altogether different from either. These differing perspectives on maintainability have always been a cause of immense grief to IT projects.<\/p>\n<p class=\"MsoNormal\">To a developer, maintainable code simply means &#8220;code that is easy to modify or extend&#8221;. At the heart of maintainability is carefully constructed code that is easy to read; code that is easy to dissect in order to locate the particular component relating to a given change request; code that is then easy to modify without the risk of starting a chain reaction of breakages in dependant modules. <\/p>\n<p class=\"MsoNormal\">Aside from &#8220;common sense&#8221; principles such as keeping code as simple and terse as possible, creating effective documentation, using source control, and so on, developers aim to ensure a clean separation of functionality in their code, with high cohesion and low coupling. They will generally employ a range of tools and techniques, such as MVC patterns, object-relational mapping tools, and test-driven development, which offer the promise of more maintainable code.<\/p>\n<p class=\"MsoNormal\">Unfortunately, such tools mean little to the DBA. They will find little solace in the idea that the code is elegant and object-oriented; it matters little to them if there are few inter-class dependencies. They are not enamoured by object-relational mapping. Maintainable code to a DBA means code that is written to a defined interface, based on routines, so that access rights can be restricted for security, and the SQL can be optimised independently of the application code. It is code that is <a href=\"http:\/\/www.sqlservercentral.com\/articles\/Editorial\/65970\/\">instrumented<\/a> and easy to troubleshoot, where any anomalous conditions within the application are logged, even if they don&#8217;t cause errors.<\/p>\n<p class=\"MsoNormal\">Support staff will be largely unimpressed by either definition of maintainability. For them, a maintainable application provides an easily-accessible list of all possible &#8216;exceptions&#8217;, along with a description of what to do to fix the problem. They want an application that alerts them when there is anything that needs to be corrected, and gives them a step-by-step procedure to do so, or indicates who they should contact. They just want something they can keep upright, no matter what elegant innards lie behind and beyond the &#8216;application unavailable: please contact your administrator&#8217; message.<\/p>\n<p class=\"MsoNormal\">What is the way out of this conundrum? Is it possible to reach a &#8220;consensus&#8221; definition of maintainability, or do we simply need to maintain distinct definitions and make it clearer which &#8220;type&#8221; of maintainability we&#8217;re referring to?<\/p>\n<p class=\"MsoNormal\">As always, we&#8217;d all love to hear what you think. The best contribution to the debate, added as a comment to the editorial blog, will receive a $50 Amazon voucher.<\/p>\n<p class=\"MsoNormal\">Cheers,<\/p>\n<p class=\"MsoNormal\">Tony.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;Maintainable code&#8221; does not mean the same thing to a DBA as it does to a developer. Production Support staff will want something altogether different from either. These differing perspectives on maintainability have always been a cause of immense grief to IT projects. To a developer, maintainable code simply means &#8220;code that is easy to&#8230;&hellip;<\/p>\n","protected":false},"author":200703,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,47125],"tags":[],"coauthors":[],"class_list":["post-2807","post","type-post","status-publish","format-standard","hentry","category-blogs","category-editorials"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/200703"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=2807"}],"version-history":[{"count":3,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2807\/revisions"}],"predecessor-version":[{"id":72052,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2807\/revisions\/72052"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=2807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=2807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=2807"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=2807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}