Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37331

Re: Where to put the return

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Where to put the return
Date 2017-08-21 22:29 +0200
Message-ID <f00u61Fr6tbU1@mid.individual.net> (permalink)
References (1 earlier) <omlidd$k9h$1@gioia.aioe.org> <ev9dm4Ff34aU1@mid.individual.net> <87y3qlnyvj.fsf@munus.decebal.nl> <evqdjvFbc1oU1@mid.individual.net> <e15b4d92-b5ba-495e-b853-e6548983ab31@googlegroups.com>

Show all headers | View raw


On 19.08.2017 18:20, lewbloch@gmail.com wrote:
> Constants make sense even if used only once. Seeing the constants at
> the top of the class definition gives one a quick view of the
> functionality below,

I am not sure whether a bunch of String constants containing SQL 
statements really conveys the "functionality below".

> and provides an easily-located maintenance point
> if one decides later to change the constant value.

That is correct in the general case.  However, we are talking about SQL 
statements which have close ties to the method that uses it (the method 
needs to extract the correct columns into matching Java types etc.) so 
it is likely that the SQL and the method implementation need to be 
changed in lock step.  I think maintenance in this case is simpler if 
the SQL lives inside the method.

> I'm highly opposed to defining constants outside the class with which
> they're semantically associated.

+1 (Just in case it has not been clear: I am not advocating moving these 
constants out of the class that uses them but inside methods - at least 
for the cases where there is just one using method.)

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-11 10:30 +0200
  Re: Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-11 12:24 +0200
  Re: Where to put the return Eric Douglas <e.d.programmer@gmail.com> - 2017-08-11 08:31 -0700
  Re: Where to put the return Arne Vajhøj <arne@vajhoej.dk> - 2017-08-11 20:33 -0400
    Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-13 00:27 +0200
      Re: Where to put the return Arne Vajhøj <arne@vajhoej.dk> - 2017-08-12 21:41 -0400
        Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-13 13:15 +0200
      Re: Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-15 08:12 +0200
        Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-19 11:10 +0200
          Re: Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-19 12:54 +0200
            Re: Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-19 13:46 +0200
              Re: Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-19 14:10 +0200
              Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-19 15:35 +0200
                Re: Where to put the return Arne Vajhøj <arne@vajhoej.dk> - 2017-08-19 09:48 -0400
                Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-19 23:26 +0200
                Re: Where to put the return Arne Vajhøj <arne@vajhoej.dk> - 2017-08-19 20:01 -0400
                Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-20 19:30 +0200
                Re: Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-19 17:06 +0200
            Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-19 15:35 +0200
              Re: Where to put the return Arne Vajhøj <arne@vajhoej.dk> - 2017-08-19 09:43 -0400
              Re: Where to put the return Cecil Westerhof <Cecil@decebal.nl> - 2017-08-19 17:15 +0200
                Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-21 22:33 +0200
          Re: Where to put the return lewbloch@gmail.com - 2017-08-19 09:20 -0700
            Re: Where to put the return Robert Klemme <shortcutter@googlemail.com> - 2017-08-21 22:29 +0200
    Re: Where to put the return Eric Douglas <e.d.programmer@gmail.com> - 2017-08-14 05:11 -0700
  Re: Where to put the return Brixomatic <brixomatic@yahoo.com> - 2017-08-31 19:27 +0200

csiph-web