I come from a background where using a configuration file for every, if not every, constant is the best solution for maintainability and flexibility of the program. By this I mean, every hard coded string, integer, table/array, boolean, color, formatting expression, etc. are all put in one file or class (often called the Configuration class).A big benefit to this solution is that is future proofs accidental code changes that can introduce new features when a main class or code block is modified. I find that it gets developers out of code areas that should not be touched without really thinking about it. It also makes a code in a main class or section much more readable and coherent (see below):if (x == 5){    // Logic here}Versusif (x == Config.MaxNumberOfResults){    // Logic here}the later being MUCH more readable and coherent (especially in the future) and requires little to no comments to maintain as well as no logic needs rewriting if we decide we want a higher max of results.The issue with the former code is that some other developer would eventually figure out that 5 is the max result limit and then think I want something different than that so (a few attempts later) they include that number (because god-forbid changing the number) thus putting >= now so the entire code block changes...which may introduce a feature somewhere else later on down the line. Using the configuration method would result in most developers never even touching the main logic (usually).The problem is that my boss likes the idea, but wants to leave some constants in main code files even if they are only used once (i.e. that 5 or max result is only used once (right there), so does it really make sense to put a reference to it from another class/file?) I, of course, think so because of the aforementioned reasons as well as it is just cleaner and more coherent code.Is my thinking more inline with correct coding conventions/methodologies or is my boss'?I am fine with doing it his way, but it just feels like it will come back to haunt me later on down the road.
Using A Configuration Class (For All Constants/Magic's)
methodology;conventions