How to handle long method names in sequence diagram

programming practicessequence-diagramuml

I have a C# application that is developed with VS 2010 pro. The ultimate version would have a sequence diagram feature.

Since I will "create" my sequence diagram manually, how do I deal with quite long method names?

object.createPathForCustomerIDblablablabla_click()

Do I just use the method names as they are already given? Use a shorter name in the sequence diagram?

I would like it to fit on a A4 page.

Best Answer

Aside:
Contrary to popular belief, long names are not always a bad thing. Used in moderation, they can be helpful. For example, if a method returns a boolean value that indicates that the application startup should be aborted if the execution fails while the application is starting up then one of these is more clear than the other:

  • getTerminateDuringStartup
  • getHaltApplicationStartupIfExecutionFailsDuringStartupFlag

On to the Question:
If the names are too long to conveniently fit in a diagram, consider creating short names in the diagram only and map them to the full method name.

For example: Use createPFCIDbbbbc in the diagram and include a page that maps the short name to the long name. Consider flagging the short names; one way is to add an asterisk to the front of shortened names. In that case, *createPFCIDbbbbc would indicate that it is a shortened name and createBlammyQ would indicate that it is not a shortened names.

On the map page, start with a statement like "Some method names are too long to conveniently fit in the diagrams that follow. In these cases the method name will start with an asterisk to indicate that it is a shortened name. The list below maps between the shortened names and the actual method name in code". Then have a simple table like this:

Shortened Name         Actual Method Name
createPFCIDbbbbc       createPathForCustomerIDblablablabla_click