Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>I am pretty unsure if my explanation and example really cover the most important principles</h2> <p>Think of behavior as scenarios external to the structures. A certain data structure can "be used" in multiple behaviors/scenarios.</p> <p>On the other hand think of structure related logic as being internal to the structure. The structure gets affected by various changes and executes some actions as a consequence.</p> <p>That being said we can exemplify with the following:</p> <p>Structure design patterns will define a weblog by defining its constituents as higher level business objects such as Article/Image/Comment. The constituents are aware of one another and how to connect to each other.</p> <pre><code>$image = new Image; $image-&gt;title = 'Image title'; $image-&gt;url = 'http://example.com/file.ext'; $image-&gt;save(); // will save the image to a DB $article-&gt;title = 'The title i have set'; /* $article-&gt;url_key = 'the_title_i_have_set'; */ // this ^^ element of logic will be done automatically by the article $article-&gt;addImage($image); // will save the connection between the // article and the image to DB </code></pre> <p>Behavior design patterns will define a weblog by its use cases (scenarios) using lower level business objects such as Article/ArticleToImage/Image/ArticleToComment. The business objects are not aware of each other and are "maneuvered" into place by the scenario logic.</p> <pre><code>$image = new Image; $image-&gt;title = 'Image title'; $image-&gt;url = 'http://example.com/file.ext'; $image-&gt;save(); // will save the image to a DB $article-&gt;title = 'The title i have set'; $article-&gt;url_key = $controller-&gt;getURlKey($article-&gt;title); $article-&gt;save(); // saves article to DB $article_to_image = new ArticleToImage; $article_to_image-&gt;article = $article; $article_to_image-&gt;image = $image; $article_to_image-&gt;save(); </code></pre> <hr> <h2>TL;DR</h2> <p>If the storage objects are smart (contain logic) that's structural design. If the storage objects are dumb (they can only store data and transfer it to the DB) you then need a behavioral design to manage them.</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. 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