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


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

Re: Needs help in editing

From lewbloch <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Needs help in editing
Date 2011-07-22 15:52 -0700
Organization http://groups.google.com
Message-ID <a44cd896-5d48-416b-9f67-52826f3d01e3@s33g2000prg.googlegroups.com> (permalink)
References (2 earlier) <4e03c0a3$0$23665$426a34cc@news.free.fr> <4389af7c-3124-42ea-b092-54999cff42c2@z7g2000prh.googlegroups.com> <4e04e54a$0$6275$426a34cc@news.free.fr> <iu7qcd$g7l$1@news.albasani.net> <4e29f5f1$0$304$14726298@news.sunsite.dk>

Show all headers | View raw


On Jul 22, 3:13 pm, Arne Vajhøj <a...@vajhoej.dk> wrote:
> On 6/26/2011 1:30 PM, Lew wrote:
>
>
>
>
>
>
>
>
>
> > Aéris wrote:
> >> lewbloch a écrit :
> >>> Reflection is an elephant gun for
> >>> shooting fleas; simple polymorphism suffices in most cases.
>
> >> I totally aggree.
>
> >> But with this (craps) code and because constructors with different
> >> prototype, reflection is unavoidable?
>
> > Reflection is mostly avoidable. A little light use of
> > 'Class#newInstance()' with package-private builders called by a factory
> > method isn't very risky and avoids the typical mad craziness of looking
> > up 'Method' or 'Constructor' instances. If you're going down that latter
> > route, leave programming to those better equipped for it.
>
> > If you think heavy use of reflection will fix crappy code, boy are you
> > ever wrong. Shit piled on top of shit only smells worse.
>
> It depends a little bit about what you are doing.
>
> I would not want to implement a Java EE 6 server without being
> allowed to use reflection.
>
> Even some business code can use some reflection even though in
> most cases it is better to hide the reflection via some DI
> framework.
>
> Reflection is a very useful tool and a very powerful tool. One
> should just limit its use to where it is necesarry.
>
> A B-52 bomber is also pretty powerful if you want to engage in a war.
> It is not the correct tool for getting rid of the mosquitos in the
> house.
>

That's why I referred to "heavy use" of reflection and in the context
of crappy code.  I completely agree that reflection is useful when
needed, but whether you say "B-52 for mosquitoes" or "elephant gun for
fleas" , the message is the same.  Thanks for endorsing my point.

--
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Re: Needs help in editing Arne Vajhøj <arne@vajhoej.dk> - 2011-07-22 18:13 -0400
  Re: Needs help in editing lewbloch <lewbloch@gmail.com> - 2011-07-22 15:52 -0700

csiph-web