DRY, modular, etc. are not blanket principles that one must honor at all cost, in every circumstance. They are ways to simplify and organize complex code bases. Not making the code base complex in the first place takes first place, though.
Brian Kernighan wrote "Controlling complexity is the essence of computer programming." The best way to control complexity is to eliminate it, and not introduce it in the first place.