5 best practices for responsible coding

Estimated read time 4 min read

5 best practices for responsible coding

Digital technology is at the center of all societal concerns. The future of work, automation of tasks, new modes of exchange and, of course, carbon footprint. Because yes, digital technology has an environmental cost. Let’s take a look back at the best practices to adopt to code responsibly and create a more sustainable digital world.

Digital technology currently represents 3 to 4% of greenhouse gas (GHG) emissions worldwide and 2.5% of the national carbon footprint, according to Arcep. If the figure seems modest compared to the industrial or textile sectors, for example, it is the growth that we must take a closer look. According to the report of the Senate’s information mission on the environmental footprint of digital technology, digital emissions are expected to increase significantly in the coming years, unless new measures are put in place. This would thus be a growth of 60% by 2040, or 6.7% of French greenhouse gas emissions.

So here are five golden rules for “coding responsibly”.

1. Take care of your algorithm

A computer program is a set of instructions and data represented by an algorithm. This is a mathematical calculation that has a precise function: finding a word in a dictionary is a perfect example. Several methods are possible. Start with the first word on the first page and eliminate the occurrences one by one. Another method, much more effective, is to open the dictionary in half and locate the most relevant pages. These two methods could be modeled by two different algorithms. That being the case, it is imperative today to favor the most efficient algorithm, that is to say the one that will spend the least resources and which will therefore require less computing power to perform its task.

2. Respect the RGAA

Website accessibility is rarely a priority for developers. This is evidenced by the figures: almost 97% of websites have a lack of digital accessibility from their home page. Which means that only 3% of them would today be accessible to people with disabilities, according to the National Advisory Council for People with Disabilities. The RGAA (General Reference System for Improving Accessibility) is often “passed over”. Either because it requires additional development time (and therefore money!), or more simply because of a clear lack of awareness of the subject. However, there is no excuse, since the RGAA brings together all the good practices, such as the adaptability of the graphic charter to people with color blindness.

3. Optimize its storage

The first reflex, when creating a site, is to upload very high quality images, videos and sound. However, the most important resolutions are also the most energy-intensive; because in addition to being hosted on servers, they will also be downloaded by Internet users. The environmental impact is thus multiplied. It is therefore a question of optimizing the storage of its site by using the best adapted formats. For photos, for example, the best formats remain JPEG or Webp which manages transparency and data compression.

4. Clean up your code

To (properly) develop a website or a computer program, it is not necessary to stay on the customer’s needs, but to look wider and be critical about the product code in order to always optimize it. Because it is impossible to anticipate the situation in which the Internet user finds himself using the interface. Cleaning the code is thus the first prerequisite to promote the accessibility of its site. For example, visually impaired or blind people use audio description tools that read the HTML code line by line to interpret it with words. It is therefore crucial to take care of this sequence by correctly placing the tags, such as the titles H1, H2 or H3.

5. Lighten up your page

One of the first mistakes beginners make is to overload their website with animations from external libraries. However, the page grows heavier inexorably by multiplying the elements… and will put all the more strain on the network, the browser and the user’s machine, thus wearing out faster. Therefore, do not overuse external booksellers if they do not serve the user experience. On the other hand, it is possible to set up a cache system that will contain the site’s data locally to limit HTTP requests on remote servers. The exchanges of data, thus lightening the page, will be limited and the environmental impact of the site drastically reduced.

You May Also Like

More From Author