http://qs1969.pair.com?node_id=425522


in reply to Basic programming question

I was wandering what 'solution' would be better, since I run into these kind of thing regularly and it made me curious if there would be a 'common' way to handle this.
That's not an interesting question, and until this far, none of the answers given are very helpful in answering the question.

It's also a very, very open question. You're very specific about the (hardly relevant) details -- the code --, but expect the six letters to name it, "better", you don't discuss the main thing at all.

How do you expect this forum to answer your question, if you don't describe at all what you mean by "better"? Better in which way? Faster? Less memory? Less code? Or do you measure in more subjective ways, like easier to understand (which is of course a hopeless question to ask).

If you want to advance yourself in programming, don't come up with two pieces of code, and ask others what the better code is. You'll get little out of it. Instead, analyse the pieces of code yourself, and come up with reasons why you want to one piece and why you want to use the other piece of code.