Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Representing Objective C Protocols on UML class diagrams

How should I correctly reference protocols on a UML class diagram?

For example my ListViewController conforms to the UITableViewDataSource and UITableViewDelegate protocols... where do I put the cellForRowAtIndexPath or numberOfRowsInSection methods? ... in ListViewController where they are implemented or in something like this:

         <<Protocol>>
    UITableViewDataSource 
    ---------------------

    ---------------------
    -numberOfRowsInSection 

If I did the latter what would be the association between the ListViewController class and the protocol box be? All I have to show is how I hook into Cocoa Touch some how.

Thanks.

like image 218
joec Avatar asked Apr 12 '10 20:04

joec


People also ask

How do you represent interface in UML class diagram?

A common convention is to prefix the name of the interface with a forward slash to indicate that a model element is an interface. As the following figures illustrate, the diagram editor displays an interface in the following ways: Class rectangle symbol that contains the keyword «interface».

What are the best practices in representing UML class diagrams?

It's best to avoid creating large diagrams and breaking them down into smaller ones that you can link to each other later. You can very easily do this with Creately. It helps you improve the readability of your diagrams.

How do you represent implements in class diagram?

In domain modeling class diagrams, an implements relationship represents a class that implements the operations in a Java™ interface. As the following figure illustrates, an implements relationship is displayed as a dashed line with an unfilled arrowhead.

What does a +/- symbol mean in an UML diagram?

This can be represented with the following class diagram. The fields and methods are annotated to indicate their access level: plus (+) for public, minus (-) for private, and hash (#) for protected.


1 Answers

Protocols are sort of equivalent to interfaces in java, so you can find a java UML diagram and work off that.

Also, from http://en.wikipedia.org/wiki/Class_diagram:

In UML modeling, a realization relationship is a relationship between two model elements, in which one model element (the client) realizes the behavior that the other model element (the supplier) specifies. A realization is indicated by a dashed line with an unfilled arrowhead towards the supplier.

...

A realization relationship between classes and interfaces and between components and interfaces shows that the class realizes the operations offered by the interface.

So if I'm reading that correctly, ListViewController would have a dashed line with an unfilled arrowhead pointing to UITableViewDataSource.

like image 188
Tom Dalling Avatar answered Sep 17 '22 18:09

Tom Dalling