Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Attributes without type in Class Diagram

  1. Jun 20, 2016 #1
    Hi,
    I am using a book for studying UML. It shows attributes with out 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.
     
  2. jcsd
  3. Jun 20, 2016 #2
    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 (Text):
    + 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.
     
  4. Jun 20, 2016 #3
    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.
     
  5. Jun 21, 2016 #4
    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.
     

    Attached Files:

  6. Jun 21, 2016 #5
    Looks like just lazy UML diagramming to save space.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted