views:

247

answers:

1

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.

+1  A: 

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.

Tom Dalling