{"id":492,"date":"2016-09-23T12:30:52","date_gmt":"2016-09-23T12:30:52","guid":{"rendered":"http:\/\/strawberrycode.com\/blog\/?p=492"},"modified":"2016-09-23T12:34:37","modified_gmt":"2016-09-23T12:34:37","slug":"guidelines-1-developers","status":"publish","type":"post","link":"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/","title":{"rendered":"Guidelines #1 for Developers"},"content":{"rendered":"<p>Here are some rules or guidelines I try to live by as a developer. They are for all of you, from the beginners to the seasoned developers.<br \/>\nIt is not an exhaustive list, so feel free to add yours in the comments below!<\/p>\n<p><img loading=\"lazy\" src=\"http:\/\/strawberrycode.com\/blog\/wp-content\/uploads\/2016\/09\/GuidelinesDevelopers_banner.png\" alt=\"Guidelines for Developers\" width=\"600\" height=\"360\" class=\"aligncenter size-full wp-image-501\" \/><\/p>\n<p><strong>1. &#8220;Temporary&#8221; doesn&#8217;t exist in development<\/strong><br \/>\nBe honest with yourself, you&#8217;re never going to change it. Ever.<\/p>\n<p><strong>2. Use meaningful variable names<\/strong><br \/>\nBecause <code>abc<\/code>, <code>test<\/code> or <code>tmp<\/code> are not really understandable by other developers, or by you in 6 months.<\/p>\n<p><strong>3. Be consistent with style, use guidelines<\/strong><br \/>\nSome are immune to it, but unfortunately (or not), it drives me insane. So try to agree on some basic rules with your team on indentation, spaces, return, etc.<\/p>\n<p><strong>4. Throw and catch your errors, or handle them<\/strong><br \/>\nI know, it&#8217;s easier said than done. And some languages are more error-friendly than others. Try to integrate it as early as possible in the process, it will be easier to do.<\/p>\n<p><strong>5. If there is an IF, there should be an ELSE<\/strong><br \/>\nOr some sort of fallback. Try to cover all cases ;)<\/p>\n<p><strong>6. And if you&#8217;re ignoring something on purpose, leave a comment<\/strong><br \/>\nOr a TODO, it&#8217;s okay.<\/p>\n<p><strong>7. No line of code should be left untested<\/strong><br \/>\nAlways test what you do, don&#8217;t expect things to work straight away. No offense, but you&#8217;re not that good ;)<\/p>\n<p><strong>8. Write readable code<\/strong><br \/>\nBecause the code is READ by humans and executed by machines.<\/p>\n<p><strong>9. Write unit tests whenever possible<\/strong><br \/>\nSame as the &#8220;throw and catch errors&#8221;.<\/p>\n<p><strong>10. If something doesn&#8217;t feel right (eg. UX or UI), say it!<\/strong><br \/>\nYou&#8217;re often the first one who will see it in action.<\/p>\n<p><strong>11. If you have a doubt about a feature, ask!<\/strong><br \/>\nDon&#8217;t take decisions if it&#8217;s not your role, you may end up redoing the whole thing.<\/p>\n<p><strong>12. Reuse code, create libraries&#8230; don&#8217;t repeat yourself<\/strong><br \/>\nThink DRY, live DRY, eat DRY, drink DRY, sleep DRY. Oh, what did I just do??<\/p>\n<p><strong>13. Look for best practices and code optimisation<\/strong><br \/>\nIt cannot hurt, right?<\/p>\n<p><strong>14. If it takes 1 extra hour for you to do something that can save 10 mins to each user every day, do it!<\/strong><br \/>\nDo the math, it works! And you would do it for yourself, so do it for others ;)<\/p>\n<p><strong>15. If something is not straightforward, put a comment<\/strong><br \/>\nI&#8217;m talking about nice and short explanations when the code doesn&#8217;t speak for itself.<\/p>\n<h3>For Git users, or users of other versioning systems (hopefully everyone):<\/h3>\n<p><strong>16. Keep changes in separate commits<\/strong><br \/>\nIt&#8217;s easy to keep on working on the same commit, but it gets more painful when you need to revert.<\/p>\n<p><strong>17. New feature = new branch<\/strong><br \/>\nUnless you want to do it the hard way, of course.<\/p>\n<p><strong>18. Try to merge the main branch to your feature branch as often as possible<\/strong><br \/>\nIt makes life easier when you need to merge it back to the main branch.<\/p>\n<p><strong>19. When committing, do a <code>git diff<\/code>, and read it!<\/strong><br \/>\nIt helps to double-check what you just did and sometimes to clean the code too.<\/p>\n<p><strong>20. Write meaningful commit messages<\/strong><br \/>\nNo, &#8220;fixed bugs&#8221; is not sufficient in most cases.<\/p>\n<p><strong>21. Do not alter too much the merge messages<\/strong><br \/>\nThey can contain useful information by default.<\/p>\n<p><strong>22. When doing a big merge, create an intermediate branch<\/strong><br \/>\nIf you&#8217;re merging B into A, the intermediate branch is basically a copy of A where you merge B to see if everything goes well.<\/p>\n<p><strong>Bonus: don&#8217;t push something live on a Friday night, or right before your holidays&#8230;<\/strong><br \/>\nUnless you really want to spend time on it when you shouldn&#8217;t, that&#8217;s up to you :)<\/p>\n<p>Most importantly,<br \/>\nStay curious, be consistent, be sensible, have fun!<br \/>\nIf you don&#8217;t know something, Google it or ask someone.<br \/>\nAnd try to learn something new every day!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some rules or guidelines I try to live by as a developer. They are for all of you, from the beginners to the seasoned developers. It is not an exhaustive list, so feel free to add yours in the comments below! 1. &#8220;Temporary&#8221; doesn&#8217;t exist in development Be honest with yourself, you&#8217;re never going to change it. Ever. 2. Use meaningful variable names Because abc, test or tmp are not really understandable by other developers, or by you in 6 months. 3. Be consistent with style, use guidelines Some are immune to it, but unfortunately (or not), it &hellip; <a href=\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Guidelines #1 for Developers<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":500,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[86],"tags":[92,5,88,93,87],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Guidelines #1 for Developers - StrawberryCode<\/title>\n<meta name=\"description\" content=\"Here are some rules or guidelines I try to live by as a developer. &quot;Do&quot;s and &quot;don&#039;t&quot;s for all developers from the beginners to the more seasoned ones.\" \/>\n<link rel=\"canonical\" href=\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Guidelines #1 for Developers - StrawberryCode\" \/>\n<meta property=\"og:description\" content=\"Here are some rules or guidelines I try to live by as a developer. &quot;Do&quot;s and &quot;don&#039;t&quot;s for all developers from the beginners to the more seasoned ones.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/\" \/>\n<meta property=\"og:site_name\" content=\"StrawberryCode\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-23T12:30:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-09-23T12:34:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/strawberrycode.com\/blog\/wp-content\/uploads\/2016\/09\/GuidelinesDevelopers_200.png\" \/>\n\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\">\n\t<meta name=\"twitter:data1\" content=\"3 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/strawberrycode.com\/blog\/#website\",\"url\":\"https:\/\/strawberrycode.com\/blog\/\",\"name\":\"StrawberryCode\",\"description\":\"Fruit for Thought\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/strawberrycode.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/#primaryimage\",\"inLanguage\":\"en-GB\",\"url\":\"https:\/\/strawberrycode.com\/blog\/wp-content\/uploads\/2016\/09\/GuidelinesDevelopers_200.png\",\"contentUrl\":\"https:\/\/strawberrycode.com\/blog\/wp-content\/uploads\/2016\/09\/GuidelinesDevelopers_200.png\",\"width\":200,\"height\":200},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/#webpage\",\"url\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/\",\"name\":\"Guidelines #1 for Developers - StrawberryCode\",\"isPartOf\":{\"@id\":\"https:\/\/strawberrycode.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/#primaryimage\"},\"datePublished\":\"2016-09-23T12:30:52+00:00\",\"dateModified\":\"2016-09-23T12:34:37+00:00\",\"author\":{\"@id\":\"https:\/\/strawberrycode.com\/blog\/#\/schema\/person\/c328d959959928f47281d7a0ec779e2a\"},\"description\":\"Here are some rules or guidelines I try to live by as a developer. \\\"Do\\\"s and \\\"don't\\\"s for all developers from the beginners to the more seasoned ones.\",\"breadcrumb\":{\"@id\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/strawberrycode.com\/blog\/\",\"url\":\"https:\/\/strawberrycode.com\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/\",\"url\":\"https:\/\/strawberrycode.com\/blog\/guidelines-1-developers\/\",\"name\":\"Guidelines #1 for Developers\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/strawberrycode.com\/blog\/#\/schema\/person\/c328d959959928f47281d7a0ec779e2a\",\"name\":\"StrawberryCode\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/posts\/492"}],"collection":[{"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/comments?post=492"}],"version-history":[{"count":14,"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions"}],"predecessor-version":[{"id":524,"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions\/524"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/media\/500"}],"wp:attachment":[{"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/media?parent=492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/categories?post=492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strawberrycode.com\/blog\/wp-json\/wp\/v2\/tags?post=492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}