Re: more dimensional method like a query...
- From: "H. S. Lahman" <h.lahman@xxxxxxxxxxx>
- Date: Mon, 28 Nov 2005 18:44:18 GMT
Responding to Pi421...
i want the stock to be saved in an objekt (runtime). Depending on what combination the 4 attributes have, diffrent objects are generated out of a database, holding the values for the stock. The attributes do not depend on each other. So there are 64 Combinations of Stocks.
What do you mean by 'different objects'? Do you mean different instances of the same class (i.e., just having different values of the same four attributes) or do you mean instances of different classes (i.e., each class has some unique combination of 1 to 4 attributes)?
[One thing that is bothering me is the 64 combinations. Assuming the second situation I see only:
ways to select 1 of 4 attributes => 4! / 1! * 3! = 4 combinations ways to select 2 of 4 attributes => 4! / 2! * 2! = 6 combinations ways to select 3 of 4 attributes => 4! / 3! * 1! = 4 combinations ways to select 4 of 4 attributes => 4! / 4! * 0! = 1 combinations
for a total of 15 unique combinations of four attributes.]
The second question ist, that i mean the in memory solution...
I habe a database, where i can get the Stock information. This is done
at the beginning of the programm. But in runtime there are several
points where i want the stock information depending on those 4
attributes.
This sounds like a much simpler problem:
1 accesses *
[Client] ------------------- [Stock]
R1 + attrA
+ attrB
+ attrC
+ attrDwhere your method is a behavior of the collection class that instantiates the R1 relationship. Then the client provides the specific four attribute values as arguments as you described and the collection class method does a search for the [Stock] object whose attribute values match the provided values. (It would be up to the collection class to provide an efficient implementation of the search.)
So i need to hold the stock information at runtime. Because its to bad performance, to generate the stock every time again out of
the database... Hope your questions are answered?
This is an issue that is only relevant to persistence access; it shouldn't affect the way the [Stock] data is used in the application's solution. If you know you need to cache the [Stock] values (e.g., because the Client will access the same stocks many times during the execution AND performance is critical), then one wants to isolate that optimization from the problem solution -- which doesn't care whether the data is persisted in an RDB or on clay tablets.
In that case, I would encapsulate the [Stock] objects in a persistence access subsystems so that they can be read once at startup and are kept in memory. Then method that Client accesses would be an subsystem interface method and that method would dispatch to the appropriate collection class within the persistence access subsystem that corresponds to the R1 collection above. The decouples the persistence access optimization from the problem solution because Client invokes the same interface whether the Stocks are cached or not.
************* There is nothing wrong with me that could not be cured by a capful of Drano.
H. S. Lahman hsl@xxxxxxxxxxxxxxxxx Pathfinder Solutions -- Put MDA to Work http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman (888)OOA-PATH
.
- Follow-Ups:
- Re: more dimensional method like a query...
- From: Pi421
- Re: more dimensional method like a query...
- References:
- more dimensional method like a query...
- From: Pi421
- Re: more dimensional method like a query...
- From: H. S. Lahman
- Re: more dimensional method like a query...
- From: Pi421
- more dimensional method like a query...
- Prev by Date: Re: OOAD Study Guide
- Next by Date: Re: OOAD Study Guide
- Previous by thread: Re: more dimensional method like a query...
- Next by thread: Re: more dimensional method like a query...
- Index(es):
Relevant Pages
|