Posts

Showing posts from May, 2023

When to Generalize and When to Call YAGNI

Image
In Japanese there's an expression, "大は小を兼ねる” "The Greater Embraces the Lesser."   I find that it's a pattern that shows up repeatedly in software.  The general modeling of a problem will contain a particular instance of that problem.  A solution that solves the general problem will solve a particular instance of that that problem. Like in Mathematics, solving the generalized form of a problem may be more complex.  Physics, the observable specific field of study helped inform the derivation of Calculus a generally useful concept across sciences.  Like the Russian Matryoshka doll, several layers of complexity may lie within a larger problem domain.  It's often tech's responsibility to suss out this relationship and pinpoint the layer that our business sponsors really want addressed. For an engineer, it's frequently the case that addressing a particular instance will be faster and less complex to devise than the general purpose solution.  YAGNI (your ...

Rules and Conventions

Image
  A convention is a generally followed practice.  It's a loosely adhered to social norm or value.  A rule, or law is a regulation or guideline that is enforced.  There are consequences for breaking it.  Penal codes are good examples of laws while the Ten Commandments, conventions. We see rules and conventions throughout both human processes and in code.  In Process An example of a convention is the act of returning your shopping cart at the grocery store parking lot.  It's good manners.  Since most people follow this convention, shoppers are able to quickly get a cart when they enter the store.   A similar process that's instead enforced as a rule is the coin operated locker.  To get a locker, you insert a deposit.  This frees up the key to let you lock the locker.  When you're done, you unlock the locker and your deposit is returned.  This resembles the shopping cart system but has stronger enforcement. In Code Style gui...