Re: more dimensional method like a query...



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
                             + attrD

where 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



.



Relevant Pages

  • Re: create a small stock control and sales database
    ... "Inventory control" sample database doesn't really "fit the bill". ... My comments also apply to the Northwind Traders database. ... Description, type of container, weight, Price, and Purchase price.This table will rarely be changed, the "changing tables" are stock in and stock out. ... But you might also want to copy it to a new field in [Product sold] to reflect what the unit price was at the time of a specific sale. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: thoughts on how difficult this database would be to make?
    ... If you need to build the database some time soon, ... how (we'll use stock for this purpose) behaved each day at the open. ... Often that gap will be filled, meaning the price will go back ... You might like to watch a brief video I suggested here earlier (and ...
    (microsoft.public.access.gettingstarted)
  • Re: thoughts on how difficult this database would be to make?
    ... If you need to build the database some time soon, ... Excel and Word applications for a reasonable fee. ... I'm sure your gains from the stock would easily cover my fees. ... Often that gap will be filled, meaning the price will go back ...
    (microsoft.public.access.gettingstarted)
  • Re: How do i set up an access program to help with stock control
    ... monitor stock ... Like all database design projects, you will sit down and work out what ... you can link them all together in *data modeling* relationships. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: create a small stock control and sales database
    ... keeping a running total of stock, both in and out, So... ... > Northwind Traders database. ... > You might want to also include a primary key in [Product sold], ...
    (microsoft.public.access.tablesdbdesign)