Re: [Adapter] Make AdapterManager.getAdapter transitive operation
On 03.03.2013, at 00:05, Miroslav Smiljanic smmiros...@gmail.com wrote: Currently if A adapts to [B, D], and B adapts to [C], adapter manager will not adapt A to C even if it is potentially possible. AdapterManager.getAdapter method has to be called twice. I have done some code modifications and made operation transitive. Do you think that it would be worth to add this new capability to AdapterManagerImpl? That sounds like a bit too much magic to me, I think it's better if devs are forced to explicitly adapt things one at a time Do you have a use case? Cheers, Alex
Re: [Adapter] Make AdapterManager.getAdapter transitive operation
Hi Am 04.03.2013 um 12:16 schrieb Alexander Klimetschek: On 03.03.2013, at 00:05, Miroslav Smiljanic smmiros...@gmail.com wrote: Currently if A adapts to [B, D], and B adapts to [C], adapter manager will not adapt A to C even if it is potentially possible. AdapterManager.getAdapter method has to be called twice. I have done some code modifications and made operation transitive. Do you think that it would be worth to add this new capability to AdapterManagerImpl? That sounds like a bit too much magic to me, I think it's better if devs are forced to explicitly adapt things one at a time Agreed. Regards Felix Do you have a use case? Cheers, Alex -- Felix Meschberger | Principal Scientist | Adobe
Re: [Adapter] Make AdapterManager.getAdapter transitive operation
Hi Alex, Felix Thanks for sharing your thoughts. The real magic was to implement cache of adapter factory descriptors, indexed by adaptable and adapter, and to maintain that. It works really well btw. Proposed implementation change would just query that cache more that once, what is currently done. On Mon, Mar 4, 2013 at 12:59 PM, Felix Meschberger fmesc...@adobe.comwrote: Hi Am 04.03.2013 um 12:16 schrieb Alexander Klimetschek: On 03.03.2013, at 00:05, Miroslav Smiljanic smmiros...@gmail.com wrote: Currently if A adapts to [B, D], and B adapts to [C], adapter manager will not adapt A to C even if it is potentially possible. AdapterManager.getAdapter method has to be called twice. I have done some code modifications and made operation transitive. Do you think that it would be worth to add this new capability to AdapterManagerImpl? That sounds like a bit too much magic to me, I think it's better if devs are forced to explicitly adapt things one at a time Agreed. Regards Felix Do you have a use case? Cheers, Alex -- Felix Meschberger | Principal Scientist | Adobe -- Best regards, Miroslav
Re: [Adapter] Make AdapterManager.getAdapter transitive operation
On Mon, Mar 4, 2013 at 5:38 AM, Miroslav Smiljanic smmiros...@gmail.com wrote: ...Proposed implementation change would just query that cache more that once, what is currently done Yes, but from the user's point of view there's the additional magic of a transitive chain of adapters. I agree with others that that's too much magic - the adapter pattern potentially creates non-transparent code (when abused by adapting apples to oranges), if it's transitive the risk is even higher. -Bertrand
Re: [Adapter] Make AdapterManager.getAdapter transitive operation
2013/3/4 Bertrand Delacretaz bdelacre...@apache.org: On Mon, Mar 4, 2013 at 5:38 AM, Miroslav Smiljanic smmiros...@gmail.com wrote: ...Proposed implementation change would just query that cache more that once, what is currently done Yes, but from the user's point of view there's the additional magic of a transitive chain of adapters. I agree with others that that's too much magic - the adapter pattern potentially creates non-transparent code (when abused by adapting apples to oranges), if it's transitive the risk is even higher. Apart from this too much magic, I guess the implementation might really have a negative impact on performance unless you limit the transitive search to one level. Regards Carsten -- Carsten Ziegeler cziege...@apache.org
Re: [Adapter] Make AdapterManager.getAdapter transitive operation
Hi Carsten, Apart from this too much magic, I guess the implementation might really have a negative impact on performance unless you limit the transitive search to one level. Yes, it has complexity of tree traversal, and idea was to limit look up to certain number of levels. But I guess that we got enough no go replies :) -- Best regards, Miroslav
[Adapter] Make AdapterManager.getAdapter transitive operation
Hi all, Currently if A adapts to [B, D], and B adapts to [C], adapter manager will not adapt A to C even if it is potentially possible. AdapterManager.getAdapter method has to be called twice. I have done some code modifications and made operation transitive. Do you think that it would be worth to add this new capability to AdapterManagerImpl? Regards, Miroslav