Is there a design pattern that lends itself to building a foundation of components to help solve Project Euler problems? I’ve solved ~30 issues – and I find that I’ll need to re-use functionality that was previously written (e.g primality checks). Instead of writing static methods in a utility class, I was thinking of having a calculator interface – implemented by various concrete classes that will solve different sub problems. I could then build on that as I solve increasingly complex problems – maybe? Does anyone have any good suggestions? I’m solving the problems in Java.
Is there a design pattern that lends itself to building a foundation of components
Share
There are some functions that come in handy repeatedly, like for generating primes. You could keep a file with useful functions in them. Beyond that I don’t think there is any benefit. Project Euler problems are more about the math than they are about complex programming, I expect that if you have to write a lot of code you are doing it wrong.