Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • But the only thing relevant about the nucleotide is "what kind is it"? It's nothing more than a value object as the asker uses it, and should be a good candidate for a flyweight proxy... Commented Aug 27, 2013 at 17:28
  • @tuespetre - we don't know the OP's particular usage. From the limited biology work I've done with RNA and DNA, there are a number of properties that may need to be modeled or considered. So that's why I presented a full OO model for the question. If we took YAGNI to the extreme here, all that's necessary is some strings to capture the nucleotide sequence. The OP's inference in asking for an OO model is that they are doing more than that. Commented Aug 27, 2013 at 17:35
  • (Speaking C#) If each strand is nothing more than a List<T> of nucleotides, and he used singleton nucleotides, he could do something like this: var numberofgNucleotides = strand.Where(n => n == GNucleotide.Instance).Count() which would meet the need described in the question ("I want to be able to decide the number of Nucleotide types at runtime.") Commented Aug 27, 2013 at 18:39
  • Of course, in a very light pattern, a strand could just be a queryable string, too. Commented Aug 27, 2013 at 18:40
  • Sorry, I think I was a bit unclear. When I mentioned AGCU I was just showing an example with 4 types. I'd like to be able to, at runtime, decide to have an arbitrary number of types. For example, have 26 types (ABCDEF... etc). Commented Aug 27, 2013 at 18:43