Lately I've been going back over some code that uses very large parameter files, comparing how the different source code(s) actually use the energy parameters, and what orderings/permutations they follow. It's been interesting, neither original source is written the way I'd like and how they actually use the different pieces is not always clear, so it takes a bit of work.
I had an idea today that I can't believe I didn't think of earlier though, which was how to actually split up the different file reading codes - I was setting it up as the same object and writing functions that could read either file. Stupid, what I should have done is write two objects that derive from the same class, and make each one read the appropriate type and interface that way. That'd let me use different sized data structures (one of the big issues), as well as being much cleaner for interface and requiring no computational overhead when switching energy models. Sigh, should have thought of that first.
1 comment:
My best inspirations have had a tendency to come with the exclamation, "I'm so stupid!" (My version of "Eureka!"...) Basically, there is simultaneously excitement from the insight and the realization that I should have thought of the idea earlier. So I definitely empathize with what you're writing.
As the great probabilist George Polya said, "Everything is easy upon reflection."
Post a Comment