6

I have the following code:

This.is.a.supper.long.name = This.is.another.supper.long.name

Currently the only method I know is to escape the newline:

This.is.a.supper.long.name = \
    This.is.another.supper.long.name

Is there any elegant solution to this?

Huazuo Gao
  • 1,532
  • 13
  • 20

1 Answers1

3

There are several approaches.

 common = This.is
 common.a.supper.long.name = common.another.supper.long.name

If that doesn't help, you can

 name = This.is.another.supper.long.name
 This.is.a.supper.long.name = name

or

 setName(This, getName(This))

where the methods allow to hide the long access path. This becomes even more readable when you can change This:

 This.setName(This.getName())
Aaron Digulla
  • 310,263
  • 103
  • 579
  • 794