If I'm faced with the decision to write clean, beautiful code, but I'd be opening up a new path bugs could take to appear, should I take it? (Provided I'm not willing to spend the time to come up with a way that satisfies both.)
To elaborate: I'm writing a Pong game as practice, and I could either write the exactly same line of code in two if-else statements or include it as an else statement. The latter approach is certainly more elegant, but it means that any unaccounted for game objects will trigger it. They shouldn't.
Now, since this is a Pong game, the only game objects are the two rackets (or whatever they're called), the ball, and visible walls the ball can either bounce off (i.e. the horizontal ones) or invisible walls that serve as triggers for it to cross to score a point (i.e. vertical walls). So, the addition of an else statement shouldn't be catastrophic in this case.
But what about in other, similar cases I'd encounter in the future, working on other projects? Should I neglect writing clean code in favor of practicality or not? Or should I perhaps include an error case that would print to the console in case it's set off, to clue me in and make debugging easier? Or should I really just take the time to write code that is both clean and bug-preventing?
I want answers from the perspective of both a solo developer and one working in a team. It doesn't have to be about game development, but rather programming in general.
What's the better practice?