Reputation: 12517
We all know Objective-C method headers carry more information than standard Java method headers....
This poses an issue when modelling using UML...Some method names are uncontrollably quite long...what is the best way to model these methods clearly in a UML class diagram?
Can you condense the method names, or write some Java style header for them?
I'm doing a report for a software system and I am stuck...
Upvotes: 10
Views: 1133
Reputation: 150615
I think in some cases Objective-C headers carry less overall information, but they can show the interfaces more clearly.
For example - Using the modern Objective-C runtimes (for Mac OS and iOS) you don't need to declare private iVars, or private methods in the headers - they can be shifted to a category in the implementation file. You can even redeclare properties as readwrite
in the implementation where they are declared as readonly
in the header file.
This means that there is a lot more going on in a class than is shown in the header files, but the public interfaces are clearly defined separately from private implementation - which is a good thing in a UML diagram.
As for long method names - that's part of the convention of Objective-C. You can love it or loathe it (I personally love it). But in terms of writing them methods don't show their parameters. For example: suppose you have a method declared as:
- (NSString *)resultStringWithOptions:(NSDictionary *)options withCharacterSet(NSCharacterSet *)charSet error:(NSError **)error:
The actual name of this method is:
resultStringWithOptions:withCharacterSet:error:
Which is shorter.
Upvotes: 4