Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming convention for UML

Is there any name convention for UML?

I am interested in knowing how to name classes, packages and methods. However, if there is some document which specifies all naming convention for each UML diagram, please share it.

like image 426
eversor Avatar asked Dec 14 '12 23:12

eversor


3 Answers

The UML standard does not specify any naming convention. The naming standard you choose depends on the target audience of your UML model. This audience again is dependend on the purpose of your model. If you intend e.g. to generate code from your model than you need to have a result that will fit your target platform. My own experience is that choosing a platform independent naming is helpful if you would like to keep your model even after changing the target platform or if you intend to generate code for multiple target platforms. E.g. if you intend to create Java Code, DDL statements for your SQL database and XSD schema definitions for your Restful services than you have three different targets where you need a common language for all three targets. A good approach is IMHO to use platform independent type systems like CORBA IDL, XSD types or even ISO types. You could also use natural language type descriptions like "date", "time", "number", "currency". For the names of your Domain specific content you can use a mapping. E.g. if you name a Class "Customer Contact" and and operation "Call Customer", an Attribute "Customer's Name" then the mapping will allow to create e.g. Customer_Contact as the Java Class Name "callCustomer" as the operation Name and "customersName" as the attribute Name.

Whether you can apply mappings depends on the toolchain you are using. If you can't use mapping you'll have to decide which is least common denominator of your target platforms. If there is none you'll have to decide where it is the least effort to not follow the naming conventions.

Most important is IMHO whether the rules for mapping model elements to other artifacts are stricly followed and systematic (may be even automated) or whether the model is used for illustrative purposes and the mapping rules are just applied by people involved using their brains.

like image 192
Wolfgang Fahl Avatar answered Oct 23 '22 15:10

Wolfgang Fahl


Use different naming conventions based on different implementation targets. Here are a few:

  • General Naming Conventions

  • Underscore vs Mixed Case Naming Conventions

  • Leszynski Naming Conventions

  • ActionScript Naming Conventions

  • jQuery Naming Conventions

  • MXML Naming Conventions

Protocols which are implemented in many languages are also good examples:

  • bittorrent
  • libcurl
  • libusb
  • libgit
  • libexpect
  • xmpp
  • Test Anything Protocol (tap)
  • irc
  • webdriver
  • majordomo
  • websocket
  • memcached
  • Swagger
  • XDG
like image 2
Paul Sweatte Avatar answered Oct 23 '22 14:10

Paul Sweatte


Your UML naming conventions should be based on the naming conventions of the language you're programming in. You're describing your actual classes, packages, and methods so use the same names you are going to or have already used in your code.

like image 1
tenky Avatar answered Oct 23 '22 14:10

tenky