I have a simple question regarding good programming techniques. In particular, I am wondering how to handle grouping constants. At school, they taught us to place our constants at the top of the file in which they are declared in a fist (usually this is a class file, and there are some deviations from the professor). Now I have seen in several places in the industry where ALL constants are pulled and rolled into one large file of type include.
In the first case, it made sense to pull out the constants, since it was a code for games for cell phones, which had to be quickly ported to an amazing number of devices, and this provided a centralized place to work. But later, I find that this practice repeats itself, this is a completely different scenario (internal code for a public utility) with a little justification for why this is (basically, "because it has always been done like that").
So what will be the best practices? I know this may seem mundane, but I have always been told that early early habits are the key to success.
source
share