The Dangers of Soft Coding

Started by Thorin, June 13, 2012, 02:14:10 PM

Previous topic - Next topic

Thorin

Nice little essay about Soft Coding (the practice of putting too much in config files for fear of hard coding): http://thedailywtf.com/Articles/Soft_Coding.aspx
Prayin' for a 20!

gcc thorin.c -pedantic -o Thorin
compile successful

Mr. Analog

I've seen this sort of thinking gone to extremes where there was a bootstrapper for the bootstrapper (Yo Dawg).
By Grabthar's Hammer

Darren Dirt

my current OracleUCM import/export tool I've been working on in Java/Eclipse has resulted in me almost heading too far in that direction. At first I created a handful of debug-flag constants ... that soon enough became variables as I got pieces to work and made my main() process the args[] to allow for those same debug flags to be set (i.e. to over-ride the in-code defaults with some external-argument override values).

That way I can easily have a couple of different run configurations depending on the level of detail I want to see as it runs. Most of the time I run with the extra flags turned off, but when something really screwy is happening and I don't want to step thru line by line (yet!) then I rely on my extra detail being output to see what's the status of things as it progresses.


But I definitely should read the linked dailywtf article to see just how bad an extreme I coulda taken it...
_____________________

Strive for progress. Not perfection.
_____________________

Thorin

Would log4j help you, Darren?  Then you could put LogError(), LogInfo(), LogTrace() calls in your code and turn the logging up or down with a logging config file.  I've used log4net which is based on log4j, and it's been really quite nice to use.

Although I'm assuming by different configurations you just mean different levels of logging.  Or do you actually have different code running in different configurations?
Prayin' for a 20!

gcc thorin.c -pedantic -o Thorin
compile successful

Darren Dirt

Quote from: Thorin on June 13, 2012, 03:52:23 PM
Would log4j help you, Darren?  Then you could put LogError(), LogInfo(), LogTrace() calls in your code and turn the logging up or down with a logging config file.  I've used log4net which is based on log4j, and it's been really quite nice to use.

Yeah, probably.
_____________________

Strive for progress. Not perfection.
_____________________

Thorin

The beauty of log4j, by the way, is that if your code is split into multiple classes and you only care about detailed logging for one class, you can turn up the logging level just for that class and not have your logfiles cluttered with logging from classes you don't care about.

It's a beautiful thing 8)
Prayin' for a 20!

gcc thorin.c -pedantic -o Thorin
compile successful