Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,465 of 10,840    |
|    Steve Gerrard to Iain Bishop    |
|    Re: Object Model Problem    |
|    03 May 05 07:18:33    |
      From: mynamehere@comcast.net              Some general comments and ideas to consider:       ---       Something like TotalPriceOfAllMaterials should probably be a method, not a       variable. Unless you have a serious performance problem, it will be cleaner to       actually add up all the material costs each time, rather than storing it and       trying to make sure it stays updated.       ---       If you are familiar with Interfaces, or willing to become so, they could make       your model easier. If you had an interface called IMaterial, for instance, then       the Assembly class and Material class could both implement it. This would allow       you to have a single collection that was a mixture of Assembly and Material       objects. I can explain more about it if you are interested - it is not       difficult       to do.       ---       Your Site class does not need to repeat the structure of an Asssembly - it can       simply contain one. So you could have               'Contents of Site       Public SiteAsm As clsAssembly              which would give you        SiteAsm.AssemblyAssemblies       and        SiteAsm.AssemblyMaterials              and avoid duplication of code.              Remember that your user does not have to know that the entire material       structure       of a site is being treated as a single assembly; it is just a programming       convenience. Object design should serve the programmer's purposes, not the end       user's. You could then put TotalPriceOfAllMaterials in the Assembly class, as       described in the post from Dikkie Dik.       ---       There is nothing wrong with adding an object reference to two collections (you       only need to make sure that you don't create a cross reference, where two       objects have references to each other).              So, if you are adding a clsMaterial object to some assembly, you can also add       it       to a separate MasterList:        Dim MasterList As clsMaterials        Dim Site As clsSite        Dim Mat As clsMaterial               Set Mat = New clsMaterial        Site.SiteAssemblies(2).AssemblyAssemblies(4).AssemblyMaterials.Add Mat        MasterList.Add Mat              This means you can find a material by drilling down through the Site structure,       or by looking in the MasterList. Both collections contain a reference to the       same object, so any changes to it would be seen from either vantage point. You       could even make MasterList a property of the Site class.       ---              "Iain Bishop" |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca