On Sunday, January 26, 2014 4:56:28 PM UTC-6, Ian Collins wrote:
>
woodb...@gmail.com wrote:
>
> > If you had said --
> >
> > it sometimes has to inter-operate
> >
>
> > I'd agree. I know of a few companies that write C++
> > programs that communicate with each other. That's
> > not exactly unheard of.
>
> Probably the most common type of "service" these days is the web
> service. Web services almost exclusively use SOAP. If you are going to
> write the back ends for web pages in C++, you will probably have to use
> JSON to communicate with the client JavaScript.
I've been reading about JSON some. The following is
maybe due to some misunderstanding, but it seems
JSON can only deal with user defined objects.
I have a message template (not a C++ template) that
looks like this:
@out (::cmw::marshalling_integer, const char*)
(A function is generated based on that.)
IIuc, with JSON, I'd have to create a class that has
those two types in it and then marshal an instance of
that type. I like not having to do that as there's
no need currently for such a class. Those two pieces
of data are from the command line and I just forward
them to the marshalling function without having to
create an object that's only use would be marshalling
it's data members. I will admit it wouldn't take long
to construct such an object, but there's a wrinkle.
If the class were:
class front_tier_type
{
cmw::marshalling_integer account_number;
char* path;
};
That class won't work for me in my middle tier where
it doesn't hurt to store the data from the path variable
in a std::string. I have to store it somewhere in the
middle tier so I choose to put it in a std::string.
Constructing a front_tier_type would be fast, but if
I changed it to have a std:string instead of a char*
it gets more expensive. I don't want to have to pay
for that in the front tier. So iiuc, JSON based
approach would have one class on sending side and
another on the receiving side. The other approach I
described is also different on the sending and receiving
ends, but is more efficient.
If there were more than two pieces of data, constructing
an object becomes more of a waste.
The C++ route seems to offer more flexibility than
the JSON approach.
>
>
> > And as I said I'm open to working on adding support
> > for another language, but I don't think that language
> > will be Java. Python or C# is more likely.
> >
>
> > I think scientific apps and games often use binary serialization.
> >
> By using a proprietary binary format,
The format isn't a secret.
> you are restricting yourself to a
> narrow range of applications. The easiest way to support other
> languages is to use a well known on wire format.
I may go back to this angle.