[GastForen

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste
Forenindex -- Lesezeichen

1 Lesezeichen für dialog

|| Dropdown Dialog mit den UI-Farben
The first thing that comes to mind in these lines:

var doc = app.documents[0];
var dialogNames = ["Türkis", "Orange", "Rot"];
var colorValues = [UIColors.TEAL, UIColors.ORANGE, UIColors.RED];

is that doc, dialogNames, and coloValues are not variables, but constants. So it would seem better to decalre as such:

const doc = app.documents[0];
const dialogNames = ["Türkis", "Orange", "Rot"];
const colorValues = [UIColors.TEAL, UIColors.ORANGE, UIColors.RED];

The advantage of using const is that constants cannot be redefined, protecting the contents of the defined constants.

As to the readability of variable names, if you want to distinguish them from InDesign's properties and methods, then why use the same naming convention of space-less title case with initial lower case (as in dialogNames)? I would make sure that my variables are easily recognisable as my own. For example, for variable and function names I've been using dialog_names: underscores for spaces, no capitals. No confusion.

Regards,

Peter
...
Peter Kahrel
16. Okt 2009, 14:04