There are lots of different ways to do the same thing when programing.
Mary has got the ball rolling on an important topic, I really want to give it a bit more of a push…
When I program, I don’t use Hungarian notion… for me, I really could not see the point.
In fact, in my mind, its more of a hindrance than a help; so here’s my take on tag names…
PAC Control does a great job in telling you what type each variable is, both in the strategy tree and when selecting variables when programming.
Take a look at the following grab from one of my typical strategy’s;
(Note, you have to log into the forums to see any of the images)
You see a few thing here, but lets drop down to the green and light blue arrows.
Here you can see how PAC Control tells you what sort of variable each tag is.
You can see if its a float, and you can see if its an int32 (or even an int64).
When you program, you get the chance to select from all your floats, ints and different types as shown in this screen shot;
As you can see, you can very easily select just what ever variable you want.
But my point really does not stop here.
Do you really even need to know what type of variable or tag you are working with?
PAC Control does a great job of flipping between floats and ints for example, that often you don’t even have to worry about it, if you know your tag names, you just program your process and leave PAC Control to take care of the details.
Take a look back up at the first screen shot, the large red and blue sections, you can see that they are grouped by name.
PAC Control will always sort your names alphanumerically, so use this fact to your advantage.
Think for a moment. Do you want say, all your alarms grouped together? If that’s the case, then prefix all your tags, whether they be floats or ints with ‘alarm_’.
In my case here, I wanted all the variables for each fluid cooler to be grouped together… So, I named all my tags ‘fc2_’ and ‘fc3_’. This way, when I am looking the strategy tree, I don’t have to look through the whole tree to find what I need. They are all in the one spot.
Same when I am programming in the chart, I don’t even have to use the drop down box to select my variable type, I just grab the number of the cooler I am working on and use the tag I want.
If you use Hungarian notation, you will have all your ‘fv’ and ‘dt’ in one spot in the tree, and they will be double redundant with whats shown in the strategy tree.
I think my summery is this; if you are new to programming, try a few different small charts and see what works with your brain.
If you are an experienced programmer, this entire entry is probably null and void because you already know what works for you and it may not even be what Mary said or what I have shared.
There is no right and wrong, just bug free code. (Well, that’s the hope!)
Sound off in this tread, what naming conventions have you found works best for you?
And as always;