Re: [Springnet-developer] Object creation invokingprotected constructors?
Brought to you by:
aseovic,
markpollack
|
From: Trudel, S. <ste...@ba...> - 2007-09-11 11:50:25
|
I prefer to have my tests are embedded in the module (i.e. there is a UnitTest sub-module in every module). I don't want the fact that my unit tests are outside the project to influence class design either. I use a compilation switch to exclude them. ________________________________ From: Erich Eichinger [mailto:E.E...@di...] Sent: Tuesday, September 11, 2007 7:44 AM To: Trudel, Stephen; springnet-developer Subject: RE: [Springnet-developer] Object creation invokingprotected constructors? Hi Stepen, playing the "advocatus diaboli" now: How do you write tests for this class then? If your design does not allow for instantiating the class, why should Spring be allowed to? -Erich ________________________________ From: spr...@li... [mailto:spr...@li...] On Behalf Of Trudel, Stephen Sent: Tuesday, September 11, 2007 1:40 PM To: Erich Eichinger; springnet-developer Subject: Re: [Springnet-developer] Object creation invokingprotected constructors? Related question ... does Spring.Net support object construction for objects with internal constructors? If one does not want the instantiation of an object to be allowed outside the scope of a module for purposes of conceptual integrity or otherwise then Spring.Net should support its construction in my opinion ... seem somewhat awkward when class design is influenced by a framework ... ________________________________ From: spr...@li... [mailto:spr...@li...] On Behalf Of Erich Eichinger Sent: Sunday, September 09, 2007 6:36 AM To: springnet-developer Subject: [Springnet-developer] Object creation invoking protected constructors? Steinar on the forum asked this here: http://forum.springframework.net/showthread.php?t=3448 I'd like to revisit the design decision to not allow accessing non-public types/constructors/methods/properties and hear your opinions on this. I recently ran into this issue myself when trying to provide a DI capable wrapper for "System.Web.UI.SimpleHandlerFactory" from System.Web assembly. This type is internal and can't be instantiated using Spring which required to implement a (non-trivial) workaround. The easy way would be to remove the restriction to public types. I know of opinions out there to don't enforce any restrictions within the framework. Developers should know what they are doing and if someone wants to instantiate a non-public type, let him do it at his own risk. Other opinions? cheers, Erich |