5 ms·
> tendency of undescriptive single letter variable There are 2 schools of thought on which one is clearer, F = G * m1 * m2 / r**2 or force = gravita
by sampo 3y ago
> tendency of undescriptive single letter variable
There are 2 schools of thought on which one is clearer,
F = G * m1 * m2 / r**2
or
force = gravitational_constant * mass_of_body_1 * mass_of_body_2 / distance_between_bodies ** 2
- trashtester 3y agoPhycisist : > F = G * m1 * m2 / r**2 Computer scientist: nonrelativistic_gravitational_force = ( Physics.NonRelativistic.Gravity.gravitational_constant * body1.NonRelativistic.mass() * body2.NonRelativistic.mass() / body1.NonRelativistic.distanceTo(body2) ** 2 )*
- ZaoLahma 3y agoSoftware engineer straight out of uni: # Get force of gravity as below to be used later F = G * m1 * m2 / r*2 Software engineer 5 years after uni: gravitational_force = ( PhysicsContextConstructorFactory.createByRelativisticEnum(SystemConfig.getRelativisticEnum()).construct().getGravitationalConstant().value() * body1.getRelativisticContext(SystemConfig.getRelativisticEnum()).mass().value() * body2.getRelativisticContext(SystemConfig.getRelativisticEnum()).mass().value() / SystemConfig.getRelativisticContext(SystemConfig.getRelativisticEnum()).distanceTo(body1, body2).value() \* PlatformUnsignedInt(PlatformMinMaxAwareUnsignedInt(2).value()).getUnsignedInt().value() )* Software engineer after 15 years: # Newton's law of universal gravitation is well within wanted margin of error F = G * m1 * m2 / r*2
- lloeki 3y agoSadly the 5y SE forgot about dependency injecting the computation... after all we're always on the brink of new physics discovery, we'd hate to have to rewrite all that code when we can readily swap in fresh laws with the proper architecture!
- ZaoLahma 3y agoOh, but that comes as a needs-to-be-fixed to the pull request from the 6y SE, so no worries at all.
- cabalamat 3y agoShort names are OK if they are explained somewhere. I often explain them in a comment at the start of a class or function.