Jump to content

Common naming for class initialization methods


Recommended Posts

I suggest common naming standard for class initialization methods as long as LVOOP doesn't provide special initialization methods. There is a strong need for common naming so that class users easily know which method to call to initialize an object. The name of the initialization method needs to be different for each method in any class hierarchy because LV doesn't allow overriding the method connector pane.

Therefore I suggest that all initialization methods should have the name of the class. That is for ClassA the default initialization methods should be called ClassA.vi. If class needs destructor, it should be called ~ClassA.vi following the naming in C++. "~" can be part of file name at least in LV 8.2 on Windows XP, can anybody verify that this also works on Linux and OS X.

If there are more than one alternative initialization method for the class I suggest that the default one should be called as described above. The succeeding ones should be called ClassA.1.vi, ClassA.2.vi, .... that is adding the period and the number of the initialization method. The numbering starts from 1, the default method can be considered as the zeroth one.

How does this sound to you?

Link to comment
How does this sound to you?

I don't agree - although several models for naming have been suggested in the past (eg: the VIE naming model), all of them have been met with luke warm acceptance. Are you suggesting the we all just get together and use a convention, or that LabVIEW forces you to use a convention. Either way, I'm against it. If you want to implement a standard anming convention in your own company then go for it, but I don't think it's appropriate to try to force others to use it.

Link to comment
Are you suggesting the we all just get together and use a convention, or that LabVIEW forces you to use a convention.

LabVIEW doesn't force convention, as you all know. It would extremely help class user if there was a common naming convention for initialization methods. It would also reduce bugs, as class users could easily verify if such a initialization method exists. On the other hand if initialization method name varies from one class to another, it is very easy not to know if some method should be called to initialize an object.

Consider how much it easies your life that all programs have the same name and place for the operation that stores your current work to disk. On Windows computers it is File -> Save or Ctrl + S. It's a little same thing here.

Either way, I'm against it.

May I ask why? Don't you see any good in common naming convention?

Link to comment
On the other hand if initialization method name varies from one class to another, it is very easy not to know if some method should be called to initialize an object.

Sure - that may be so within a company or a particular engineering department, but applying a code naming convention across the industry is completely different.

Consider how much it easies your life that all programs have the same name and place for the operation that stores your current work to disk. On Windows computers it is File -> Save or Ctrl + S. It's a little same thing here.

Apples and Oragnes - you're talking about a software useability feature at the user level, I'm talking about a programming nomeclature at the programmer level - completely different.

May I ask why? Don't you see any good in common naming convention?

I sure do, but only in a smaller context, as described above. For example, I don't think it's a good idea that we name all strictly type-def'd controls as "STDEF - name.ctl" - that might be fine in a particular project, or paritcular team, or particulay company, but I find it far too limiting to try to apply that to an industry.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.