If you must have analogies...
- DNA: code in your repo
- RNA: code in your working directory
- transcriptase: 'git fetch'
- ribosome: compiler
- proteins: executable object code (ribosomes are also proteins, mostly)
- epigenetics: build config options
- promoter site: `ifdef
First, imagine a system where every time you compile something, the object code is immediately launched in its own thread executing truly in parallel with all the others.
The overall behavior of the cell is the interaction of all these threads. A gene is a single block of code. They can do lots of things, including changing build options and enabling/disabling the generation of other blocks of code. We say a particular gene causes a particular effect, but really it's the aggregate interaction that does things. Most traits require the cooperation of many genes to express. If we associate a gene with a particular trait, it's usually because it is a critical component of that trait; necessary so if you break the gene the normal aggregate behavior goes away, but not sufficient - it still needs a lot of other working genes to have the right effect.
Now imagine that some of those threads run a constant cleanup process that kills running threads, delete your object code and delete files in your working directory (largely at random) while another set of threads are constantly fetching (transcriptase) and recompiling (ribosomes) code to launch new threads to keep the system working and your services up. During this process the relative number and type of running threads will change according to a combination of code and the environment.
Viruses are a tiny executable (protien coat) that copies some rogue code (RNA) into your working directory, so that constant recompilation will generate new instances that copy more code, etc.
Too many running virus instances will crash the system (kill the cell) by starving/corrupting normal processes. The random deletion and constant fetching from the repo slows the virus replication down however, and may stop it entirely.
_Retro_viruses have an additional piece:
- reverse transcriptase: 'git commit; git push'
which will copy the virus code back into your repo. Now the regular 'fetch' will copy the virus code back into your working directory.
Your immune system has processes which run around checking object hashes for threads. There's a whitelist for expected hashes (normal threads). If the same unexpected hash shows up too many times, it goes on a blacklist and you start generating antibodies- special threads that go around searching for a specific object hash and tagging that thread for deletion. If too many bad hashes are found in the same place, a white blood cell nukes the whole site from orbit.
Once you generate enough antibodies, the virus threads start getting killed before they can replicate and you're immune. If the virus mutates, the hash may not match anymore and you'll be vulnerable to the new strain. Things like the common cold and influenza mutate all the time, so you can very them over and over while chicken pox rarely mutates and youth can usually only get it once.
Vaccines are a bunch of copies of (usually inactive) threads with a particular hash, to encourage your immune system to put that hash on the blacklist.
Autoimmune diseases happen when valid code accidentally gets on the blacklist.
Cancer (a fork bomb) tends to evade the immune system because its code was already on the whitelist.
But... this is a super simplified version of how things work, and really only applies to mammals. Do not take these analogies too far.
Biology is fascinating, and definitely worth deeper study.