Rakesh's Blog

Bind Dependency

 

Last week we had an intra team challenge. Our manager offered to put on the apron and grill some bbq if we hit some phenomenal bug fixing goal he set. We strapped ourselves to the seats in our offices and took up the gauntlet. Glad to inform you that we succeeded and I hope he makes something good and make us feel that it was worth the sleepless ride last week.

 

Here is a question I received from Bryan Rieger… click here

 

Bind Dependency?

 

            Click here and this page gives a good explanation of bind dependency.

 

Here is an example we will use…

 

            generic<typename T>

            public ref class Collection{};

           

            public ref class Class1

            {

                        Collection<float> myFloatCollection;   

            };

 

Answering Bryan’s questions…

 

Would the Collection<T> be modeled as a parameterized class?

            Yes. To view the parameterized class... click here

 

If it is modeled as a parameterized class, will you be supporting bind dependency?

            Yes. In the Class Designer shown in the link, you right click on field FloatCollection and select “Show as Association”. To view the UML equivalent bind dependency created… click here

 

Here is my own follow up question…

 

If we model templates and generics as parameterized classes how do we differentiate them in the model?

            I created a template class called Container. I have juxtaposed the Collection generic class and the template Container class on the designer. They both show as parameterized classes but check out the title right after the class name… click here

 

Published Thursday, October 28, 2004 10:54 PM by rakeshna

Comments

 

Jack Millgard said:

Did you guys have any time to go to the bathroom ? :-)
October 29, 2004 1:30 PM
 

Bryan Rieger said:

I hope that your BBQ was as good as the effort that you put in for your bug fixing.

Thank you for taking the time to go over my questions. I like the fact that you are using the title to note if it is a Generic or a Template.

I noticed that when the diagram is created by using "Show as Association" that the name is that of the bound class, but the parameters do not show up on the association. I would think that for forward engineering from the model that it would be difficult to create the code with out the parameters. Unless there are defaulted parameters and those are used.

Are there plans to allow for forward engineering from a model, and how would the diagram look?

If you look at how some companies implement it they have the <<bind>> keyword followed by the parameters and their representations. In this example: <<bind>> <T->float> (I believe that XDE implemented it as <<bind>> <T=float>). When there are multiple parameters to bind it can become more important on how they are displayed to the user.

I believe this to be one of the most challenging dependencies to implement as far as the model goes, but one of the most powerful for the patterns developer.

Thanks again.
November 5, 2004 8:48 AM
 

Rakesh Namineni said:

Check the previous default template argument post. Based on the feedback that was given in that post we decided to use the name of the parameter as the default while fwd engineering.

Yes the template/generic arguments are not shown on the association line. We do have a label on the association line which you can edit, but that changes only the name of field/property of the association and not the type or template/generic argument.

But we do display the arguments in the properties page. If you select the association line and check the properties of the association line, there will be a property for template arguments.

And yes the arguments can be changed there and the changes will be forward engineered.
November 13, 2004 3:56 PM
 

Rakesh s Blog Bind Dependency | adirondack chairs said:

June 19, 2009 5:02 AM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker