Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C and UML Modelling

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...

like image 360
user559142 Avatar asked Sep 15 '11 11:09

user559142


People also ask

What is UML in C?

Object-Oriented Analysis, Design and Programming with UML UML stands for Unified Modeling Language. UML is different from the other common programming languages such as C++, Java, COBOL, etc. UML is a pictorial language used to make software blueprints.

What is UML modeling with examples?

A Unified Modeling Language (UML) diagram provides a visual representation of an aspect of a system. UML diagrams illustrate the quantifiable aspects of a system that can be described visually, such as relationships, behavior, structure, and functionality.

What is UML in project management?

The Unified Modeling Language (UML) is a general-purpose, developmental modeling language in the field of software engineering that is intended to provide a standard way to visualize the design of a system.

Why UML is used in design?

The main aim of UML is to define a standard way to visualize the way a system has been designed. It is quite similar to blueprints used in other fields of engineering. UML is not a programming language, it is rather a visual language. We use UML diagrams to portray the behavior and structure of a system.


1 Answers

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.

like image 94
Abizern Avatar answered Oct 14 '22 17:10

Abizern