{"id":92,"date":"2021-04-16T18:29:12","date_gmt":"2021-04-16T18:29:12","guid":{"rendered":"https:\/\/serioussemicolons.wordpress.com\/?p=92"},"modified":"2021-04-16T18:29:12","modified_gmt":"2021-04-16T18:29:12","slug":"inverting-the-strategy-think-first-development-vs-code-first-development","status":"publish","type":"post","link":"https:\/\/blog.bryant.ai\/?p=92","title":{"rendered":"Inverting the Strategy: Think-First Development vs. Code-First Development"},"content":{"rendered":"\n<div class=\"wp-block-image is-spotify-podcast-badge\"><figure class=\"aligncenter is-resized\"><a href=\"https:\/\/open.spotify.com\/show\/2iiNZqyR8kRhgclLMc3dFV\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/s-ssl.wordpress.com\/i\/spotify-badge.svg\" alt=\"\" width=\"165\" height=\"40\" \/><\/a><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">There are a million differentiators between juniors and seniors (sidebar: if you&#8217;re a junior looking to level up, <a href=\"https:\/\/littleblah.com\/post\/2019-09-01-senior-engineer-checklist\/\">check out this awesome list of tips<\/a>) but in my experience the biggest one is how they approach the creation of new features. In a nutshell, juniors jump right in and start coding. Seniors think about the problem <em>thoroughly <\/em>and plan their approach before ever writing a line of code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Making messes is fun (but risky)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Back when I was in college and I billed myself as an &#8220;indie developer&#8221; (that&#8217;s code for junior) my coding style was very <em>experimental<\/em>. I would take a given set of requirements, write a bunch of code really really fast, throw it at the wall and see what stuck, then iterate off of that. Rinse and repeat. And, I have to admit, for smaller projects and scrappy startups, this strategy kinda works. It&#8217;s also <em>really <\/em>fun, and it&#8217;s still the style I use for hackathons and some personal projects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But it&#8217;s becoming rarer and rarer that I work on projects that can support this workflow. There are side effects to experimental, code-first development that may not be immediately apparent:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Rapid coding is a hair&#8217;s breadth away from sloppy coding. When you&#8217;re coding quickly without much forethought, you forget about important things like security concerns and strict input validation.<\/li><li>When coding this way, it&#8217;s easy to forget the fine details of requirements and code yourself into a corner without realizing it.<\/li><li>And, perhaps the most serious problem of all, this often leads to snafus that make their way up to production where your users can encounter them.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.explainxkcd.com\/wiki\/images\/0\/06\/bad_code.png\" alt=\"1926: Bad Code - explain xkcd\" \/><figcaption>Credit: <a href=\"https:\/\/xkcd.com\/1926\/\">xkcd<\/a><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, I&#8217;m not perfect, and old habits can die hard. So sometimes I still catch myself developing this way. However, nowadays I&#8217;m using a new strategy which I call <strong>think-first development.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Planning is less fun (but less risky)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the principles of think-first development:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>It is essential to understand the entire scope of the problem prior to beginning development. That means all inputs and outputs, edge cases, use cases, and dependencies.<\/li><li>Talk about, think about, and ask questions about the <em>entire system <\/em>until you understand it as well as you understand the programming language(s) you&#8217;re implementing it in.<\/li><li>Documentation of the above two steps is beyond important, it&#8217;s essential. If you skip this step and keep all the design information in your head, you&#8217;ll forget and fall back to quick-and-dirty.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Understanding the full problem scope<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ah, the age old question. <em>What problem is this system going to solve, and how will it do that? <\/em>This can range in difficulty from very easy (like <a href=\"https:\/\/www.reddit.com\/r\/ProgrammerHumor\/comments\/4qo7zr\/code_monkey_by_jonathan_coulton\/\">coding a login page<\/a>) to incredibly difficult, sometimes impossible for a single engineer (like the <a href=\"https:\/\/etrading.wordpress.com\/2006\/06\/01\/25-million-lines-of-fortran\/\">Bloomberg Terminal<\/a>). I&#8217;m going to skip the part where I explain how I&#8217;ve come to understand <em>how <\/em>to understand problem scope, because many have blogged on it and it basically boils down to this:<\/p>\n\n\n\n<figure class=\"wp-block-pullquote\"><blockquote><p>Ask &#8220;why?&#8221; and if you&#8217;re still confused, ask &#8220;why?&#8221; again. Ask &#8220;why?&#8221; until you can&#8217;t anymore.<\/p><cite>Every three-year old ever, and also smart engineers.<\/cite><\/blockquote><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The key takeaway here in the context of this post is this: do NOT write a line of code before you fully understand the problem scope. If you don&#8217;t, you&#8217;re walking blind into a potential minefield of issues. (experimental code is fine, but no pushes!)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Talking about the system<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Everybody has a different perspective, and the job of a senior designing a new system is to take all of these perspectives in, discard the ones that don&#8217;t make sense, take pieces of the ones that do, and combine them into a cohesive whole.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I want to be sure I drive this point home since it&#8217;s so important: <em>everybody <\/em>has a perspective, from the juniorest junior to the brand-new BA to the seniorest senior. Now, as may be obvious, there is a lot of lift and noise in involving everyone in the discussion, and often new features don&#8217;t have enough lead time to accommodate this level of investigation, so take it from me: <strong>the best method for gathering a collective set of opinions is an open forum. <\/strong>Get everybody into a room\/Zoom and start asking questions and generating discussion. Don&#8217;t forget to set up follow-up sessions if needed! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t write code until every possible avenue has been explored and either considered or discarded. Everybody has an opinion, but a smart engineer knows how to sift through these and come up with a cohesive design plan!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Document everything, and document some more<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">I really wish I could share with you my latest system design document, because it&#8217;s really a work of art! Many hours (OK, forty) were put into creating it but it&#8217;s client-specific and I&#8217;m not in the business of leaking IP. Here&#8217;s what I&#8217;m going to do instead: below you&#8217;ll find a list of the key sections that I write when I create any standard SDD (System Design Document). Each has many, <em>many <\/em>subsections specific to the project or feature I&#8217;m designing. Also, images, links, blurbs, pseudocode, <em>anything<\/em> to demonstrate a key understanding of what will be developed.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Guidelines &#8211; What are the core tenets of the design of the system? Things that should never be violated.<\/li><li>User Stories &#8211; Which stories (link to tickets) are going to makeup the work?<\/li><li>High-Level Plan &#8211; What are steps 1, 2, 3, 4&#8230;of your design? Rough outline only.<\/li><li>Ticket Flow &#8211; Which ticket will be worked on first, second, third&#8230;?<\/li><li>UI\/UX Summaries &#8211; Include mockups and screenshots.<\/li><li>API Endpoints &amp; Integrations &#8211; Which 1st- and 3rd-party APIs will be called?<\/li><li>Required Architecture &#8211; Which components will be required in the system?<\/li><li>Open Questions &#8211; What are the outstanding questions about the system?<\/li><\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Sidenote: I have an article in my backlog to write about the Power of Not Knowing. Stay tuned!<\/p><cite>Jamison<\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">This document is so, so critical to the successful development of the feature\/module\/system. It should be the first document you create and the last one you save before actually starting implementation. I&#8217;m not messing around on this one! Skip this step and you&#8217;ll regret it \ud83d\ude09<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.kym-cdn.com\/photos\/images\/facebook\/001\/492\/929\/f0c.jpeg\" alt=\"Skipping Steps Improved HD Template | Skipping Steps | Know Your Meme\" \/><figcaption>Don&#8217;t be like this guy. Great way to stretch an ACL! Credit: <a href=\"https:\/\/knowyourmeme.com\/photos\/1492929-skipping-steps\">knowyourmeme<\/a><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The key point that I&#8217;m trying to get across here is that juniors jump right into coding and make mistakes. Seniors take time to <em>think <\/em>about the code they&#8217;re going to write before writing it. The difference is that the seniors will have a fully-mapped-out mental model for the system prior to building it, and the build takes infinitely less time than the scrappy, build-as-you-go model that is favored among those with less XP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s all for now. If you have links to cool SDD&#8217;s that you can share, by all means drop it in the comments!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!\u2013 wp:image {&#8220;align&#8221;:&#8221;center&#8221;,&#8221;width&#8221;:165,&#8221;height&#8221;:40,&#8221;linkDestination&#8221;:&#8221;none&#8221;,&#8221;className&#8221;:&#8221;is-spotify-podcast-badge&#8221;} \u2013&gt;<br \/>\n&lt;div class=&#8221;wp-block-image is-spotify-podcast-badge&#8221;&gt;&lt;figure class=&#8221;aligncenter is-resized&#8221;&gt;&lt;a href=&#8221;https:\/\/open.spotify.com\/show\/2iiNZqyR8kRhgclLMc3dFV&#8221;&gt;&lt;img src=&#8221;https:\/\/s-ssl.wordpress.com\/i\/spotify-badge.svg&#8221; alt=&#8221;&#8221; width=&#8221;165&#8243; height=&#8221;40&#8243; \/&gt;&lt;\/a&gt;&lt;\/figure&gt;&lt;\/div&gt;<br \/>\n&lt;!\u2013 \/wp:image \u2013&gt;<br \/>\n&lt;!\u2013 wp:paragraph \u2013&gt;<br \/>\n&lt;p&gt;There are a million differentiators between juniors and seniors (sidebar: if you&#8217;re a junior looking to level up, &lt;a href=&#8221;https:\/\/littleblah.com\/post\/2019-09-01-senior-engineer-checklist\/&#8221;&gt;check out this awesome list of tips&lt;\/a&gt;) but in my experience the biggest one is how they approach the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=92"}],"version-history":[{"count":0,"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=\/wp\/v2\/posts\/92\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bryant.ai\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}