{"id":24868,"date":"2021-11-30T11:48:36","date_gmt":"2021-11-30T19:48:36","guid":{"rendered":"https:\/\/www.podfeet.com\/blog\/?p=24868"},"modified":"2021-11-30T11:48:36","modified_gmt":"2021-11-30T19:48:36","slug":"tiny-tip-coding-letter-never-send","status":"publish","type":"post","link":"https:\/\/www.podfeet.com\/blog\/2021\/11\/tiny-tip-coding-letter-never-send\/","title":{"rendered":"Tiny Tip \u2013 When You\u2019re Stuck Coding, Write a Letter You&#8217;ll Never Send"},"content":{"rendered":"<p>When I\u2019m programming, I often run into problems I can\u2019t solve. I\u2019ve gotten pretty good at reading the documentation (at Bart\u2019s insistence), and I read lots of forum discussions on sites like Stack Overflow where people help each other with their code, but it\u2019s pretty common that I still can\u2019t figure out how to fix my code.<\/p>\n<p>I often engage Dorothy in a text chat, which sometimes turns into a Skype chat with screen sharing.  One of the most annoying things about Dorothy helping me is that she always asks me what I\u2019m trying to DO.  It\u2019s annoying because it\u2019s the <em>right<\/em> question. I\u2019ll be down in the weeds saying, \u201cI can\u2019t push into this array\u201d but she wants to know why I want to push into the array and what I hope to accomplish when I do.<\/p>\n<p>Sometimes I write an email to Dorothy or to Bart where I describe the problem on which I\u2019m stuck.  What I find really often is that as I try to articulate the problem I\u2019m having, I have to keep mutating my sentences as I discover logic problems or syntax problems.<\/p>\n<p>Recently I was stuck on a rather gnarly coding problem and I came up with an absolutely fabulous solution.<\/p>\n<p>I didn\u2019t write to Dorothy and I didn\u2019t write to Bart. I wrote a letter with no intention of sending it to anyone at all. My theory was that I might be able to solve my own problem if I simply <em>pretended<\/em> I was going to send the letter.<\/p>\n<p>I started by writing out what wasn\u2019t working. As I tried to explain the problem, I found two entire functions that I had written and yet never used to do anything. As I tried to explain why they were there in my fake letter, I was able to verify that they didn\u2019t need to be there at all.  My code just got simpler.<\/p>\n<p>I\u2019m not surprised to find extra code lying around. I program in fits and starts. When I start coding, it is all-consuming. Hours and hours can go by in the blink of an eye, which often turns into days where I get nothing else done.  After three days, I realize I have to write for the podcast so I have to stop, and I may not get back to what I was doing for weeks or sometimes even months.<\/p>\n<p>I wish I could figure out a way to set aside maybe 4-8 hours per week to program so I would make slow but steady progress, but I can\u2019t figure out a way to do that.  If I wrote function during one of those fits and starts, I may not even remember doing it weeks later when I come back to it.<\/p>\n<p>Once I had documented where I was stuck and eliminated unnecessary code, I channeled my inner Dorothy and asked myself what was I trying to <em>do<\/em>?  As much as I hate to give Dorothy a pat on the back, that question was exactly what I needed to ask to figure out where I\u2019d gone wrong.<\/p>\n<p>After a day or two of trying to write a coherent description of my problem that I never intended to send to anyone, I figured out what I was actually trying to do, I eliminated unnecessary code, and I wrote some tight code that actually accomplished my goal.<\/p>\n<p>Perhaps this is a technique that seasoned programmers already know all about, but I wanted to share because it was a huge help to me to write a letter I never intended to send.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I\u2019m programming, I often run into problems I can\u2019t solve. I\u2019ve gotten pretty good at reading the documentation (at Bart\u2019s insistence), and I read lots of forum discussions on sites like Stack Overflow where people help each other with their code, but it\u2019s pretty common that I still can\u2019t figure out how to fix [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":13735,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[147],"tags":[981,980,1009,4924,2542,176],"class_list":["post-24868","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-posts","tag-code","tag-coding","tag-help","tag-letter","tag-programmers","tag-programming"],"jetpack_featured_media_url":"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2017\/12\/Tiny-Tip-Logo-300px-wide-solid-background.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/24868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/comments?post=24868"}],"version-history":[{"count":2,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/24868\/revisions"}],"predecessor-version":[{"id":24870,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/24868\/revisions\/24870"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media\/13735"}],"wp:attachment":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media?parent=24868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/categories?post=24868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/tags?post=24868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}