= vs ==


Recommended Posts

A point of confusion for some is DAQFactory's use of the single = to assign a value to a variable, and double == to compare two values. Some languages use the single = for both, but this creates more confusion because the meaning of = is then determined by the context of its use which isn't always apparent. By using = and == the meaning is the same no matter where it is used.

It is actually a bit of a balance when designing programming languages, and for that matter operating systems. Of course the language / system should be easy to use, but at the same time, you don't want the computer to do too much thinking for you. Not because our world is going to become like in the Matrix or Terminator, but because the computer / language / operating system was designed by humans and humans don't always think alike. When the computer thinks for you, its actually thinking how the programmer would think in that situation. However, people think differently and an assumption the programmer might make about what you want to do may be different than what you really want to do.

This is a big problem with Microsoft products in my opinion. Many of their features are quite handy, but the features that think for you are often wrong, so what happens is that in addition to having to learn the program, you have to learn how the programmer of that program was thinking so you can predict what the computer will do.

So, in DAQFactory, we try not to do too much thinking for you. DAQFactory does some, like the popup list of variables / channels, and it certainly has lots of features you can configure to make developing your application quicker and easier. But when it comes to scripting and such details, you have to tell DAQFactory specifically what you want, which includes using == for comparison and = for assignment. That way DAQFactory doesn't try and think for you and have your process making tennis shoes when you really want to make tennis rackets.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.