2 ms·
Of course, context modulates everything. Here the context is an informal discussion to throw generalities on our own feelings on what makes a code readable. Sur
by psychoslave 6y ago
Of course, context modulates everything. Here the context is an informal discussion to throw generalities on our own feelings on what makes a code readable. Sure, for more specific cases backed with some contextual data, it might be overkill to have a too sophisticated code hierarchy.
For your new example, I would find any of the following more fine:
maximum_celerity = 300 # Mm/s
class Physics { public const speed c = 299792458; }
current_pace = speed(particle: photon, environment: vacuum, unit: Units.parsecs_per_year)
So, I agree, length of identifiers alone is not enough to trigger a "this would be more nicely structured as…", and context matter. "speedOfLightInVacuumMetersPerSecond" is readable, and might be good enough for some specific contexts. But I wouldn’t take that as a desirable practice example.
Just because context matters, doesn’t mean that "all generality are absolute evil" (a statement that condemn itself).