[prog] Passing data between modules
Jimen Ching
jching at flex.com
Mon Jul 28 09:49:19 EST 2003
On Mon, 28 Jul 2003, Dan Richter wrote:
>>I'm planning a suite of data quality control programs in C to run under
>>*NIX. I want to keep everything as modular as possible in order to make the
>>suite flexible and futureproof.
>
>Hold it: you just wrote two conflicting sentences here. You want to write
>the program in C, and you want to make it modular, flexible and futureproof.
>
>Sorry to be so negative, but if you want to be futureproof, at least use
>C++. (Of course, you may have meant C generally, including C++.) Why is it
>so important to use C?
Can you elaborate on this? Why are the two sentences conflicting? And
why is C++ a better choice for futureproof? Note, I'm not arguing against
using C++. I too think C++ is a better choice, but note below.
Btw, what does futureproof mean anyway?
>I recommend a higher-level interpreted language: the program will be done
>five times faster and will be at least twice as readable, not to mention
>easier to change and less buggy. If you plan to do lots and lots of text
>processing, I recommend Perl. Otherwise, I recommend Python.
Five times faster? Even if you have to learn a new scripting language
from scratch? As you alluded to below, this doesn't sound like a small
project. So, if the programmer is not familiar with a scripting language,
I'm not sure if learning a new langauge is appropriate for such a large
project. This also applies to any language, not just scripting languages.
>>I'm concerned with passing data between the modules and how to do this
>>in a portable, accessible manner.
>
>This is something that C is really bad at. At least use C++.
Can you elaborate? Data passing is not a language specific operation. I
would imagine any language would be as good as any other language, unless
the language was designed specifically for data passing.
>If you really want to make all the modules separate programs (which I
>don't necessarilly recommend),
Is this because separate programs are intrinsically bad, or its bad only
for this application? I would also like to know what your opinions are on
the Unix style of using pipes. If a command line interface is acceptable
to Conor, the unix style of stringing together a list of utilities with a
pipe is exactly what he is describing. For instance, the image
manipulation application called ImageMagic does this.
I don't know enough of the use cases to recommend any specific UI. Just
trying to understand the pros and cons of the different approaches.
>you might try using Unix sockets for communication. This adds a lot of
>overhead (because all communications have to be serialized and
>deserialized), and in C it may make it more difficult to change the data
>structures later (because you have to change the serialization algorithm
>each time you change a data structure), but it's flexible means of
>message passing.
Why is it more difficult to change the data structures in C? As opposed
to in any language that has to serialize the communication and have data
structures?
--jc
--
Jimen Ching (WH6BRR) jching at flex.com wh6brr at uhm.ampr.org
More information about the Programming
mailing list