{"id":2136,"date":"2017-10-27T17:55:23","date_gmt":"2017-10-27T17:55:23","guid":{"rendered":"https:\/\/solutionstreet.com\/blog\/?p=2136"},"modified":"2017-10-27T17:55:23","modified_gmt":"2017-10-27T17:55:23","slug":"avoid-code-thinking-the-pitfalls-of-trial-and-error-coding","status":"publish","type":"post","link":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/","title":{"rendered":"Avoid CodeThinking &#8211; The Pitfalls of Trial and Error Coding"},"content":{"rendered":"<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png\" alt=\"octoberthinkerfulltitle1 copy\" width=\"600\" height=\"430\" class=\"aligncenter size-medium wp-image-2152\" srcset=\"https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png 300w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy.png 766w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Do you suffer from this issue? I can\u2019t tell you how many developers I have seen who fall into this trap. I certainly have from time to time. I can\u2019t say that using coding instead of thinking is always bad, but in so many cases it turns good code from simple elegance into a whole lot of mangled spaghetti.<\/p>\n<p>&nbsp;<\/p>\n<p>What is CodeThinking and why should you avoid it? CodeThinking is when you use trial and error coding instead of just taking a step back to rethink the problem you are trying to solve. <\/p>\n<p>&nbsp;<\/p>\n<p>Consider this \u2018non-technical\u2019 example of CodeThinking. Think back to your school days when your teacher asks you to write about what you did over the summer. For this assignment, the teacher requires each paragraph to (1) thoroughly describe an event or activity and (2) have a minimum of four adjectives. You write several paragraphs and reread your work noticing that for many paragraphs you&#8217;ve missed some things. For example, one of your original paragraphs may have been:<\/p>\n<p>&nbsp;<\/p>\n<div style=\"padding:12px;background-color:#EEE9E9;line-height:1.2;margin:40px;border:1px solid #ccc;\nborder-radius:6px;\nbox-shadow: 1px #ccc;border-left:5px solid #61963D;\">One of the highlights of the summer was a trip I took with my family to the beach. We spent two weeks at a resort and swam in the ocean, played games, and took walks.\n<\/div>\n<p>&nbsp;<\/p>\n<p>After reading the paragraph, you see that you don&#8217;t have enough adjectives, so you decide to quickly &#8216;fit in&#8217; a few to the text as is, adding these words (shown in bold):<\/p>\n<p>&nbsp;<\/p>\n<div style=\"padding:12px 1.2em;background-color:#EEE9E9;line-height:1.2;margin:40px;border:1px solid #ccc;\nborder-radius:6px;\nbox-shadow: 1px #ccc;border-left:5px solid #61963D;\">One of the highlights of the summer was a trip I took with my family to the <strong>beautiful<\/strong> beach. We spent two weeks at a <strong>seaside<\/strong> resort and swam in the <strong>blue<\/strong> ocean, played games, and took <strong>long<\/strong> walks.\n<\/div>\n<p>&nbsp;<\/p>\n<p>Now when you reread it, you realize that it includes the minimum number of adjectives, but it&#8217;s questionable as to how &#8216;thoroughly&#8217; you&#8217;ve described the event so you retrofit a couple of sentences:<\/p>\n<p>&nbsp;<\/p>\n<div style=\"padding:12px 1.2em;background-color:#EEE9E9;line-height:1.2;margin:40px;border:1px solid #ccc;\nborder-radius:6px;\nbox-shadow: 1px #ccc;border-left:5px solid #61963D;\">One of the highlights of the summer was a trip I took with my family to the beautiful beach. <strong>We drove to the beach which took four hours. It was a yellow car.<\/strong> We spent two weeks at a seaside resort and swam in the blue ocean, played games, and took long walks.\n<\/div>\n<p>&nbsp;<\/p>\n<p>Although you have now added some descriptions along with the adjectives, the sentences are rather choppy and uninteresting. Could there be a better way? Yes &#8211; instead of going back and adding pieces one by one, a more effective strategy is to take a step back, plan your approach and how you can incorporate all parts of the assignment, and compose the paragraph in a comprehensive way. For instance:<\/p>\n<p>&nbsp;<\/p>\n<div style=\"padding:12px 1.2em;background-color:#EEE9E9;line-height:1.2;margin:40px;border:1px solid #ccc;\nborder-radius:6px;\nbox-shadow: 1px #ccc;border-left:5px solid #61963D;\">One of the highlights of the summer was a trip I took with my family to the beach. My entire family, and even my dogs, spent two weeks at a seaside resort. The morning we left for the beach, we packed up our yellow car and drove for four hours singing along to the radio. When we reached the resort, we were awed by the clear, blue ocean and immediately went swimming. In the evening, we took a long walk with our dogs. The weather was so beautiful and the water so warm during our entire trip, that we swam each day and walked or played games each night.\n<\/div>\n<p>&nbsp;<\/p>\n<p>By taking a moment to consider the assignment as a whole and organize the content before tackling it as in the example above, the end result not only fulfills all the requirements of the assignment, but makes for a cohesive, flowing end product.<\/p>\n<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/DeskGuy.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/DeskGuy-300x263.png\" alt=\"DeskGuy\" width=\"300\" height=\"263\" class=\"aligncenter size-medium wp-image-2161\" srcset=\"https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/DeskGuy-300x263.png 300w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/DeskGuy.png 429w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>With coding, the example is similar. You are starting with an idea on how to solve a particular problem. You begin coding. You then realize that your solution doesn\u2019t address all scenarios and you start coding around your current code (using \u2018if\u2019 conditions and the like) to account for alternate scenarios. You may come to a solution that works, but is it the right solution? Does it make sense? Is it understandable? Could it be written simpler and more elegantly? Is it easy to maintain? <\/p>\n<p>&nbsp;<\/p>\n<p>Let\u2019s take a coding example. <\/p>\n<p>&nbsp;<\/p>\n<p>Let\u2019s say you understand the problem as follows: Given a string of characters you are to alter the string by moving each character from the front to the back of the string a number of times based on a designated number parameter. So, using the word &#8216;CodeThinking&#8217; and the number &#8216;3&#8217; you would get &#8216;eThinkingCod&#8217; returned. You may quickly say to yourself, \u201cThat\u2019s easy, I\u2019ll just chop off &#8216;n&#8217; number of characters from the front and move them to the back using basic substring functionality.\u201d  You then proceed to write the following:<\/p>\n<p>&nbsp;<\/p>\n<pre lang=\"javascript\" line=\"1\">\nfunction rotate(myStr, numOfCharsToRotate) {\n  \/\/ chop off what becomes the first part\n  var lastPart = myStr.substring(0,numOfCharsToRotate); \n  \/\/ get remaining part\n  var firstPart = myStr.substring(numOfCharsToRotate);  \n  \/\/ glue them together\n  return firstPart + lastPart;\n}\n\nconsole.log(rotate('Arthur',2));\n\u21d2 \u201cthurAr\u201d\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Great. That works! You&#8217;ve even added comments to show that you&#8217;re simply taking &#8216;n&#8217; characters from the front of the word\/string and moving them to the end. But wait! You now realize this problem was harder than you thought &#8211; as most coding problems are. You haven\u2019t thought through the different scenarios and you realize that the end result is not the same if you use a negative number. Unlike a positive number, this function handles a negative number by rotating the characters in the other direction. (Maybe you didn\u2019t think of this initially or maybe this wasn\u2019t in the original spec\/ticket\/discussion, but new scenarios emerge). So what do you do? You write an \u2018if\u2019 condition to handle that case (highlighted below):<\/p>\n<p>&nbsp;<\/p>\n<pre lang=\"javascript\" line=\"1\" highlight=\"4,5,6,7,8,9,10\">\nfunction rotate(myStr, numOfCharsToRotate) {\n  var lastPart;\n  var firstPart;\n  if (numOfCharsToRotate < 0) {\n     \/\/ when it\u2019s a negative number move the chars in reverse \n    var myStrLength = myStr.length;\n    \/\/ chop off what becomes the first part\n    lastPart = myStr.substring(0,myStrLength - (numOfCharsToRotate * -1)); \n    \/\/ get remaining part\n    firstPart = myStr.substring(myStrLength - (numOfCharsToRotate * -1));      \n  } else {\n    \/\/ chop off what becomes the first part\n    lastPart = myStr.substring(0,numOfCharsToRotate); \n    \/\/ get remaining part\n    firstPart = myStr.substring(numOfCharsToRotate);      \n  }\n  \/\/ glue them together\n  return firstPart + lastPart;\n}\n\nconsole.log(rotate('Arthur',2));\n\u21d2 \u201cthurAr\u201d\n\nconsole.log(rotate('Arthur',-2));\n\u21d2 \u201curArth\u201d\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Great. That works! You don\u2019t feel too bad, because even if you\u2019ve doubled your lines of code by adding some confusing substring calculations, anyone reading this can mostly make out what you are doing. But wait! You now realize that you haven\u2019t thought this problem all the way through. You hadn't considered the possible case of a really large number, a number larger than the number of characters in the word\/string; essentially cycling the letters of the string over and over again. Now you say to yourself, \"Hmmm. How am I going to handle that? Well, because this is only an issue if my number is greater than the length of the string, I\u2019ll just add an \u2018if\u2019 condition for that. This should be easy since I can just use the modulus operator to deal with that scenario.\" So you write another 'if' condition:<\/p>\n<p>&nbsp;<\/p>\n<pre lang=\"javascript\" line=\"1\" highlight=\"5,6,7,8\">\nfunction rotate(myStr, numOfCharsToRotate) {\n  var lastPart;\n  var firstPart;\n  \n  if (numOfCharsToRotate > myStr.length) {\n    \/\/ for large numbers we need to simplify\n    numOfCharsToRotate = numOfCharsToRotate % myStr.length;\n  } \n  if (numOfCharsToRotate < 0) {\n    var myStrLength = myStr.length;\n    \/\/ chop off what becomes the first part\n    lastPart = myStr.substring(0,myStrLength - (numOfCharsToRotate * -1)); \n    \/\/ get remaining part\n    firstPart = myStr.substring(myStrLength - (numOfCharsToRotate * -1));      \n  } else {\n    \/\/ chop off what becomes the first part\n    lastPart = myStr.substring(0,numOfCharsToRotate); \n    \/\/ get remaining part\n    firstPart = myStr.substring(numOfCharsToRotate);      \n  }\n  \/\/ glue them together\n  return firstPart + lastPart;\n}\n\nconsole.log(rotate('Arthur',2));\n\u21d2 \u201cthurAr\u201d\n\nconsole.log(rotate('Arthur',-2));\n\u21d2 \u201curArth\u201d\n\nconsole.log(rotate('Arthur',19));\n\u21d2 \u201crthurA\u201d \n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Great. That works! Uh, actually it doesn\u2019t. You realize that you're not handling really large negative numbers. What do you do? Well, you think to yourself, \"I can add an \u2018if\u2019 condition and handle that!\" No!!!!! You can continue with this example and although you may end up with a solution that 'works', this is not quality, maintainable code. This is code spaghetti. Something you should avoid.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/spaghetticrop.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/spaghetticrop-300x270.png\" alt=\"spaghetticrop\" width=\"300\" height=\"270\" class=\"alignnone size-medium wp-image-2165\" srcset=\"https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/spaghetticrop-300x270.png 300w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/spaghetticrop-768x692.png 768w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/spaghetticrop.png 933w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Obviously this example may not be real world, but as a developer you have seen problems like this where you try and address the 'happy path' first, but then realize your solution doesn\u2019t work in all cases. We, as developers, use the tools in front of us and often find we'd prefer to code more lines instead of deleting anything we\u2019ve already written. <\/p>\n<p>&nbsp;<\/p>\n<p>If you find out that your solution doesn\u2019t work after you start coding, it's best not to append your code with more and more \u2018if\u2019 conditions. Stop, take a step back, and think. Look at your inputs and outputs. Think about all of the different scenarios. Identify an approach that satisfies the requirements fully. And THEN code!<\/p>\n<p>&nbsp;<\/p>\n<p>Now that I\u2019ve blasted CodeThinking, I can tell you that there are certainly instances where using Coding to solve a problem is acceptable. For example, I (and many others) use a Ruby console or a Rails console (coding playgrounds) to test out ideas. There are equivalents in other software languages and frameworks. This is a highly useful way to help solve problems using Coding. The main difference here is that this Coding is throwaway. The developer is just using their code to help solve a problem and then throw away the quick and dirty code and actually determine a solution that is efficient and elegant.<\/p>\n<p>&nbsp;<\/p>\n<p>Coding Challenge: If you are a developer who can solve my coding exercise the 'right' way, then Solution Street may be a fit for you!  Please feel free to send solutions to <a href=\"mailto:jobs@solutionstreet.com\" target=\"_blank\" rel=\"noopener\">jobs@solutionstreet.com<\/a> with your resume.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Do you suffer from this issue? I can\u2019t tell you how many developers I have seen who fall into this trap. I certainly have from time to time. I can\u2019t say that using coding instead of thinking is always bad, but in so many cases it turns good code from simple elegance into a [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2136","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Avoid CodeThinking - The Pitfalls of Trial and Error Coding - Solution Street Blog<\/title>\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.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Avoid CodeThinking - The Pitfalls of Trial and Error Coding - Solution Street Blog\" \/>\n<meta property=\"og:description\" content=\"&nbsp; Do you suffer from this issue? I can\u2019t tell you how many developers I have seen who fall into this trap. I certainly have from time to time. I can\u2019t say that using coding instead of thinking is always bad, but in so many cases it turns good code from simple elegance into a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/\" \/>\n<meta property=\"og:site_name\" content=\"Solution Street Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-10-27T17:55:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png\" \/>\n<meta name=\"author\" content=\"Peggy Frankel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Peggy Frankel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/\"},\"author\":{\"name\":\"Peggy Frankel\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#\\\/schema\\\/person\\\/c4846451eff30e9514b534b2a2e01696\"},\"headline\":\"Avoid CodeThinking &#8211; The Pitfalls of Trial and Error Coding\",\"datePublished\":\"2017-10-27T17:55:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/\"},\"wordCount\":1426,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/octoberthinkerfulltitle1-copy-300x215.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/\",\"url\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/\",\"name\":\"Avoid CodeThinking - The Pitfalls of Trial and Error Coding - Solution Street Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/octoberthinkerfulltitle1-copy-300x215.png\",\"datePublished\":\"2017-10-27T17:55:23+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#\\\/schema\\\/person\\\/c4846451eff30e9514b534b2a2e01696\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#primaryimage\",\"url\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/octoberthinkerfulltitle1-copy-300x215.png\",\"contentUrl\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/octoberthinkerfulltitle1-copy-300x215.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2017\\\/10\\\/27\\\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Avoid CodeThinking &#8211; The Pitfalls of Trial and Error Coding\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/\",\"name\":\"Solution Street Blog\",\"description\":\"Quality Software Engineering - Technology and Consulting Articles\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#\\\/schema\\\/person\\\/c4846451eff30e9514b534b2a2e01696\",\"name\":\"Peggy Frankel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g\",\"caption\":\"Peggy Frankel\"},\"url\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/author\\\/pfrankel\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Avoid CodeThinking - The Pitfalls of Trial and Error Coding - Solution Street Blog","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.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/","og_locale":"en_US","og_type":"article","og_title":"Avoid CodeThinking - The Pitfalls of Trial and Error Coding - Solution Street Blog","og_description":"&nbsp; Do you suffer from this issue? I can\u2019t tell you how many developers I have seen who fall into this trap. I certainly have from time to time. I can\u2019t say that using coding instead of thinking is always bad, but in so many cases it turns good code from simple elegance into a [&hellip;]","og_url":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/","og_site_name":"Solution Street Blog","article_published_time":"2017-10-27T17:55:23+00:00","og_image":[{"url":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png","type":"","width":"","height":""}],"author":"Peggy Frankel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Peggy Frankel","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#article","isPartOf":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/"},"author":{"name":"Peggy Frankel","@id":"https:\/\/www.solutionstreet.com\/blog\/#\/schema\/person\/c4846451eff30e9514b534b2a2e01696"},"headline":"Avoid CodeThinking &#8211; The Pitfalls of Trial and Error Coding","datePublished":"2017-10-27T17:55:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/"},"wordCount":1426,"commentCount":0,"image":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#primaryimage"},"thumbnailUrl":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/","url":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/","name":"Avoid CodeThinking - The Pitfalls of Trial and Error Coding - Solution Street Blog","isPartOf":{"@id":"https:\/\/www.solutionstreet.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#primaryimage"},"image":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#primaryimage"},"thumbnailUrl":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png","datePublished":"2017-10-27T17:55:23+00:00","author":{"@id":"https:\/\/www.solutionstreet.com\/blog\/#\/schema\/person\/c4846451eff30e9514b534b2a2e01696"},"breadcrumb":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#primaryimage","url":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png","contentUrl":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2017\/10\/octoberthinkerfulltitle1-copy-300x215.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.solutionstreet.com\/blog\/2017\/10\/27\/avoid-code-thinking-the-pitfalls-of-trial-and-error-coding\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.solutionstreet.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Avoid CodeThinking &#8211; The Pitfalls of Trial and Error Coding"}]},{"@type":"WebSite","@id":"https:\/\/www.solutionstreet.com\/blog\/#website","url":"https:\/\/www.solutionstreet.com\/blog\/","name":"Solution Street Blog","description":"Quality Software Engineering - Technology and Consulting Articles","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.solutionstreet.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.solutionstreet.com\/blog\/#\/schema\/person\/c4846451eff30e9514b534b2a2e01696","name":"Peggy Frankel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g","caption":"Peggy Frankel"},"url":"https:\/\/www.solutionstreet.com\/blog\/author\/pfrankel\/"}]}},"_links":{"self":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/posts\/2136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/comments?post=2136"}],"version-history":[{"count":0,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/posts\/2136\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/media?parent=2136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/categories?post=2136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/tags?post=2136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}