How to help?

168 views
Skip to first unread message

Ildefonso Martínez Marchena

unread,
Jan 19, 2013, 12:49:34 PM1/19/13
to spri...@googlegroups.com

Hi

i am testing Spring Framework for Delphi. I have been using delphi since Delphi 1 and turbo Pascal and i was developing my own delphi framework when i discovered this framework... i have decided to take a look at it and i have seen it is very powerful and must to be powered to all the Delphi Comunity.

I am a computer engineerer from Spain developing my own thesis about Frameworks so i would like to know how to help and if i could.

All the best
ilde

Baoquan Zuo

unread,
Jan 20, 2013, 1:50:01 AM1/20/13
to spri...@googlegroups.com
Hi, Welcome to Spring4D!

At the current stage we are focus on Common Types, Generic Collections, Dependency Injection Framework. Do you have any idea about these parts?


--
You received this message because you are subscribed to the Google Groups "Spring Framework for Delphi" group.
To post to this group, send email to spri...@googlegroups.com.
To unsubscribe from this group, send email to spring4d+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/spring4d/-/MoyzIZwN0hoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ildefonso Martínez Marchena

unread,
Jan 20, 2013, 5:16:02 AM1/20/13
to spri...@googlegroups.com
HI!!!

Thank you for your answer. Yes, I think I could learn about but first for me is to know what is made and what need to be done!

It could be fantastic you tell me where should I focus. Is there a lot of features I have been implemented in my own framework for build energy installations software but without using generics because I used delphi 2007 (generic commands, abstract selections to share between interfaces, etc...). 

Let me know where do you want I start and I would try to help you ;)

All the best
Ilde

Baoquan Zuo

unread,
Jan 20, 2013, 8:28:29 AM1/20/13
to spri...@googlegroups.com

Most common types are stable. The collections framework are still experimental. The DI framework is useful but still in review and we may introduce some more features in it. The Spring4D in action will be paused as this kind of articles are very time consume and maybe we will put it in a book some day. Instead, we are going to write some simple articles to illustrate how to use the framework.

On Sun, Jan 20, 2013 at 9:22 PM, Baoquan Zuo <baoqu...@devjetsoftware.com> wrote:

Most common types are stable. The collections framework are still experimental. The DI framework is useful but still in review and we may introduce some more features in it. The Spring4D in action will be paused as this kind of articles are very time consume and maybe we will put it in a book some day. Instead, we are going to write some simple articles to illustrate how to use the framework.

Best Regards,

Baoquan Zuo
DevJet Software

Ildefonso Martínez Marchena

unread,
Jan 20, 2013, 4:04:21 PM1/20/13
to spri...@googlegroups.com
Hi!!

I am try to make a test of concepts using your framework. If it is used in a project from scratch works really fine but I would like to test it integrating it on other third party components because reuse and use other source code is useful when one build a great system.

Look at this case: I am developing a clone of Skype client using only dspring. I found a situation that I don't know if framework can deal with.

ISkype ---> IUsersCollection ---> IUser

I can iterate over collection to get IUser and pass IUser to other functions, but If I want for example delete an user this way (in pseudo code): 

Procedure Delete(IUser)
Begin
  //I need ISkype instance to delete user
  ISkype.deleteuser(IUser)

End

From IUser I don't have way to get ISkype instance because programmer who made the library don't made a reference to the main instance from IUser to ISkype neither to IUsersCollection.

If I use a GlobalContainer to save ISkype it works fine:

GlobalContainer.Resolve<ISkype>.deleteuser(IUser) but what happend if I have two ISkype instances. I have no way to know what ISkype instance owns IUser I want to delete :(  (I could search for IUser in all instances and get the correct ISkype but is soo ugly...)

Is there a way to inject a reference of ISkype to IUser when I pass IUser to other modules? Is the framework think about that? (I am trying to build a procedure to add layers to an interface using a modified TAggregatedObject but  would like to know if this is possible in other ways with delphi spring)

All the best
Ilde

Baoquan Zuo

unread,
Jan 22, 2013, 3:16:40 AM1/22/13
to spri...@googlegroups.com
What would you do without a DI container?

Glienke, Stefan

unread,
Jan 22, 2013, 5:51:33 AM1/22/13
to spri...@googlegroups.com

As I mentioned in another thread try to develop your code without having the “magic” of a DI Container in your mind but stick to SOLID principles and use “manual” dependency injection.

 

Just a bit mind storming on how to solve that particular problem:

 

Situation: You have multiple instances of ISkype and a IUser instance. Now you want to pass that IUser to a method of the correct ISkype instance to remove it there.

 

Solution 1.: Keep the ISkype reference in your IUser so you can directly call to it.

Disadvantages:

- cross references of interfaces and the necessary handling of that

- if you cannot modify the classes/interfaces you have to keep that outside of them, so maybe you have to use a dictionary or some other kind of lookup

 

Solution 2.: Build a proxy for your ISkype instances and call on that.

Disadvantages:

- you have to find the correct ISkype instance inside the proxy to route the call to it

 

 

Please tell us how you are obtaining the IUser and ISkype instances (do you implement any of them?) so we know if there is a possibility to intercept the resolving at some point to keep the IUser/ISkype relation.

 

Stefan

Ildefonso Martínez Marchena

unread,
Jan 22, 2013, 11:34:17 AM1/22/13
to spri...@googlegroups.com
Hi

yes, i agree with you... i always code using manual dependency injection but i wanted to know if spring framework could help me in other ways ;-)

In my case...(coding a system to test framework concepts).. i am using a third party components (based in COM to comunicate with Skyple client provide by Skype company).

I would try to explain better... i tryed to use a clean an solid design trying not to violate Demeters law neither.

I have a ISkype instance (as interface) in a main project form
I inject the ISkype to a TVirtualTreeView to populate all user information
In each tree node I store only an interface (this way i have a  very light resources compsumption)
I have a commands framework that enable me to automatically assign registered commands to each interface. If a tree node has IUser then show a popupmenu with commands registered for IUsers.
In each command i receive an interface on which run the command (for example: deleteusercommand receive an interface of IUser)
In this case, delete command is applyed over ISkype instance but I dont have way to get ISkype from IUser. (original programmer dont create a reverse reference)

I could code some solutions but i would like to know if framework could bring it in elegant way. I have some options:

- Store in each tree node an ISkype reference and user information and when draw a node search for Node text from IUserCollection (then i should register delete command for ISkype interface instead IUser interface and command framework should pass IUser and ISkype to the delete command procedure
- When i populate tree nodes, store in a dictionary ISkpe and IUser references and in the delete command search ISkype instance who belong to that IUser received from the tree node
- Use a service locator to find all ISkype instances and search IUser in each ISkype instance to find correct ISkype (i should build an interface to bring that feature in a generic way)
- Create a layer over IUser with a reference to ISkype when populate tree nodes.

The lastest option is for me the most elegant trying to inject owner reference, for example:

instead:  Node := ISkype.users[node.index]
use something like: Node := TAggregatedSubject.create(ISkype.users[node.index], IMySkype);

where

TAggregatedSubject = class(TAggregatedObject, IInterface, IMySkype)
private
   fInterface : IMySkype;
protected
    function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall;
public
   constructor Create(controller,interface : iinterface);.
end

function TAggregatedSubject.QueryInterface(const IID: TGUID; out Obj): HResult;
begin
  if fInterface.QueryInterface(IID,obj)
    result := obj
  else
    result := Controller.QueryInterface(IID,obj);
end;

(Alert: code on the fly without compilation test ;-)

This way i could create a layer over IUser and recover IMySkype interface (with info that i want) or IUser interface from the same instance. And maybe i could create more than one layer level to an interface. If IUser is 0 reference i could destroy TAggregatedSubject controlling _Release from IInterface.

What do you think about that? Do you think it could be interesting to create a generic layer mechanism to enable this situations?

Sorry about the length of the mail and my bad English :-)

All the best
ilde




2013/1/22 Glienke, Stefan <SGli...@aagon.com>
Reply all
Reply to author
Forward
0 new messages