Attributes without type in Class Diagram

AI Thread Summary
The discussion revolves around understanding UML class diagrams, specifically regarding the attributes "dataReceived" and "isPrepaid," which lack specified data types and visibility. Participants emphasize that UML typically includes visibility indicators (public, private, protected) and data types for attributes. Common visibility symbols are discussed, with public (+) and private (-) being fundamental. There is a consensus that the absence of data types may indicate incomplete or lazy diagramming. It is suggested that "dataReceived" and "isPrepaid" should have primitive data types, with "isPrepaid" likely being a boolean. The importance of clarity in UML diagrams for effective communication among developers is highlighted.
zak100
Messages
462
Reaction score
11
Hi,
I am using a book for studying UML. It shows attributes without any data types:
dataReceived
isPrepaid
number: String
price: Money

What is the data type associated with above two i.e dataReceived & isPrepaid & what is their visibility (i.e publc /private). Some body please guide me.

Zulfi.
 
Technology news on Phys.org
Can you provide a screenshot of what you see? My guess is that there are other symbols there that you don't realize represent something. Are there what look like bullet points?

When designing classes for C++, I use these symbols:
Code:
+ dataReceived - public
- dataReceived - private
# dataReceived - protected
/ dataReceived - derived
~ dataReceived - "C" function
+^ dataReceived - public overridden
+v dataReceived - public virtual
+s dataReceived - public static

Usually, if the return type is not shown, it returns void, but considering that your isPrepaid function probably returns a bool, my assumption is that you're missing some information.
 
  • Like
Likes iheadset
zak100 said:
Hi,
I am using a book for studying UML. It shows attributes without any data types:
dataReceived
isPrepaid
number: String
price: Money

What is the data type associated with above two i.e dataReceived & isPrepaid & what is their visibility (i.e publc /private). Some body please guide me.

Zulfi.
UML class diagrams usually include

Class name​
visibility attribute: type //for objects
----------------------------------------------
visibility operation(arg list types): return type // for methods​

visibility varies among groups of coders, organizations etc. But public(+) and private(-) are two most basic keys every class diagram should have.
 
Hi,
Thanks for your response.
<Usually, if the return type is not shown, it returns void, but considering that your isPrepaid function probably returns a bool, my assumption is that you're missing some information>
Its an attribute not an operation. Maybe iheadset is right:
<visibility attribute: type //for objects>
It should be a primitive data type.

Zulfi.
 

Attachments

  • class diagram attribute without type.jpg
    class diagram attribute without type.jpg
    17.6 KB · Views: 581
Looks like just lazy UML diagramming to save space.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
2
Views
3K
Replies
48
Views
10K
Replies
2
Views
3K
Replies
3
Views
2K
Replies
13
Views
3K
Replies
4
Views
3K
Back
Top