You must Sign In to post a response.
  • Category: WPF

    How to represent property in UML class diagram

    How to represent property in UML class diagram .


    E.G .

    private int? CurrentBaud
    {
    get
    {
    if (SelectedComPort.HasValue)
    return SelectedComPort.Value.Baud;
    else
    return null;
    }
    }

    I create this property in class .
    And another question why use int? question mark.
  • #769127
    Hi,

    UML Property cab be represented in a simple way. Suppose take the example of the below code.



    public class Example {
    private int x;
    protected int y;
    public int z;
    public Example() { ... }
    public String toString() { ... }
    private void foo(int x) { ... }
    protected int bar(int y, int z) { ... }
    }



    The above code we have different access specifier. Each one represent with each symbols in UML Diagram.
    Check below how the above code is represent in UML,


    -x:int // -x represent x integer variable which is private(-)
    #y:int // #y represent y interger variable which is protected(#)
    +z:int // +z represent z interger variable which is public(+)

    +<<constructor>>Example() // Same Name so represent as Constructor and + represent Public


    similarly we can do our UML structure coding

    Thanks,
    Mani

  • #769157
    Hi,

    It's highly difficult to describe UML diagrams here, I suggest you to kindly Google it what is UML diagram and how to build the UML diagram, before drawing any diagram you have to know the basic structure how your code looks like after implement the application, and what are all the classes / methods/ properties are you going to use in that.

    Once you know all the above, not exactly at-least some draft version then start to implement it by referring below link
    http://creately.com/blog/diagrams/uml-diagram-types-examples/

    And coming back to your second question why"?" after int?

    the reason behind is, for example the return value is null then it won't throw any error if you are using "?" we call it as Coolease, check in Google coolease in c#.

    Hope this helps you...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments