.Open CS320/07 Data Types and Data Structures .Table .Row Prev 06 Names Chapter 5 sections 1 to10 lab06 C/C++ Scoping .Row Today ** Project Phase 1 UML of old+Proposed changes(10 pts) .Row Today 07 Data Types Chapter 6 not section 8(unions) lab07 C/C++ Data .Row Next 08 Expressions etc Chapter 7 not section 8 lab08 C/C++ Expressions .Close.Table . Project Phase 1 Due in at start of class .See ./projects.html#Project Phase 1 due class 07 . Preparation 1. Study chapter 6 together with the notes on UML below. 2. Answer review questions at end of chapter 6 . 3. Hand in 3 or more answers to review questions. . Notes Standard C++ comes with a large library (the STL) of powerful data types. CSCI 330 (Data Structures) is an in depth study of this material. . Decimal Data Types Decimal data is a very important data type becuase it is used to represent .Key money. Accountants require precise decimal arithmetic -- to avoid fraud. . UML and Data Types The UML has four primitive data types: Real, Integer, Boolean, String. .Key Enumerations in the UML (6.4.1) are written: .As_is enum{ value1, value2, ...} in the OCL and `stereotyped` as .As_is <> in UML2.0. Their values are written .As_is #Value1, #Value2, ... In place of array(6.5) we have multiplicities(0..*, 4..5, ...) Put them on attributes in square brackets and links. There are also special Object Constraint Language types: Collection, Set, Bag, and Sequence. Record types(6.7) are UML classes with no operations and all attributes public. Composition is a good way to show fields in a record. .Image 07uml3.gif Fields in a Record Unions(6.8) are best treated by generalizations (multiple inheritance). Pointers(6.9) have no special UML type. Do not use "*" to indicate pointers in the UML! The aggregation link is the old way (shown below) for saying that one type of data has a pointer that refers to an object of another type. Make sure that (1) the name of the pointer is the role, (2) there is an arrow head, and (3) the multiplicity is 0..1. However, aggregation is not really intended to model pointers. Modern UML users just use an association with an arrow to show a pointer. .Image 07uml2.gif Using Aggregation to model pointers . Chapter 6 in the UML .Image 07uml1.gif Concepts in Chapter 6 . Class Work .See http://www/dick/cs320/07q.html .Close . Lab Work .See ./lab/07.html . Next: Expressions .See ./08.html