Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ find the most suitable design pattern for a general design issue
    primarykey
    data
    text
    <p>I'm pretty exhausted trying to connect/link between practical issue to a theoretical equivalent .</p> <p>I will choose a very very simple example trying to illusrate my problem.</p> <p>Suppose I have a Worker class:</p> <pre><code>class Worker { private : // default access modifier int workerId; }; </code></pre> <p>Suppose I have a Table class:</p> <pre><code>class Table { private : // default access modifier int tableId; }; </code></pre> <p>Suppose I have a ResturantManager class:</p> <pre><code>class ResturantMangager private: // default access modifier list&lt;Table*&gt; allTables; list&lt;Worker*&gt; allWorkers; public: // the function should tell the worker that he should call one of its function, // its decision to what table to put the client returned by its function // must be somehow updated in the allTables (mark the table he chose to put the client // as unavailable). void putClientInTable(const Worker&amp; worker, const Client&amp; client); }; </code></pre> <p>Now I want to allow the worker to put a client in one of the available tables and after that I want the Resturant's class data member allTables to mark this table (by ID lookup) as unavailable. That means that the Worker should be able to decide what table to choose (or the ResturantManager tells him - I can't see how It can be achieved differently) and then the ResturantManager's allTables must be updated either.</p> <p>I'm looking a design pattern (<a href="http://sourcemaking.com/design_patterns" rel="nofollow">http://sourcemaking.com/design_patterns</a>) which most suitable to this idea.</p> <p>Is there any design pattern approriate to this issue?</p> <p>Thank you all.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload