💻 Coding your way out of the Coronavirus 🚑
Tags: covid19, coronavirus, gag
Published: 2020-03-17 00:38:04

---
title: 💻 Coding your way out of the Coronavirus 🚑
published: true
description: Coding practices for avoiding and dealing with the Coronavirus 
tags: #COVID-19 #Coronavirus #gag
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/3os1utdas5xcdsa0ffis.png
---

**Disclaimer:** The following post includes unfunny jokes about the Coronavirus (COVID-19) and the Corona crisis. Some people may find this content offensive, so continue reading at your own risk. This blog should not be taken seriously under any circumstances.

<img src="https://dev-to-uploads.s3.amazonaws.com/i/0qt3wzmp19tpzw38f5no.png" width="80%">

The Coronavirus is creating shock waves around the world, forcing more developers to work from home. While the practices to avoid the Coronavirus spread among humans is pretty clear for most of us, this blog will cover the best practices to avoid your code from being infected ([prevention](#prevention)), checking to see if your code is infected ([detection](#detection)) and what to do in the case of contamination ([post-infection](#postinfection)). It is also important to remember that the statistics show us that new (freshly developed) code has a higher chance of recovery after infection. Legacy code (any code that was created [before the year 2010](https://github.com/dspinellis/unix-history-repo/commit/430b982fd0979c7b04c454dbdee5592bb2a7cba0)) is at the high-risk group.

# ✋ Prevention

Due to the high infection rate and the fact that [Alibaba AI](https://thenextweb.com/neural/2020/03/02/alibabas-new-ai-system-can-detect-coronavirus-in-seconds-with-96-accuracy/) didn’t create the anti-coronavirus, all experts agree that the best cure, for now, is prevention.

### Avoid using protocols that require handshaking

[Handshaking](https://en.wikipedia.org/wiki/Handshaking) is the most common way to establish an exchange of information between two machines. Unfortunately, this is also the most common way to get infected and to spread the Coronavirus. Therefore, try to avoid using protocols that require handshaking to start communication (e.g. TCP, TLC, etc.)

<img src="https://dev-to-uploads.s3.amazonaws.com/i/jdnrp8za7kfcrd5jcm7g.png" width="30%" height="30%">

### Be careful when copying code from crowded places 

Crowded places like stack overflow and open source projects, especially the ones with plenty of contributors, have more chances to contain code that is infected by the Coronavirus. Instead, try to copy code from your teammates, unpopular open-source projects, and bad stack overflow answers.

<img src="https://dev-to-uploads.s3.amazonaws.com/i/iu4odfttc0kczreq71gn.png" width="40%" height="40%">

### Achieve (and maintain) code hygiene

Now it is the best time to stop writing “quick-and-dirty” and to start refactoring, so you will have [clean code](https://medium.com/mindorks/how-to-write-clean-code-lessons-learnt-from-the-clean-code-robert-c-martin-9ffc7aef870c) because keeping high code hygiene standards will help to avoid infection. Also, be sure to verify you’re [sanitizing (any) input data](https://www.smashingmagazine.com/2011/01/keeping-web-users-safe-by-sanitizing-input-data/) received, especially if it received from external services.

<img src="https://dev-to-uploads.s3.amazonaws.com/i/enxhsa35gpl51sii3d05.png" width="30%" height="30%">

# 🔎 Detection

If your code is acting funky, maybe it is not because you’re a sh*ty developer, but because you got infected. It is crucial to constantly debug, monitor and scan your code with different anti-viruses solutions (like [VirusTotal](https://www.virustotal.com/gui/home/upload)) to check your code health.

# 😱 Post-infection

If you find that your [code got contaminated](https://usa.kaspersky.com/blog/coronavirus-used-to-spread-malware-online/20213/), you should follow the guides under this section **ASAP**!

### Git blame to see how you got infected

Thanks to the ability to use [`git blame`](https://git-scm.com/docs/git-blame) it is possible to detect how your code got infected so the relevant safety measurements can be taken to prevent the spread of the Coronavirus.

<img src="https://dev-to-uploads.s3.amazonaws.com/i/ic771g0pbbt0netf4p1p.png" width="80%">

### Use only localhost to serve your app

Infected code should stay in quarantine until fully recovered. Therefore, if your app contains code with Coronavirus, for public safety, it should be accessible only on the [localhost](https://en.wikipedia.org/wiki/Localhost) and not exposed to the world.

<img src="https://dev-to-uploads.s3.amazonaws.com/i/v8hyqpjgqhk1ohqduytw.png" width="35%" height="35%">

### Mask your IP in public places

Contrary to the myth that masks should protect you from getting infected, they are actually supposed to [help infected code](https://www.cbsnews.com/news/coronavirus-prevention-face-mask-not-helpful-wash-hands/) not to infect other code snippets out there. So if you MUST deploy your code on the WWW, at least mask your server IP to minimize the exposure to others.

<img src="https://dev-to-uploads.s3.amazonaws.com/i/h5pd9ri0rzsmijf0s2c5.png" width="30%" height="30%">

#### FYI, I followed all those practices and my code is Corona free since 93'.