grokking hard

code smarter, not harder

Today I Found: Soft-Coding & #1 Deadly Sin of Programmers

Posted at — 2017-May-17

A question on StackOverflow, What is Soft-Coding (anti-pattern), introduced me to the term soft coding (a pun to hard coding).

Below is a quoted code snippet of the accepted answer:

1
2
3
4
5
6
7
SpecialFileClass file = new SpecialFileClass(200); // hard coded

SpecialFileClass file = new SpecialFileClass(DBConfig
  .Start()
  .GetConnection()
  .LookupValue("MaxBufferSizeOfSpecialFile")
  .GetValue());

Too much of anything is not good. The above is not an exception. Too much of flexibility leads to over-engineering.

This is somehow similar to the "#1 deadly sin in the series" in Seven Deadly Sins of Programming by Eric Gunnerson.