{"id":6081,"date":"2022-05-26T01:57:15","date_gmt":"2022-05-26T01:57:15","guid":{"rendered":"https:\/\/www.booksofall.com\/cn\/?post_type=product&#038;p=6081"},"modified":"2022-06-15T05:13:24","modified_gmt":"2022-06-15T05:13:24","slug":"uml-class-diagrams-by-example","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/","title":{"rendered":"UML Class Diagrams by Example"},"content":{"rendered":"<p>In\u00a0<a title=\"Software engineering\" href=\"https:\/\/en.wikipedia.org\/wiki\/Software_engineering\">software engineering<\/a>, a\u00a0<b>class diagram<\/b>\u00a0in the\u00a0<a title=\"Unified Modeling Language\" href=\"https:\/\/en.wikipedia.org\/wiki\/Unified_Modeling_Language\">Unified Modeling Language<\/a>\u00a0(UML) is a type of static structure diagram that describes the structure of a system by showing the system\u2019s\u00a0<a class=\"mw-redirect\" title=\"Class (computer science)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Class_(computer_science)\">classes<\/a>, their attributes, operations (or methods), and the relationships among objects.<\/p>\n<p>The class diagram is the main building block of\u00a0<a title=\"Object-oriented programming\" href=\"https:\/\/en.wikipedia.org\/wiki\/Object-oriented_programming\">object-oriented<\/a>\u00a0modeling. It is used for general\u00a0<a title=\"Conceptual model\" href=\"https:\/\/en.wikipedia.org\/wiki\/Conceptual_model\">conceptual modeling<\/a>\u00a0of the structure of the application, and for detailed modeling, translating the models into\u00a0<a class=\"mw-redirect\" title=\"Programming code\" href=\"https:\/\/en.wikipedia.org\/wiki\/Programming_code\">programming code<\/a>. Class diagrams can also be used for\u00a0<a title=\"Data modeling\" href=\"https:\/\/en.wikipedia.org\/wiki\/Data_modeling\">data modeling<\/a>. The classes in a class diagram represent both the main elements, interactions in the application, and the classes to be programmed.<\/p>\n<p>In the diagram, classes are represented with boxes that contain three compartments:<\/p>\n<ul>\n<li>The top compartment contains the name of the class. It is printed in bold and centered, and the first letter is capitalized.<\/li>\n<li>The middle compartment contains the attributes of the class. They are left-aligned and the first letter is lowercase.<\/li>\n<li>The bottom compartment contains the operations the class can execute. They are also left-aligned and the first letter is lowercase.<\/li>\n<\/ul>\n<div class=\"thumb tright\">\n<div class=\"thumbinner\">\n<div class=\"thumbcaption\">A class with three compartments.<\/div>\n<\/div>\n<\/div>\n<p>In the design of a system, a number of classes are identified and grouped together in a class diagram that helps to determine the static relations between them. In detailed modeling, the classes of the conceptual design are often split into subclasses.<\/p>\n<p>In order to further describe the behavior of systems, these class diagrams can be complemented by a\u00a0<a title=\"State diagram\" href=\"https:\/\/en.wikipedia.org\/wiki\/State_diagram\">state diagram<\/a>\u00a0or\u00a0<a title=\"UML state machine\" href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine\">UML state machine<\/a>.<\/p>\n<h2><span id=\"Members\" class=\"mw-headline\">Members<\/span><\/h2>\n<p>UML provides mechanisms to represent class members, such as attributes and methods, and additional information about them like constructors.<\/p>\n<h3><span id=\"Scope\" class=\"mw-headline\">Scope<\/span><\/h3>\n<p>The UML specifies two types of\u00a0<a title=\"Scope (computer science)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Scope_(computer_science)\">scope<\/a>\u00a0for members:\u00a0<i>instance<\/i>\u00a0and\u00a0<i>class<\/i>, and the latter is represented by\u00a0<u>underlined names<\/u>.<\/p>\n<ul>\n<li><b>Instance members<\/b>\u00a0are scoped to a specific instance.\n<ul>\n<li>Attribute values may vary between instances<\/li>\n<li>Method invocation may affect the instance\u2019s state (i.e. change the instance\u2019s attributes)<\/li>\n<\/ul>\n<\/li>\n<li><b>Class members<\/b>\u00a0are commonly recognized as \u201cstatic\u201d in many programming languages. The scope is the class itself.\n<ul>\n<li>Attribute values are equal for all instances<\/li>\n<li>Method invocation does not affect the classifier\u2019s state<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>To indicate a classifier scope for a member, its name must be underlined. Otherwise, instance scope is assumed by default.<\/p>\n<h2><span id=\"Relationships\" class=\"mw-headline\">Relationships<\/span><\/h2>\n<p>A relationship is a general term covering the specific types of logical connections found on class and object diagrams. UML defines the following relationships:<\/p>\n<h3><span id=\"Instance-level_relationships\" class=\"mw-headline\">Instance-level relationships<\/span><\/h3>\n<h4><span id=\"Dependency\" class=\"mw-headline\">Dependency<\/span><\/h4>\n<p>A\u00a0<i><a title=\"Dependency (UML)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Dependency_(UML)\">dependency<\/a><\/i>\u00a0is a type of association where there is a semantic connection between dependent and independent model elements.\u00a0<sup id=\"cite_ref-6\" class=\"reference\"><\/sup>It exists between two elements if changes to the definition of one element (the server or target) may cause changes to the other (the client or source). This association is uni-directional. A dependency is displayed as a dashed line with an open arrow that points from the client to the supplier.<\/p>\n<h4><span id=\"Association\" class=\"mw-headline\">Association<\/span><\/h4>\n<p>An\u00a0<i><a title=\"Association (object-oriented programming)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Association_(object-oriented_programming)\">association<\/a><\/i>\u00a0represents a family of links. A binary association (with two ends) is normally represented as a line. An association can link any number of classes. An association with three links is called a ternary association. An association can be named, and the ends of an association can be adorned with role names, ownership indicators, multiplicity, visibility, and other properties.<br \/>\nThere are four different types of association: bi-directional, uni-directional, aggregation (includes composition aggregation) and reflexive. Bi-directional and uni-directional associations are the most common ones.<br \/>\nFor instance, a flight class is associated with a plane class bi-directionally. Association represents the static relationship shared among the objects of two classes.<\/p>\n<h4><span id=\"Aggregation\" class=\"mw-headline\">Aggregation<\/span><\/h4>\n<p><i><a class=\"mw-redirect\" title=\"Aggregation (object-oriented programming)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Aggregation_(object-oriented_programming)\">Aggregation<\/a><\/i>\u00a0is a variant of the \u201chas a\u201d association relationship; aggregation is more specific than association. It is an association that represents a part-whole or part-of relationship. As shown in the image, a Professor \u2018has a\u2019 class to teach. As a type of association, an aggregation can be named and have the same adornments that an association can. However, an aggregation may not involve more than two classes; it must be a binary association. Furthermore, there is hardly a difference between aggregations and associations during implementation, and the diagram may skip aggregation relations altogether.<sup id=\"cite_ref-7\" class=\"reference\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Class_diagram#cite_note-7\">[7]<\/a><\/sup><\/p>\n<p><i>Aggregation<\/i>\u00a0can occur when a class is a collection or container of other classes, but the contained classes do not have a strong\u00a0<i>lifecycle dependency<\/i>\u00a0on the container. The contents of the container still exist when the container is destroyed.<\/p>\n<p>In\u00a0<a title=\"Unified Modeling Language\" href=\"https:\/\/en.wikipedia.org\/wiki\/Unified_Modeling_Language\">UML<\/a>, it is graphically represented as a\u00a0<i>hollow<\/i>\u00a0<a title=\"Rhombus\" href=\"https:\/\/en.wikipedia.org\/wiki\/Rhombus\">diamond shape<\/a>\u00a0on the containing class with a single line that connects it to the contained class. The aggregate is semantically an extended object that is treated as a unit in many operations, although physically it is made of several lesser objects.<\/p>\n<p>Example: Library and Students. Here the student can exist without library, the relation between student and library is aggregation.<\/p>\n<h4><span id=\"Composition\" class=\"mw-headline\">Composition<\/span><\/h4>\n<p>The UML representation of a composition relationship shows composition as a\u00a0<i>filled<\/i>\u00a0diamond shape on the containing class end of the lines that connect contained class(es) to the containing class.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 480px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/uml-class-diagrams-by-example-ysawltp9e?enforceShowPromotionBar=true\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":6086,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram."},"product_brand":[],"product_cat":[213],"product_tag":[201],"class_list":{"0":"post-6081","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-computer-uml","7":"product_tag-lecture-notes","9":"first","10":"instock","11":"shipping-taxable","12":"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 Class Diagrams by Example - BooksOfAll Simplified Chinese<\/title>\n<meta name=\"description\" content=\"In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram.\" \/>\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\/cn\/uml-class-diagrams-by-example\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UML Class Diagrams by Example - BooksOfAll Simplified Chinese\" \/>\n<meta property=\"og:description\" content=\"In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Simplified Chinese\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-15T05:13:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg\" \/>\n<meta name=\"twitter:label1\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/\",\"name\":\"UML Class Diagrams by Example - BooksOfAll Simplified Chinese\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg\",\"datePublished\":\"2022-05-26T01:57:15+00:00\",\"dateModified\":\"2022-06-15T05:13:24+00:00\",\"description\":\"In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg\",\"width\":\"596\",\"height\":\"842\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/cn\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"UML Class Diagrams by Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"name\":\"BooksOfAll Simplified Chinese\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\",\"name\":\"BooksOfAll Simplified Chinese\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Simplified Chinese\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"UML Class Diagrams by Example - BooksOfAll Simplified Chinese","description":"In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram.","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\/cn\/uml-class-diagrams-by-example\/","og_locale":"zh_CN","og_type":"article","og_title":"UML Class Diagrams by Example - BooksOfAll Simplified Chinese","og_description":"In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram.","og_url":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/","og_site_name":"BooksOfAll Simplified Chinese","article_modified_time":"2022-06-15T05:13:24+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg","twitter_misc":{"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/","url":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/","name":"UML Class Diagrams by Example - BooksOfAll Simplified Chinese","isPartOf":{"@id":"https:\/\/www.booksofall.com\/cn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg","datePublished":"2022-05-26T01:57:15+00:00","dateModified":"2022-06-15T05:13:24+00:00","description":"In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram.","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#primaryimage","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a1821de6a44.jpeg","width":"596","height":"842"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/cn\/uml-class-diagrams-by-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/cn\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/cn\/categories\/"},{"@type":"ListItem","position":3,"name":"UML Class Diagrams by Example"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/cn\/#website","url":"https:\/\/www.booksofall.com\/cn\/","name":"BooksOfAll Simplified Chinese","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/cn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/cn\/#organization","name":"BooksOfAll Simplified Chinese","url":"https:\/\/www.booksofall.com\/cn\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Simplified Chinese"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product\/6081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media\/6086"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media?parent=6081"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_brand?post=6081"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_cat?post=6081"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_tag?post=6081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}