R4481 Checkstyle Parameter Rename Issue
Cantor, Scott
cantor.2 at osu.edu
Wed Sep 7 17:24:38 EDT 2016
On 9/7/16, 5:13 PM, "dev on behalf of Brent Putman" <dev-bounces at shibboleth.net on behalf of putmanb at georgetown.edu> wrote:
> Well, I personally don't see a huge difference between a property and a constructor. I
> use them interchangeably in my own Spring stuff and honestly haven't really ever thought
> about them as distinct. Maybe that's just the programmer in me, and the world looks
> different to a non-developer deployer...
It's the contract. Java beans have properties you access by name and so the names are an API contract, but nobody thinks of constructor argument names as a contract and they aren't supposed to be.
In terms of what's palatable though, yes, the c'tor Spring syntax is not palatable without the names.
> I guess I've always thought of the Component interfaces for things that were "larger",
> more important, semi-big ticker. So something like a Function or Predicate to me doesn't
> fall into that category for me.
It didn't for me either at the time but I think I was wrong. I think it's entirely about safe bean initialization in the end.
> Partially, I'm thinking here about lower-level stuff in java-support and OpenSAML, etc.
> If most every class as to be initialized(), in order to avoid having ctors with args,
> that seems to me to get a bit unwieldy.
I'm not saying it's elegant, but I don't have a lot of good ideas.
> Yeah, I guess we just differ on that. I don't see c:_0="foo" as a problem, really. Or if
> that's too unsightly for the non-developer deployer, then can always just use (ordered)
> <constructor> child elements.
I think the p:thing or c:thing syntax is workable, but not much beyond that.
> I think the thing about all this that rubs me slightly the wrong way is that: We say we
> want to keep (almost all of) our code formally independent of Spring. But then if we
> really do (to me) unnatural things to avoid the use of constructors in favor of
> properties+init, just to be more Spring-friendly, then that seems a bit weird.
I think if it's still Spring independent, which is true, then there's a middle ground I'm not all that bothered by. It may not be the ideal Java code but there's a gain in doing it that has to be weighed against coding style preference.
-- Scott
More information about the dev
mailing list