Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>"<em>I'm just not sure if there is a design pattern which sutiable to this idea and I can use it. It is always better than inventing the wheel again</em>?</p> <p>A very agreeable approach. But to answer your question properly, you should ask yourself <strong>"what idea?"</strong>. Patterns exist to solve <strong>general</strong> problems. Your problem deals with restaurants and workers, so as such, you might find it troublesome to choose a specific pattern.</p> <p>Also, there is no such a thing as a "holy" design pattern to adopt in all situations. There isn't a design pattern which is suited for modeling restaurants, cars, or whatever. You have to <em>abstract</em> those details out of your model and figure out what is the essence of the problem you're solving.</p> <p>What kind of relationship are you trying to establish between your classes? How shall these associations be navigated?</p> <p>Programs are not static databases: they <em>do</em> something with your data, and your data structures should be designed in a way that best suits them for the kind of processing your <strong>algorithms</strong> are supposed to do. There is rarely such a thing as a "universally good" design. If someone tells you there his, listen to him with suspicion. </p> <p>Is your program supposed to find out what table a certain customer is sitting at? Is it supposed to find out which customers are sitting at which table? Is it supposed to find out which waiters are serving which customer, or which table, or how many times each waiter has served the same table throughout the day?</p> <p>In other words, what are the <strong>operational requirements</strong> of your program? How frequently is it likely to perform the above lookups? Are insertions expected to be more frequent than lookups? And lookups by name of a customer, or ID of a table, more frequent than just plain iterations over the whole set of tables/waiters/customers to print out a report?</p> <p>You can't find the <em>right</em> design if you don't make it clear <em>what should it be right for</em>. So to sum up, there's two things you should do:</p> <ol> <li><em>Identify (or at least try to make reasonable assumptions on) the operational requirements of your program;</em></li> <li><em>Selecting the appropriate design pattern by reasoning in abstract terms, i.e. removing the details which are specific to your application domain.</em></li> </ol>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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