An example of an analogy used in public science discourse:
"What we need is our immune system to be regulated so its kills harmful microbes and tolerates other things. How do we get to that immune system? Well it's because of exposure to microbes, these old friends microbes, okay. And the best way to describe it is to think of our immune system like a computer program, we're born with a fully formed immune system, but as we go through the first days, months, hours and so forth of our life, we're gradually exposed to more and more organisms – when we come down the birth canal we're exposed to these important old friends, organisms, when our mother breast feeds us we're exposed to them, with our sisters and brothers we're exposed to them, importantly also when we go outdoors, so it's not just human organisms it's also outdoor organisms – and these old friends programme our immune system, so they will react to harmful things and they won't react to the non-harmful things"
Prof. Sally Bloomfield (London School of Hygiene and Tropical Medicine), was talking on an episode ('The 5 second rule') of BBC radio show/podcast Curious Cases.
(As the immune system is 'fully formed' at birth but then programmed, the sense here seems to be that the immune system is like a computer, and the effect of interacting with other organisms ('old friends') akin to programming.)
Read examples of scientific analogies
Many examples of science analogies are listed in 'Creative comparisons: Making science familiar through language. An illustrative catalogue of figurative comparisons and analogies for science concepts'. Free Download.