{"id":8954,"date":"2022-06-14T02:28:45","date_gmt":"2022-06-14T02:28:45","guid":{"rendered":"https:\/\/www.booksofall.com\/vi\/?post_type=product&#038;p=8954"},"modified":"2022-06-15T05:26:40","modified_gmt":"2022-06-15T05:26:40","slug":"uml-association-vs-aggregation-vs-composition","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/","title":{"rendered":"UML Association vs Aggregation vs Composition"},"content":{"rendered":"<h3>UML Association vs Aggregation vs Composition<\/h3>\n<p>5-6 minutes<\/p>\n<p>Consider the differences and similarities between the classes of the following objects: pets , dogs , tails , owners .<\/p>\n<p>The figure below shows the three types of association connectors: association, aggregation, and composition. We will go over them in this UML guide.<\/p>\n<p>The figure below shows a generalization. We will talk about it later on in this UML guide.<\/p>\n<h3>Association<\/h3>\n<p>If two classes in a model need to communicate with each other, there must be a link between them, and that can be represented by an association (connector).<\/p>\n<p>Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association.<\/p>\n<p>We can indicate the multiplicity of an association by adding multiplicity adornments to the line denoting the association. The example indicates that a Student has one or more Instructors:<\/p>\n<ul>\n<li>A single student can associate with multiple teachers:<\/li>\n<li>The example indicates that every Instructor has one or more Students:<\/li>\n<li>We can also indicate the behavior of an object in an association (i.e., the role of an object)using role names.<\/li>\n<\/ul>\n<h3>Association vs Aggregation vs Composition<\/h3>\n<p>The question &#8220;What is the difference between association, aggregation, and composition &#8220;has been frequently asked lately.<\/p>\n<p>Aggregation and Composition are subsets of association meaning they are specific cases of association . In both aggregation and composition object of one class &#8220;owns&#8221; object of another class. But there is a subtle difference:<\/p>\n<p>Aggregation implies a relationship where the child can exist independently of the parent. Example: Class (parent) and Student (child). Delete the Class and the Students still exist.<\/p>\n<p>Composition implies a relationship where the child cannot exist independent of the parent. Example: House (parent) and Room (child). Rooms don&#8217;t exist separate to a House.<\/p>\n<h3>Composition Example:<\/h3>\n<p>We should be more specific and use the composition link in cases where in addition to the part-of relationship between Class A and Class B &#8211; there&#8217;s a strong lifecycle dependency between the two, meaning that when Class A is deleted then Class B is also deleted as a result<\/p>\n<h3>Aggregation Example:<\/h3>\n<p>It&#8217;s important to note that the aggregation link doesn&#8217;t state in any way that Class A owns Class B nor that there&#8217;s a parent-child relationship (when parent deleted all its child&#8217;s are being deleted as a result) between the two. Actually, quite the opposite! The aggregation link is usually used to stress the point that Class A instance is not the exclusive container of Class B instance, as in fact the same Class B instance has another container\/s.<\/p>\n<p>Summing it up &#8211;<\/p>\n<p>To sum it up association is a very generic term used to represent when one class used the functionalities provided by another class. We say it&#8217;s a composition if one parent class object owns another child class object and that child class object cannot meaning fully exist without the parent class object. If it can then it is called Aggregation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe frameborder=\"0\" allowtransparency=\"true\" allowFullscreen=\"true\" style=\"width: 100%; height: 700px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/uml-association-vs-aggregation-vs-composition-zjg6x41q5?enforceShowPromotionBar=true\"><\/iframe><\/p>\n","protected":false},"featured_media":8959,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association."},"product_brand":[],"product_cat":[213],"product_tag":[],"class_list":{"0":"post-8954","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-computer-uml","8":"first","9":"instock","10":"shipping-taxable","11":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>UML Association vs Aggregation vs Composition - BooksOfAll Vietnamese<\/title>\n<meta name=\"description\" content=\"Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UML Association vs Aggregation vs Composition - BooksOfAll Vietnamese\" \/>\n<meta property=\"og:description\" content=\"Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Vietnamese\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-15T05:26:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png\" \/>\n<meta name=\"twitter:label1\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/\",\"url\":\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/\",\"name\":\"UML Association vs Aggregation vs Composition - BooksOfAll Vietnamese\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png\",\"datePublished\":\"2022-06-14T02:28:45+00:00\",\"dateModified\":\"2022-06-15T05:26:40+00:00\",\"description\":\"Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png\",\"width\":\"596\",\"height\":\"842\",\"caption\":\"UML Association vs Aggregation vs Composition\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/vi\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/vi\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"UML Association vs Aggregation vs Composition\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/#website\",\"url\":\"https:\/\/www.booksofall.com\/vi\/\",\"name\":\"BooksOfAll Vietnamese\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/vi\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/#organization\",\"name\":\"BooksOfAll Vietnamese\",\"url\":\"https:\/\/www.booksofall.com\/vi\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Vietnamese\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"UML Association vs Aggregation vs Composition - BooksOfAll Vietnamese","description":"Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/","og_locale":"vi_VN","og_type":"article","og_title":"UML Association vs Aggregation vs Composition - BooksOfAll Vietnamese","og_description":"Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association.","og_url":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/","og_site_name":"BooksOfAll Vietnamese","article_modified_time":"2022-06-15T05:26:40+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png","twitter_misc":{"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"3 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/","url":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/","name":"UML Association vs Aggregation vs Composition - BooksOfAll Vietnamese","isPartOf":{"@id":"https:\/\/www.booksofall.com\/vi\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png","datePublished":"2022-06-14T02:28:45+00:00","dateModified":"2022-06-15T05:26:40+00:00","description":"Association can be represented by a line between these classes with an arrow indicating the navigation direction . In case an arrow is on both sides, the association is known as a bidirectional association.","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#primaryimage","url":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png","contentUrl":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/UML-Association-vs-Aggregation-vs-Composition-06.png","width":"596","height":"842","caption":"UML Association vs Aggregation vs Composition"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/vi\/uml-association-vs-aggregation-vs-composition\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/vi\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/vi\/categories\/"},{"@type":"ListItem","position":3,"name":"UML Association vs Aggregation vs Composition"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/vi\/#website","url":"https:\/\/www.booksofall.com\/vi\/","name":"BooksOfAll Vietnamese","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/vi\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/vi\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/vi\/#organization","name":"BooksOfAll Vietnamese","url":"https:\/\/www.booksofall.com\/vi\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Vietnamese"},"image":{"@id":"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product\/8954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/media\/8959"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/media?parent=8954"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product_brand?post=8954"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product_cat?post=8954"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product_tag?post=8954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}