UML Basic Architecture Modeling-general class modeling technology (4)

Source: Internet
Author: User
Zookeeper

Modeling primitive types

Build the original type model

 

At the other extreme, the things you model may be drawn directly from the programming language you are using to implement a solution. typically, these extends actions involve primitive types, such as integers, characters, strings, and even enumeration types, that you might create yourself.

On the other hand, what you model may come directly from the programming language used to implement the solution. the most typical type is the primitive types contained in abstract objects, such as integers, characters, strings, and even enumeration types. You can also create your own primitive types.

 

To model primitive types,

Modeling for the original type,

 

1. model the thing you are using acting as a class or an enumeration, which is rendered using class notation with the appropriate stereotype.

Abstract things are modeled by a certain type or enumeration type. This model is expressed by a class with an appropriate template identifier.

2. If you need to specify the range of values associated with this type, use constraints.

If you need to specify the range of values associated with this type, use constraints.

 

As figure 4-12 shows, these things can be modeled in the UML as types or enumerations, which are rendered just like classes but are explicitly marked via stereotypes. primitive types such as integers (represented by the class INT) are modeled as types, and you can explicitly indicate the range of values these things can take on by using a constraint; the semantics of primitive types must be defined externally to UML. enumeration types, such as Boolean and status, can be modeled as enumerations, with their individual literals listed within the attribute compartment (note that they are not attributes ). enumeration types may also define operations.

As shown in 4-12, these things can be modeled as type or enumeration type in UML, and they are clearly identified like classes but through patterns. primitive types such as integers are modeled as types, and you can use constraints on these things to explicitly indicate the range of values; the semantics of the original type must be defined from external to UML. enumeration type, such as Boolean and status, can be used as enumeration modeling. In the attribute column, use specific text to list (remarks are not attributes ). the enumerated type can also define operations.

 

 

Note: Some languages, such as C and C ++, let you set an integer value for an enumeration literal. you can model this in the UML by attaching a note to an enumeration literal as implementation guidance. integer values are not needed for logical modeling.

Note: in some languages, such as C and C ++, you can set an integer for the enumerated content. in UML, you can attach remarks to the enumeration content as an implementation guide. the integer is not a must for logical modeling.

 

UML Basic Architecture Modeling-general class modeling technology (4)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.