What's in a name?


Userlevel 6
Badge +12

A person’s name is the sweetest sound to them in any language.  Even in a crowded noisy room, you’ll probably hear your name called out over all the din.

 

Can you relate to when you share a name with someone?  Someone calls out your name “Hey Chris” and you and a different Chris look over at that person and wave?  A little bit embarrassing if it’s not you and a little bit inefficient.  The world would be more efficient if we had unique names but conversations would be difficult:

 

“Hi fingerprint ID 0010010101”
“Oh how’s it going fingerprint ID 1001010110?”
“Good man.  Good.  Happy New Year to you and your wife fingerprint ID 010111010111”

 

It’s much better when we can use terms such as Cassy, Andrew and Fernando* right?


The development world is a bit like this.  Beneath the scenes, everything is referred to using a unique code but we as humans can’t handle this so we’ve made life easier for ourselves by giving items names that make sense to us.

 

Where am I going with this post?  How should we name these things?  What makes sense?

 

In the Nintex world, we have Nintex variables, JavaScript variables, form controls, list and site columns and workflow constants.  You can name these however you want.  You can even give each one the same name but you’ll be asking for trouble!

 

Some may recall this mission where we had to fix a workflow.  One of the issues with the workflow was a list column had the same name as a variable and there is no way to differentiate between the two when you’re looking at your workflow or form.  If you do the same, you’ll make your workflows and forms harder to maintain and probably introduce a few more bugs than usual.

 

I’d suggest there is no single correct answer to how you should name things other than identifying/naming each of the aforementioned elements differently using a convention that works for you.  Here’s how I do it:

 

Element Description Example
List and site columns Plain English with spaces.  I don’t have a convention about proper case or mixed case.  Whatever seems appropriate. Person Name
Variables Prefixed with the notation var and I don’t use spaces. varPersonName
Workflow constants In all caps with words separated by an underscore.  I don’t differentiate between constant types (site collection, site, data types etc) or should I? PERSON_NAME
Form controls Accept the Nintex default which is to take the column name and remove spaces. Personname


I’m very interested to hear what naming conventions work for you.  Do you use lowerCamelCase?  Do you use Hungarian notation/include the data type in the name?  Do you override the Nintex Forms default?  Do you use spaces in your column names?  Do you differentiate your constant types?  Let us know in the comments below.

 

Cheers,
Chris


* Names bear no resemblance to popular members of this community.  Whatsoever.  Honest! silly.png


13 replies

Userlevel 6
Badge +13

Cassy Freeman‌, Paul Crawford‌ and others along with myself did this at my old company. 

We established our naming conventions for the Workflow Variables in the format like so:

v"datatype""description"

we also added

col"description" for our collections.

and camelCase of course

So we would have vtxtDocumentName, vpplPersonName or colListItemIds.

Brilliantly written article by the way.

Userlevel 3
Badge +9

Good post and thanks for the examples.  For site/list columns I was taught early on to name them without spaces, otherwise the actual system name inserts "%5Fx0020%5F" for the space, which is difficult to read and I remember it causing problems at times in the past in certain situations.  After the column is created I then change the display name to have a space in it.  I don't have Nintex Forms, so don't know if it looks at the actual column name, or the display name.  I know you see the display name in the workflow designer. 

For my variable naming conventions, I use an abbreviation for the type, followed by an underscore, then the variable name.  Ex: st_Name, mt_Description, c_Tasks, etc.  "st" for single line of text, "mt" for multiple lines of text, "c" for collection.  

Userlevel 6
Badge +12

Thanks Ryan :)

Userlevel 6
Badge +12

Interesting point about the column names Brendan.  I checked in the forms designer and, at least to the user, it uses the column display name when referring to column names.

If anyone wants some further reading about the display name vs the static name, this blog post provides a good explanation.

Cheers,

Chris

Badge +9

I've also found Ryan Greenaway‌'s method to work best, especially for debugging if you're trying to save text to a number column for example with datatype in the name.

If only we had constants in O365

Userlevel 7
Badge +17

One thing to note about variables and Nintex Workflow Cloud. By habit I use my naming convention for variables in a NWC workflow in which I also needed Nintex Mobile App start. So my variables were my start form. Since you (yet) cannot have a different display name, you will need to write out the name of the variable instead of using the naming convention.

Userlevel 7
Badge +17

We do the same Ryan. Using types in the name also help in locating where a variable is used when you go back to edit weeks later. If done correctly, you know to expect certain types within certain actions. 

Userlevel 7
Badge +17

Just to add to this blog as an article of helpful links about variables, see

Badge +11

Be careful of the spaces with names. They aren't spaces in the url when they are referenced. It makes it harder when trying to refer to it later. I prefer not using spaces. For example, strFirstName, intAge, etc. Of course this was how I was taught when I started programming.

Userlevel 6
Badge +12

Bugger!  I imagine that will change as the forms designer for NWC is expanded.  Hopefully! :)

Userlevel 6
Badge +15

This is a similar issue for O365 start forms, where the variable is displayed and (as far as I can tell so far), not changeable. 

So long, txtProjectName and numProjectCode ... hello Project Name & Project Code.  

Badge +7

Hi,

I work the same way: first create some "internal" column-name and the rename to column; or create the columns with powershell (CSOM), where you can specify the internal and the display-name at once.

This is also true for lists: I would always at first create the list with some "nice" internal name, as this will become part of the URL. Maybe stick with some kind of short-name, to keep the URL less then 260 characters. Then change the display-name of the list to something meaningful for endusers.

This is not as important if you're just working with Nintex (Workflow or Forms), but it becomes a real pain if you're happen to access those kind of column-names (containing space or other special characters like german Umlaute!) in code (e.g. REST, CSOM, SSOM ...). Or if you feel the need to create a custom CAML-query this will hit you as well. 

Badge +7

I omit the "v" for variable usually, but other than that I usually stick to the hungarian notation as well.

Depending on the action/field/... Nintex does show references sometimes as "{WorkflowVariable:intNumber}", which makes it obvious that it's a variable

Reply