Edit - I'll concede that analogies are absolutely fun haha. They might be useful to come up with when you yourself are trying to better understand something by drawing connections to other things you know and all. But I don't think they're ideal for being taught the subject. And again, for a layperson, analogies are totally fine if you just want a surface level understanding of "oh, mitochondrias are powerhouses of the cell." But if you want to do anything with that, beware the dangers.
The second analogy is ok, but again not really great if you want to understand what's actually going on. If you just want to get an intuition that DNA has something to do with storing information, as long as that comes with an understanding that information evolves (biology is really the study of evolution in many ways), that's probably more than enough for a layperson. But it's a dangerous understanding if you plan on using it as a foundation to try and explore more complicated topics in biology. There's no need to do so, but if you are going to, it's far far better to spend the time getting the correct first-principles understanding and get rid of this idea of "DNA as source code" so you can better grapple with the subject.
I don't think the first analogy makes much sense since it makes nucleotides the sort of active agents here and needlessly focuses on individual nucleotides when codon triplets are what are involved in coding for proteins (probably better to, if you have to use an analogy, treat nucleotides as letters instead of words). And, especially in the context of this thread, neither analogy build the understanding needed to really dive into what RNA is, which is important for understanding what RNA viruses are, and what the coronavirus is.