Links

   Quran Explorer - Interactive Audio Recitations & Translations

Monday, April 29, 2013

LMFAO - Looking Manualy for Abnormal Output


Dont use System.out() for debugging a serious java app. Use logs(runtime) and JUnit for testing.

The best explanation is (from a StackOverflow thread)

Question(part):
"Whether I write simple applications or larger ones I test them with the System.out statements and it seams quite easy to me. " and on he goes asking whay he should use JUnit.

Answer(part):

That's not testing, that's "looking manually at output" (known in the biz as LMAO). More formally it's known as "looking manually for abnormal output" (LMFAO).
Any time you change code, you must run the app and LMFAO for all code affected by those changes. Even in small projects, this is problematic and error-prone.
Now scale up to 50k, 250k, 1m LOC or more, and LMFAO any time you make a code change. Not only is it unpleasant, it's impossible: you've scaled up the combinations of inputs, outputs, flags, conditions, and it's difficult to exercise all possible branches.
Worse, LMFAO might mean visiting pages upon pages of web app, running reports, poring over millions of log lines across dozens of files and machines, reading generated and delivered emails, checking text messages, checking the path of a robot, filling a bottle of soda, aggregating data from a hundred web services, checking the audit trail of a financial transaction... you get the idea. "Output" doesn't mean a few lines of text, "output" means aggregate system behavior.

Lastly, unit and behavior tests define system behavior. Tests can be run by a continuous integration server and checked for correctness. Sure, so can System.outs, but the CI server isn't going to know if one of them is wrong–and if it does, they're unit tests, and you might as well use a framework.
No matter how good we think we are, humans aren't good unit test frameworks or CI servers.


Source StackOverflow

No comments:

Post a Comment

Feel free to leave a comment