Return-Path: Delivered-To: apmail-incubator-shiro-dev-archive@www.apache.org Received: (qmail 60273 invoked from network); 13 May 2010 00:19:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 May 2010 00:19:24 -0000 Received: (qmail 55378 invoked by uid 500); 13 May 2010 00:19:24 -0000 Delivered-To: apmail-incubator-shiro-dev-archive@incubator.apache.org Received: (qmail 55304 invoked by uid 500); 13 May 2010 00:19:24 -0000 Mailing-List: contact shiro-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: shiro-dev@incubator.apache.org Delivered-To: mailing list shiro-dev@incubator.apache.org Received: (qmail 55296 invoked by uid 99); 13 May 2010 00:19:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 May 2010 00:19:24 +0000 X-ASF-Spam-Status: No, hits=-0.2 required=10.0 tests=AWL,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.212.175] (HELO mail-px0-f175.google.com) (209.85.212.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 May 2010 00:19:19 +0000 Received: by pxi14 with SMTP id 14so340014pxi.6 for ; Wed, 12 May 2010 17:18:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.141.3.3 with SMTP id f3mr101854rvi.237.1273709939124; Wed, 12 May 2010 17:18:59 -0700 (PDT) Sender: les.hazlewood@anjinllc.com Received: by 10.140.171.20 with HTTP; Wed, 12 May 2010 17:18:59 -0700 (PDT) In-Reply-To: References: Date: Wed, 12 May 2010 17:18:59 -0700 X-Google-Sender-Auth: N3Jyz-wDwL3JtrlcpZpJ-D2Pw6Y Message-ID: Subject: Re: r942498 - removing all convenience methods? From: Les Hazlewood To: shiro-dev@incubator.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Ah - nice to see you jump in Bryan :) You're right - the add/remove methods don't preclude getters and setters - they could co-exist. I was looking for consistency more than anything across all properties - not *Registar/*Aware constructs for some properties and not have it for the majority of others. But if the user community feels strongly about this, we can of course add them later. As you know, it is much easier to add after 1.0 than it is to take away :) Les On Wed, May 12, 2010 at 4:29 PM, Bryan Turner wrote= : > > I'd like to jump in on this and say that I think both approaches have val= ue. There's little reason, in my opinion, why both can't be done. add/remov= e methods do not necessarily preclude get/set methods; I think both should = be in the code for these sorts of framework pieces. > With regards to IoC and injection, I'll start by declaring my allegiance:= I _hate_ constructor injection and I remove it everywhere I can. That said= , I recognize that is offers an _appearance_ of better safety and that it h= as its benefits and proponents. Constructor injection quickly swells to unm= anageable proportions when objects have many dependencies. This becomes par= ticularly onerous if many of those dependencies are optional dependencies. = Setter injection better expresses this: If you need a component, set it; if= you don't need it, don't set it. Supporting setter injection out of the bo= x seems like it provides the broadest overall avenue of capability and seem= s, based on my experience with how people use IoC, like it supports the des= ires of the greatest percentage of IoC users. > The important thing, to my mind, is that these setters not be on the inte= rfaces exposed by the objects. If abstract base classes and other default i= mplementations expose mutator methods built for initialization, so long as = the interface they are implementing does not have them, then those mutators= are not noise to the end user of the object. In that regard, I agree with = Kalle: It seems like add/remove semantics should be observed for listeners = in the interfaces. If the implementation includes setter methods to support= that style of injection, then that's hidden from consumers of the object. > Just my two cents, and probably a bit out of the blue. But I've converted= a substantial portion of shiro-core to .NET, so I have a fairly experience= with the codebase. > Bryan Turner > >> Date: Wed, 12 May 2010 14:59:36 -0700 >> Subject: Re: r942498 - removing all convenience methods? >> From: kalle.o.korhonen@gmail.com >> To: shiro-dev@incubator.apache.org >> >> On Wed, May 12, 2010 at 2:43 PM, Les Hazlewood w= rote: >> > Agreed. =C2=A0And after working with all these getters/setters and try= ing >> > to figure out when it is safe to initialize things or not, I would >> > _REALLY_ love to use constructor injection for everything. >> > Unfortunately, for whatever reason or another, a lot of people seem to >> > really dislike using it :/ >> >> They just haven't seen the light yet :) >> >> > I guess its because there are scenarios where constructor injection >> > probably wouldn't be pleasant - think of how many permutations of >> > config options there are for dependency injection. =C2=A0It seems like= that >> > could get really ugly. =C2=A0I don't know for sure, as I've been using >> > Spring property injection for some time and only rarely constructor >> > injection - they allowed me to be lazy in that regard :/ >> >> Right.. in this specific case a constructor collection and an add >> operation would be the best choice from Guice/Tapestry 5 perspective >> but then you'd really need to use either of those IoC containers to >> implement it properly. And there's no point re-working the internals >> now - this works and at least, like you said, it's consistent >> throughout. >> >> Kalle > > _________________________________________________________________ > Hotmail has tools for the New Busy. Search, chat and e-mail from your inb= ox. > http://www.windowslive.com/campaign/thenewbusy?ocid=3DPID28326::T:WLMTAGL= :ON:WL:en-US:WM_HMP:042010_1