Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: How to handle same sanity checks Date: Sat, 24 Jun 2017 10:33:26 -0000 (UTC) Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <87o9tgo0a9.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 24 Jun 2017 10:33:26 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="6cf5fc98ca34b9dad817c250474e1a56"; logging-data="22402"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19S9NLS9rFhYSUEajaOldf1CrbmKWoBDSQ=" User-Agent: Pan/0.141 (Tarzan's Death; 168b179 git.gnome.org/pan2) Cancel-Lock: sha1:Q5+pi1gz91Yl8GSB9YIKE92zqP0= Xref: csiph.com comp.lang.java.programmer:36712 On Sat, 24 Jun 2017 12:06:28 +0200, Robert Klemme wrote: > Premature modularization. That makes only sense if the variability is > needed. Since this is a private method (which should be static btw.) I > would only do the minimum what is needed. > Since almost every program I write has a need for both error reporting and diagnostic tracing *and* past experience has shown that a well thought out diagnostic tracing scheme remains valuable when code is in production, you won't be surprised to hear that I have similar facilities for use in both C and Java. In the Java case its a single class capable of direct output via the error channel but that also has the ability to accumulate the last 'n' tracing messages in a circular buffer and to output them if an error is being reported (I swiped this idea from a mainframe OS, where its ability to show what happened in the last second or two before a crash was invaluable). So I agree that the stand-alone method is a kludge, while at the same time its presence does declutter the code and also serves the useful purpose of getting rid of repetitive code. However, something like my rather more comprehensive diagnostic and reporting facility is more generally useful and reusable. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |