{"data":{"prismic":{"blog_article":{"article_type":"Tech","title":[{"type":"heading1","text":"Reduce, re-use and re-write your code  ","spans":[{"start":0,"end":39,"type":"strong"}]}],"summary_text":[{"type":"paragraph","text":"Slowly but (hopefully) surely, the world seems to be waking up to the looming climate crisis. What role can software engineering and related disciplines play in this global effort?","spans":[]}],"seodescription":null,"seotitle":null,"author":{"__typename":"PRISMIC_Person","name":"James Hobbs","job_title":"Head of Engineering","profile_picture":{"dimensions":{"width":500,"height":500},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate%2F92ffdb58-4241-49a8-a41a-cf470cc9ed92_gs-avatar-jameshobbs-new+%282%29.jpg?auto=compress,format"}},"published":"2022-04-22","image":{"dimensions":{"width":1808,"height":1016},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png?auto=compress,format"},"programming_language":null,"singleAspectRatioImage":{"childImageSharp":{"fluid":{"aspectRatio":1.779527559055118,"src":"/static/b312969873ed36dcaa1d66907b3a82ab/ea5de/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png","srcSet":"/static/b312969873ed36dcaa1d66907b3a82ab/6b0e5/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png 200w,\n/static/b312969873ed36dcaa1d66907b3a82ab/a489e/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png 400w,\n/static/b312969873ed36dcaa1d66907b3a82ab/ea5de/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png 800w,\n/static/b312969873ed36dcaa1d66907b3a82ab/b36f0/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png 1200w,\n/static/b312969873ed36dcaa1d66907b3a82ab/cfd9e/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png 1600w,\n/static/b312969873ed36dcaa1d66907b3a82ab/96abc/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.png 1808w","srcWebp":"/static/b312969873ed36dcaa1d66907b3a82ab/0c129/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.webp","srcSetWebp":"/static/b312969873ed36dcaa1d66907b3a82ab/0e93d/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.webp 200w,\n/static/b312969873ed36dcaa1d66907b3a82ab/2259f/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.webp 400w,\n/static/b312969873ed36dcaa1d66907b3a82ab/0c129/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.webp 800w,\n/static/b312969873ed36dcaa1d66907b3a82ab/45222/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.webp 1200w,\n/static/b312969873ed36dcaa1d66907b3a82ab/1f191/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.webp 1600w,\n/static/b312969873ed36dcaa1d66907b3a82ab/70720/c5e5112a-cec2-4a42-b75e-1b88e381e047_treeeeeees.webp 1808w","sizes":"(max-width: 800px) 100vw, 800px","presentationWidth":800}}},"link":{"uid":"eco-friendly-software-engineering"},"related_blogs":[{"blog":{"__typename":"PRISMIC_Blog_article","title":[{"type":"heading1","text":"Peer reviews - what good looks like","spans":[{"start":0,"end":35,"type":"strong"}]}],"summary_text":[{"type":"paragraph","text":"There are any number of tools to analyse code for you, even write it for you. If reducing cognitive complexity, avoiding potential null reference exceptions, and ensuring 80% code coverage from unit tests is the priority, then peer review processes won't be the focus.","spans":[]}],"author":{"__typename":"PRISMIC_Person","name":"Dale Greenhood","job_title":"Technical Architect"},"thumbnail":{"dimensions":{"width":904,"height":508},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate/56d1120c-ca30-4422-8043-8ae2d0f48e05_MicrosoftTeams-image+%2860%29.png?auto=compress,format&rect=0,326,6240,3507&w=904&h=508"},"article_type":"Tech","published":"2022-03-01","link":{"uid":"peer-reviews"},"image":{"dimensions":{"width":904,"height":508},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate/56d1120c-ca30-4422-8043-8ae2d0f48e05_MicrosoftTeams-image+%2860%29.png?auto=compress,format&rect=0,326,6240,3507&w=904&h=508"},"_meta":{"uid":"peer-reviews"}}},{"blog":{"__typename":"PRISMIC_Blog_article","title":[{"type":"heading1","text":"Less time thinking, more time doing?","spans":[{"start":0,"end":36,"type":"strong"}]}],"summary_text":[{"type":"paragraph","text":"When you’re trying to solve big problems, it can be hard to see the wood for the trees to identify a clear way forward. ","spans":[]}],"author":{"__typename":"PRISMIC_Person","name":"Nicola Hinds","job_title":"Strategy Director"},"thumbnail":{"dimensions":{"width":904,"height":508},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate/d0444f85-af96-48e4-a06c-c6ce318e061a_running-g51e35d0e6_1920.jpg?auto=compress,format&rect=0,100,1920,1079&w=904&h=508"},"article_type":"News","published":"2021-11-19","link":{"uid":"strategy-sprint"},"image":{"dimensions":{"width":904,"height":508},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate/d0444f85-af96-48e4-a06c-c6ce318e061a_running-g51e35d0e6_1920.jpg?auto=compress,format&rect=0,100,1920,1079&w=904&h=508"},"_meta":{"uid":"strategy-sprint"}}},{"blog":{"__typename":"PRISMIC_Blog_article","title":[{"type":"heading1","text":"Consumer behaviour in the contact-free economy","spans":[{"start":9,"end":38,"type":"strong"}]}],"summary_text":[{"type":"paragraph","text":"‘Prediction is very difficult, especially if it's about the future.’ An apt observation from..","spans":[]}],"author":{"__typename":"PRISMIC_Person","name":"Alex Stansfield","job_title":"Senior Strategist"},"thumbnail":{"dimensions":{"width":904,"height":508},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate/044869f7-eb44-4522-b904-9e4126ad80e8_Contact+free+survey+article.jpg?auto=compress,format&rect=0,0,800,450&w=904&h=508"},"article_type":"Opinion","published":"2020-06-17","link":{"uid":"consumer-behaviour-in-the-contact-free-economy"},"image":{"dimensions":{"width":904,"height":508},"alt":null,"copyright":null,"url":"https://images.prismic.io/greatstate/044869f7-eb44-4522-b904-9e4126ad80e8_Contact+free+survey+article.jpg?auto=compress,format&rect=0,0,800,450&w=904&h=508"},"_meta":{"uid":"consumer-behaviour-in-the-contact-free-economy"}}}],"body":[{"__typename":"PRISMIC_Blog_articleBodyText","type":"text","primary":{"text":[{"type":"paragraph","text":"Slowly but (hopefully) surely, the world seems to be waking up to the looming climate crisis. The recent IPCC climate change report has made it clear that decisive action is required to avoid the planet becoming a simmering hellscape in the not too distant future. Individuals are starting to think more about how they can help by reducing their emissions. What role can software engineering and related disciplines play in this global effort? ","spans":[{"start":136,"end":149,"type":"hyperlink","data":{"link_type":"Web","url":"https://www.forbes.com/sites/nilsrokke/2022/04/07/why-we-cant-ignore-the-latest-un-climate-change-report/?sh=a144bca6ae96","target":"_blank"}}]},{"type":"heading3","text":"Don’t leave the lights on ","spans":[{"start":0,"end":25,"type":"strong"}]},{"type":"paragraph","text":"The refrain you will most commonly hear parents saying to children is just as applicable to the infrastructure that powers modern digital platforms. The cloud makes it incredibly easy to spin up new infrastructure and services with a few lines of code or button clicks. It also conceptually separates your actions from the potential emissions they may be creating many hundreds or thousands of miles away in a data centre.  ","spans":[]},{"type":"paragraph","text":"Happily, the cloud also makes it just as easy to turn all that stuff off again – reducing emissions, and potentially saving you money depending on the nature of your infrastructure. Some cloud services are designed to spin down automatically when not being used – but a bunch of them aren’t. ","spans":[]},{"type":"paragraph","text":"Use infrastructure-as-code technology to create your environments in the first place and you’ll find it’s very simple to spin them down again automatically outside of working hours. You can then fire them up again just before everyone starts work – automatically. Money potentially saved, emissions potentially reduced, and a whole class of business risks eliminated by avoiding hand-built environments that are all subtly and deviously different from one another. ","spans":[{"start":4,"end":37,"type":"hyperlink","data":{"link_type":"Web","url":"https://docs.microsoft.com/en-us/devops/deliver/what-is-infrastructure-as-code","target":"_blank"}}]},{"type":"heading3","text":"Write efficient software ","spans":[{"start":0,"end":24,"type":"strong"}]},{"type":"paragraph","text":"The code that you write can have an impact on emissions. Slow-running, inefficient code will take longer to run and potentially require more resources – indirectly bumping up those emissions. ","spans":[]},{"type":"paragraph","text":"Ensure your code is performance tested before being put into production. This will ensure that you understand how (or if) it scales and will help you catch issues before they start affecting customers. If you’re shipping code to production without understanding the impact it will have on performance, you need to think carefully about your ways of working. ","spans":[]},{"type":"paragraph","text":"There are many tools that will analyse your code for you to identify performance bottlenecks, and many tools that will help you automate performance and load tests as part of your pipelines so that you can spot this kind of stuff early. Again, this will potentially save you money in addition to being better for the planet – it’s a no brainer. ","spans":[]},{"type":"heading3","text":"Respect the client ","spans":[{"start":0,"end":18,"type":"strong"}]},{"type":"paragraph","text":"Inefficient client-side code – running in browsers and the like – can shorten battery life or demand more power from the grid, again leading to increased emissions. The impact from an individual perspective is tiny, but scaled out to all the machines across the world that are running code? It’s potentially huge. ","spans":[]},{"type":"paragraph","text":"The same principles as mentioned above apply – understand the performance profile of your code before you ship it. Respect the client – avoid doing lots of expensive computation on the main thread and prioritise user experience over everything else. You’ll find SEO benefits to that approach in addition to the planetary benefits. ","spans":[]},{"type":"heading3","text":"Block the noise ","spans":[{"start":0,"end":15,"type":"strong"}]},{"type":"paragraph","text":"As a user, a very simple way of protecting your computer from running swathes of unnecessary, invasive code on your machine is to use an ad blocker. Most modern websites are stuffed to the gills with tracking pixels, third party services and all kinds of other horrors. You’ll find that using an ad blocker not only makes your browsing experience noticeably faster, it also means your computer isn’t working so hard.  ","spans":[]},{"type":"paragraph","text":"Good for you, good for the planet. ","spans":[]},{"type":"paragraph","text":"Not so good for marketers, but maybe the onus should be on them to find a better way of monetising things. ","spans":[]}]}}],"_meta":{"uid":"eco-friendly-software-engineering"}}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"rootQuery":"\n  query PrismicBlogArticleByDocumentID($uid: String!) {\n    prismic {\n      blog_article(uid: $uid, lang: \"en-gb\") {\n        ...prismicBlogArticleFields\n      }\n    }\n  }\n","id":"YmF5QREAACMAgPle","lang":"en-gb","uid":"eco-friendly-software-engineering","alternateLanguages":[]}}