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.
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.
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With