lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <>
Subject Re: [jira] Updated: (LUCENE-1987) Remove rest of analysis deprecations (Token, CharacterCache)
Date Mon, 19 Oct 2009 20:00:32 GMT
On Mon, Oct 19, 2009 at 3:45 PM, Mark Miller <> wrote:
> but there is some old source code here and
> there that really bugs me

Is it Doug's

  if (foo)
  else {

or is it my single line

  if (a==null) return 0;


One of my personal pet peeves is more indentation than necessary for
large blocks of code, rather than just immediately handling the
exception cases and escaping. Example:

void doSomething(MyObj obj) {
  if (obj != null) {    // at this point, I'm wondering... hmmm, is
there code that executes *after* this huge "if" in the event that obj
is null?
      // same with this one... ya gotta go and try to match up braces
to see if there is code that executes in the opposite case...
      // and if it also falls through to execute the obj==null case or
simply returns.
      if (some other condition) {
          [ tons of code ]
          [ tons of code ]

A much more readable version (regardless of if one likes the
single-line syntax or not):

void doSomething(MyObj obj) {
  if (obj==null) return;  // immediately obvious handling of the exception case
  if (!some other condition) return;  // again, immediately obvious
how the exception case was handled

   [ tons of code ]
   [ tons of code ]


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message