Interplatform (interprocess, interlanguage) communication

A

Arne Vajhøj

potentially, but checking against schemas isn't free.
depending on the application, it could be hard to justify spending the
extra clock cycles (except maybe for debugging purposes or similar).

One of the points is that you can validate during integration test
and if you encounter a problem but keep validation turned off otherwise.

And besides I would assume the big XML parser libraries to have
optimized the validation quite a bit.

Arne
 
A

Arne Vajhøj

On 12-02-09 12:15 PM, BGB wrote:
On 2/9/2012 3:24 AM, Arved Sandstrom wrote:
[ SNIP ]

Consider line-oriented files/messages like .properties files: these
can
describe hierarchical structures perfectly well if you've got an
understood key=value syntax, specifically with a hierarchy-supporting
syntax for the keys. Easy to read and edit, easy to parse.

yes, but this defeats your own prior point, namely indirectly asserting
that line-oriented == flat-structure.

Minor quibble, I didn't make such a point, not even indirectly. You may
be confusing me with Arne.

point is, one can have hierarchical line-oriented files.
[ SNIP ]

Yes.

You can have non flat structures other than XML, but parsing
quickly becomes very complex.

IMO: not particularly...


tree-structured line-oriented text formats are not that much more
complicated to parse than flat-list line-oriented text formats (the only
obvious difference is that rather than a single loop, one typically has
multiple loops).

it all still basically amounts to:
read a line;
split the string;
do something with the split strings.

????

But that not how you work with XML.

You load it into a DOM and use XPath to pull
out what you need.
personally, I like recursive hand-written descent parsing, as it is
fairly straightforwards and doesn't depend on external tools.

You need to depend on some tools.

If you use Java then you depend on standard Java library.

Standard Java library contains several XML parsers.

No extra dependency for Java.

Arne
 
A

Arne Vajhøj

On 2/9/2012 3:24 AM, Arved Sandstrom wrote:
On 12-02-08 10:50 PM, BGB wrote:
On 2/8/2012 7:16 PM, Arne Vajhøj wrote:
On 2/8/2012 2:07 PM, BGB wrote:
On 2/8/2012 4:19 AM, Arved Sandstrom wrote:
On 12-02-08 04:41 AM, BGB wrote:
note: my main way of working with XML is typically via DOM-style
interfaces (if I am using it, it is typically because I am
directly
working with the data structure, and not as the result of some
dumb-ass
"data binding" crud...).

I haven't been able to completely avoid using the DOM, but I
loathe the
API. If I'm using XML at all, and JAXB suits, I'll use JAXB. More
generally I'll use SAX or StAX.


I have rarely done things for which SAX has made sense...
usually in cases where SAX would make sense, I end up using
line-oriented text formats instead (because there is often little
obvious reason for why XML syntax would make much sense).

Non flat structure and validation comes to mind.

fair enough.

often, one can implement non-flat structures with line-oriented
formats,
for example:
...
groupDef {
...
groupDef {
itemDef {
...
}
...
}
...
}
[ SNIP ]

No need for the braces, if you're going to use those all you gain over
the XML is terseness.


well, if the format is still line-oriented, one can still parse the
files using a loop, getting and splitting strings, and checking the
first token of each line.

parsing XML is a little more invovlved, since:
items may be split across lines, or multiple items may exist on the same
line;
one can no longer use whitespace or commas as the primary deliminator;

????

No one in their right mind would parse XML manually.

You can pick between lots of nice XML API's (many of them
shipping with Java) that will handle all that.

depends on which language one is using at the time...

if one is using Java, then XML parsing is basically free.
if one is using C, then it is either "write some code to do it", or
suffer with a 3rd party library dependency (one might validly choose to
write the code themselves in this case).

I don't expect it is all that uncommon for a person to switch between
several different languages, and maybe deal with the strengths and
weaknesses of whichever language they are using at the time.

But given that there is little code reuse between Java and C
in the first place, then C not having builtin XML parser
is no reason not use the builtin one in Java.

And if we talk C then look at LIBXML2 - it works pretty well.

Arne
 
A

Arne Vajhøj

BGB said:
if one is using C, then it is either "write some code to do it", or
suffer with a 3rd party [sic] library dependency (one might validly
choose to
write the code themselves in this case).

"Suffer"? The XML parsers for C are well-established, very reliable,
and no
cause for suffering. Using a pejorative is not the same as establishing a
point.

There is nothing wrong with the third-party libraries, and the choice to
roll your own for C is rarely valid. You seem to suffer from NIH
syndrome.

they introduce porting hassles:
does one bundle "libxml" with their app on Windows;
do they use MSXML and then deal with having to switch over to "libxml"
when building on Linux?

LIBXML2 works fine on Windows, so you can use it on both platforms.
but, anyways, it is like asking a person never to write their own JPEG
loader/saver, or their own scripting-language compiler. yes, maybe a
person doesn't technically need to, but they may forsake potentially
valuable learning experiences (or the claim to having the skills to do so).

I think you should very clearly distinguish between when you talk about
learning and programming production code.

The goals are just so different.

Arne
 
A

Arne Vajhøj

This is the use case for which XML with schema excels. It is very nearly ideal
for the purpose. XML is semantically void with respect to the problem domain,
schemas provide a reliable contract for interpretation of the messages, they
provide a convenient human-readable format to ensure agreement by all
stakeholders, the drive the easy-to-use tools for XML-based message passing,
and such easy-to-use tools are abundantly available for every major platform
and computer language.

Your comments about different libraries' availability makes an asset sound like
a problem. It's a *good* thing that there are so many libraries available. XML
itself provides the compatibility.

Multiple libraries for same language each available on all platforms is
a good thing.

But he was talking about multiple libraries for same language
one for each platform, which is bad.

The good thing is that the particular example mentioned in
a previous posts does not apply as LIBXML2 is available for
both platforms.

Arne
 
L

Lew

Arne said:
????

But that not how you work with XML.

You load it into a DOM and use XPath to pull
out what you need.

Or you scan it with SAX or StAX and deal with XML-parsing events, or
you run the schema through JAXB and let it generate all the parsing
classes for you, or you use one of the many other standard libraries
in Java (or if not Java, in your favorite platform) that are available
for free.

The number-theorist can never pass a calculus exam because he's only
just reinvented calculus by the end of the hour.
You need to depend on some tools.

If you use Java then you depend on standard Java library.

Standard Java library contains several XML parsers.

No extra dependency for Java.

The thing is, BGB, that your macho programming style is impractical
and not very justifiable. It's wonderful that you have reinvented the
programming world and all, and are so clever and knowledgeable, but
most of us programmers work in a workaday pragmatic environment where
best practices really do save the day. That means use the standards,
and the abundant tools that support them, and give up our egos that
make us feel that superman heroics are the only available path. I
sincerely hope that readers of this thread can understand the manifest
shortcomings of the approaches that you've espoused here. (And that
they can disentangle themselves from your fetching but irrelevant
analogies.) To get the job done, to get it done right, and to minimize botherror and development time, use the standards.

XML is just fine for just about every purpose to which it's put.
That's why it's popular now. People who cavil about "bandwidth" and
"10 Hz network messages" are tossing us red-herring sashimi. You
aren't going to get 10+ Hz message exchanges over the WAN. For
realistic message rates, XML suits beautifully. I speak from
experience with many, many projects that used every conceivable
message format from binary to CSV to custom to XML to protocol buffers
to JSON, and XML has distinct advantages. Its purported disadvantages
of bulk and bandwidth turn out to be non-issues in practice. Really.
That's real.

So, dear future readers, stick with what's known to be true by people
who actually do this work, not by some armchair theorist in a darkened
room who thinks that he has to do everything by hand and wants the
rest of us to follow his suboptimal strategy.
 
L

Lew

Oh, yeah, micro-optimize that last $0.0000001 of performance.

Great thinking.

Checking against schemas isn't so expensive, either. You spout this drivel,
BGB, about "isn't free", but where are your numbers? Show us reality, dude -
exactly how "not free" is schema validation, under what loads, on what
platforms? Hm?

I thought not.

How many "extra clock cycles", and does it cost less than the damage your
development techniques cause?
One of the points is that you can validate during integration test
and if you encounter a problem but keep validation turned off otherwise.

And besides I would assume the big XML parser libraries to have
optimized the validation quite a bit.

Given that BGB is just spewing dream talk with zero or less than zero facts,
evidence or measurement behind it, it's pretty safe to dismiss his
"conclusions".

or such ...
 
A

Arne Vajhøj

Or you scan it with SAX or StAX and deal with XML-parsing events, or
you run the schema through JAXB and let it generate all the parsing
classes for you, or you use one of the many other standard libraries
in Java (or if not Java, in your favorite platform) that are available
for free.

If the size of the XML file allows it then DOM and XPath is
usually the least and most readable code.
The thing is, BGB, that your macho programming style is impractical
and not very justifiable. It's wonderful that you have reinvented the
programming world and all, and are so clever and knowledgeable, but
most of us programmers work in a workaday pragmatic environment where
best practices really do save the day. That means use the standards,
and the abundant tools that support them, and give up our egos that
make us feel that superman heroics are the only available path. I
sincerely hope that readers of this thread can understand the manifest
shortcomings of the approaches that you've espoused here. (And that
they can disentangle themselves from your fetching but irrelevant
analogies.) To get the job done, to get it done right, and to minimize both error and development time, use the standards.

Bad day??
XML is just fine for just about every purpose to which it's put.
That's why it's popular now. People who cavil about "bandwidth" and
"10 Hz network messages" are tossing us red-herring sashimi. You
aren't going to get 10+ Hz message exchanges over the WAN. For
realistic message rates, XML suits beautifully. I speak from
experience with many, many projects that used every conceivable
message format from binary to CSV to custom to XML to protocol buffers
to JSON, and XML has distinct advantages. Its purported disadvantages
of bulk and bandwidth turn out to be non-issues in practice. Really.
That's real.

????

The industry standard for smartphone apps and AJAX web apps
are JSON because the bandwidth actually matters.

Arne
 
A

Arne Vajhøj

Oh, yeah, micro-optimize that last $0.0000001 of performance.

Great thinking.

Checking against schemas isn't so expensive, either. You spout this drivel,
BGB, about "isn't free", but where are your numbers? Show us reality, dude -
exactly how "not free" is schema validation, under what loads, on what
platforms? Hm?

I thought not.


How many "extra clock cycles", and does it cost less than the damage your
development techniques cause?


Given that BGB is just spewing dream talk with zero or less than zero facts,
evidence or measurement behind it, it's pretty safe to dismiss his
"conclusions".

or such ...

In science you dismiss hypothesis's based on proving them wrong
not by noting the lack of proof.

Arne
 
B

BGB

BGB wrote:
if one is using C, then it is either "write some code to do it", or
suffer with a 3rd party [sic] library dependency (one might validly
choose to
write the code themselves in this case).

"Suffer"? The XML parsers for C are well-established, very reliable,
and no
cause for suffering. Using a pejorative is not the same as
establishing a
point.

There is nothing wrong with the third-party libraries, and the choice to
roll your own for C is rarely valid. You seem to suffer from NIH
syndrome.

they introduce porting hassles:
does one bundle "libxml" with their app on Windows;
do they use MSXML and then deal with having to switch over to "libxml"
when building on Linux?

LIBXML2 works fine on Windows, so you can use it on both platforms.

yeah, it is an option.
however, it is not a standard library on Windows (in certain cases, one
may need to provide for it, or expect anyone who wants to build from
source to provide for it, ...).

I think you should very clearly distinguish between when you talk about
learning and programming production code.

The goals are just so different.

in my case, both often end up being the same code.

one may end up doing something initially as a learning activity, but if
one does so, and the code works fairly well, why write the same code
again?...

granted, being a programmer working for a corporation or something, vs
being an independent game developer, could also be a factor.
 
A

Arne Vajhøj

On 2/10/2012 9:51 AM, Lew wrote:
BGB wrote:
if one is using C, then it is either "write some code to do it", or
suffer with a 3rd party [sic] library dependency (one might validly
choose to
write the code themselves in this case).

"Suffer"? The XML parsers for C are well-established, very reliable,
and no
cause for suffering. Using a pejorative is not the same as
establishing a
point.

There is nothing wrong with the third-party libraries, and the
choice to
roll your own for C is rarely valid. You seem to suffer from NIH
syndrome.


they introduce porting hassles:
does one bundle "libxml" with their app on Windows;
do they use MSXML and then deal with having to switch over to "libxml"
when building on Linux?

LIBXML2 works fine on Windows, so you can use it on both platforms.

yeah, it is an option.
however, it is not a standard library on Windows (in certain cases, one
may need to provide for it, or expect anyone who wants to build from
source to provide for it, ...).

C is not standard on Windows either.

You need to get some things.
in my case, both often end up being the same code.

one may end up doing something initially as a learning activity, but if
one does so, and the code works fairly well, why write the same code
again?...

Because what you learn the most from and what is most cost efficient for
the company may very well be two different things.

Arne
 
L

Lew

BGB said:
yeah, it is an option.
however, it is not a standard library on Windows (in certain cases, one

First you spend half a newsgroup thread decrying standards and
proudly boasting how you flout them, now you suddenly denigrate a
library for not being standard?

And yes, libxml2 is, too, standard, as such things go.
may need to provide for it, or expect anyone who wants to build from
source to provide for it, ...).

"provide for it"?
in my case, both often end up being the same code.

So you don't write code for someone else?
one may end up doing something initially as a learning activity, but if
one does so, and the code works fairly well, why write the same code
again?...

Asked and answered upthread. Don't cycle.
granted, being a programmer working for a corporation or something, vs
being an independent game developer, could also be a factor.

If no one but you ever looks at your code or has to maintain it,
you can be as idiosyncratic and antisocial as you like. I know
people who've lived alone so long they cannot maintain a civil
discourse in public. Their habits don't bother them when they're
home alone, but that doesn't make them optimal.

Most of your arguments sound like apologetics for undisciplined,
egocentric programming with little connection to facts or the real
world of the workaday programmer, or the costs thereof. Heck, you
haven't even answered the question as to what the costs of software
development are.
 
B

BGB

In science you dismiss hypothesis's based on proving them wrong
not by noting the lack of proof.

yeah...


and anyways, I am not about "making conclusions" or "decreeing how
things should be done" or anything, rather, my view is there may be a
time and place for everything (and whatever is or is not the case can be
decided on a case-by-case basis or similar, based on whatever may apply
in the particular case in question, and whichever options may be cheaper
or more expensive, and similar).

IMHO, the idea that a person "should" always do things the same way in
every situation is itself arguably questionable. likewise goes for a
beliefs that something is universally required or universally
prohibited, ...


[ decided to leave out most of the rest of what I wrote. ]

basically, it all amounted to the frustration that there is little point
in trying to "prove" something which ultimately results to little more
than "hair splitting over a few percentage points...".

the thing is... textual XML is kind of bulky, but doing damn near
anything to it (like running it through deflate) will significantly
reduce its size (say, to around 10-25% its original size). one can
outperform this with specialized formats, but at this point it is
worrying about a few percentage points +/-.

what is the point of "proving" something which is ultimately of a fairly
limited significance and scope?...

maybe one can try to "prove" that people "should" actually give a crap.

or, for that matter, finding a particular claim to disprove (say, that X
is always true or always false). this is rarely the case with data
compression, as it is typically more about averages, and likewise, there
are cases for which the data may actually get bigger (about the only
real "absolute" in data compression is something commonly known as the
"Shannon limit").

secondarily is the "law of diminishing returns" (itself a natural result
of the Shannon limit), where essentially the compressibility of a piece
of data will form a sort of curve, and any (lossless) algorithms will
fall somewhere along this curve, and typically with a fairly consistent
ordering (say, for example, LZMA tends to compress better than BZip2
which tends to compress better than Deflate/GZip).

one can look at how each algorithm works internally, or experiment with
how they can use the basic parts to build other things or achieve
interesting results (and note mostly that the parts themselves tend to
fall along these sorts of curves, reducing "compression" mostly to a
matter of "going mix and match" with various parts and making
cost/benefit tradeoffs between particular combinations of parts).

note that going further along the curve tends to become increasingly
costly, hence why tradeoffs need to be made.


but, ultimately, how much something is relevant will itself tend to
depend somewhat on context.
 
B

BGB

If the size of the XML file allows it then DOM and XPath is
usually the least and most readable code.


Bad day??


????

The industry standard for smartphone apps and AJAX web apps
are JSON because the bandwidth actually matters.

yeah.


and, in fact 10Hz asynchronous throughput is possible... (this is
typically how most online gaming works).

one can't reasonably get 10Hz synchronous (IOW: request/response), due
to ping times, but this is a different matter.


I am not claiming one can do request/response at 10Hz, as this probably
would be impossible over a WAN (at reasonable ping times).

online gaming generally isn't based on request/response though, so the
problems of not being able to get responses at this rate don't really
matter too much (the user may still notice the results of bad ping
times, namely stuff being out of place or seemingly teleporting around
or similar, but this is a different issue).


TCP has a throughput limit due to ping, where assuming unlimited
bandwidth but a 200ms ping, one will still be limited to somewhere
around 320kB/s or so (assuming a 64kB window).

however, as is, there are typically bandwidth constraints as well (but,
they are a little more subject to fudging).

the main goal is mostly to send everything at a bandwidth low enough
that the connection doesn't risk getting backlogged (depends on internet
connection, but 16-32 kB/s seems reasonably safe, as internet radio
often tends to operate in this range, say, 192kbps is 24kB/s).

stalls are also a potential risk as well.


or such...
 
B

BGB

On 2/10/2012 12:43 PM, BGB wrote:
On 2/10/2012 9:51 AM, Lew wrote:
BGB wrote:
if one is using C, then it is either "write some code to do it", or
suffer with a 3rd party [sic] library dependency (one might validly
choose to
write the code themselves in this case).

"Suffer"? The XML parsers for C are well-established, very reliable,
and no
cause for suffering. Using a pejorative is not the same as
establishing a
point.

There is nothing wrong with the third-party libraries, and the
choice to
roll your own for C is rarely valid. You seem to suffer from NIH
syndrome.


they introduce porting hassles:
does one bundle "libxml" with their app on Windows;
do they use MSXML and then deal with having to switch over to "libxml"
when building on Linux?

LIBXML2 works fine on Windows, so you can use it on both platforms.

yeah, it is an option.
however, it is not a standard library on Windows (in certain cases, one
may need to provide for it, or expect anyone who wants to build from
source to provide for it, ...).

C is not standard on Windows either.

You need to get some things.

probably, but it is a question of how many things have to be worried
about as a part of getting it built (for someone wanting to rebuild from
source). if a program depends on a big pile of 3rd party libraries, it
may be harder to get rebuilt than if it doesn't.

it is arguably bad enough requiring that a particular C compiler be
installed (such as MSVC / Windows SDK), and that the program has to be
built in a certain way.

expecting the person to go download a bunch of libraries, get them
built, and put them all in the library and include paths, well, this is
adding a bit more to the cost.

this particular cost is a bit lower on Linux though, since 3rd party
libraries are more commonly available and are handled more gracefully
(nearly everything gets installed to "/usr/lib" and "/usr/include" and
similar).


alternatively, one could be like:
this app needs to be built in Cygwin.

the tradeoff though is that Cygwin has its own annoyances (needing to
have their DLL with compiled binaries, and the tendency for it to always
have a console window pop up for the app if it wasn't launched from a
console).

MinGW is a little nicer than Cygwin regarding the above, however it
doesn't come by default with a large pile of 3rd party libraries (so, it
has the same basic issue here as MSVC).


it is not that I haven't used any 3rd party libraries though, as a few
have been used, but essentially copied into the project. a few past
libraries were used, but later dropped since I had re-implemented their
functionality in smaller forms.


this avoids needing them as external dependencies, since then they are
built along with the application (then they are internal dependencies).

yeah, even within the same program, the matter of "what is allowed to
use and depend on what" can become its own issue (if one doesn't pay
attention to these internal dependencies, they may come around and bite).


Because what you learn the most from and what is most cost efficient for
the company may very well be two different things.

well, it is possible.


often it ends up with a cycle where something is implemented once (or
maybe a few times), and very often if something similar is needed later,
code is reused via "copy/paste/edit" magic.

in my case though, admittedly I am not actually employed as a
programmer, but am more of a college student + independent game
developer (mostly working on a 3D FPS style game). like, one has to
"face the impossible" and so on (and, with luck, getting something on
the market and getting enough money to live on, and trying to make newer
and better stuff, ...).


admittedly, a person who was notable influence for me was John Carmack,
who was the lead programmer for id Software, and was well known for the
Doom and Quake series games. I learned a fair amount from his code
(since he tends to release it all under the GPL).

others influences include Linus Torvalds (who created Linux) and Notch
(Marcus Persson, most well known for creating Minecraft). the Linux
kernel was a notable influence on me regarding things like program
architecture and similar.


in my case this also means dealing with with the all art, sound, music,
.... as well, so one tries to gain skills both as a programmer and as an
artist. I consider myself to be much more of a programmer than an artist
though (I started out programming, and the art can't do much without the
code).

there is still a lot of areas for learning and experimentation though.


or such...
 
B

BGB

First you spend half a newsgroup thread decrying standards and
proudly boasting how you flout them, now you suddenly denigrate a
library for not being standard?

And yes, libxml2 is, too, standard, as such things go.

standard, as-in, comes bundled with the OS and compiler.

libxml2 comes on Linux, but not on Windows with the "Windows SDK" or
similar (AFAIK it does come with Cygwin though).


safely, one can use, on Windows:
the ANSI C runtime (more or less C89/C90);
any Win32 API provided stuff (Winsock, GDI, OpenGL, ...);
....

on Linux, one has:
the ANSI C runtime (C99);
POSIX;
X11 and OpenGL;
a big pile of FOSS libraries.

so, what is common:
the C runtime;
OpenGL.

and, what needs to be provided by OS specific shims:
BSD Sockets / Winsock;
GDI / GLX;
getting user-input (keyboard / mouse);
stuff for low-level memory management, threads, managing dynamic libraries;
....


most other things tend to be kept either internal or are optional.
I don't think architecturally it is all that unusual (take, for example,
Doom 3 and Mozilla, both of which appear to have a similar architecture).

"provide for it"?

have to make sure it is built, installed, and on the OS's library and
include paths (like, mandating a particular build configuration).

otherwise, the library needs to be copied into the application's build
tree, and built along with the application.

So you don't write code for someone else?

like a contractor or something?... nope.


I write software for myself, and hopefully to try to get money more
directly (selling directly to end users).

Asked and answered upthread. Don't cycle.

with a thread this long, how is one supposed to remember all of what
they have said already?

If no one but you ever looks at your code or has to maintain it,
you can be as idiosyncratic and antisocial as you like. I know
people who've lived alone so long they cannot maintain a civil
discourse in public. Their habits don't bother them when they're
home alone, but that doesn't make them optimal.

Most of your arguments sound like apologetics for undisciplined,
egocentric programming with little connection to facts or the real
world of the workaday programmer, or the costs thereof. Heck, you
haven't even answered the question as to what the costs of software
development are.

costs of software development?...
besides the obvious stuff, like writing the program and making it work?...

I don't personally believe my strategy to be making it all that much
harder (or expensive) for myself.


but, anyways, discipline itself is a matter of cost/benefit tradeoffs,
like "what do I get out of it?" and similar. the general idea is that
people act in their self-interest to try to maximize their own gain. I
don't think my behaviors are inconsistent with this ideal (except being
lazy at times, where time spent not doing stuff is time wasted).

for example, there is the larger society, but each person is themselves,
and the people and things around them can be valued in terms of how they
may be of benefit to oneself and similar, but, with the side effect that
often whatever is most benefit to oneself may potentially be of benefit
to others as well (note: I don't currently personally believe altruism
actually exists, but rather it is likely a sort of misconception
regarding what really is in ones' best-interests).

similarly, the relative value of an action could be evaluated primarily
in terms of its most likely costs and benefits (to oneself, although not
necessarily immediate, for example a more immediate gain may cost more
later on, ...).

discipline can itself cost in terms of time or effort, whereas hacking
together something in the name of expedience can get it into working
order quicker.


or such...
 
R

Roedy Green

Obtain the lock:
raf = new RandomAccessFile(file, "rw");

fo = new FileOutputStream(raf.getFD());
fo.getChannel().lock(0, Long.MAX_VALUE, false);

Release the lock:
fo.close();

That is quite a bit of overhead. I would work fine for low traffic. I
was hoping for something that would let you leave the file open in
both jobs. e.g. a reserved block or blocks in the file that the
intercommunicators read and wrote to lock. I suppose you could send
messages to a task that owned the file (a primitive database), but
then you might as well send messages directly to each other.
 
A

Arne Vajhøj

yeah...

and anyways, I am not about "making conclusions" or "decreeing how
things should be done" or anything, rather, my view is there may be a
time and place for everything (and whatever is or is not the case can be
decided on a case-by-case basis or similar, based on whatever may apply
in the particular case in question, and whichever options may be cheaper
or more expensive, and similar).

IMHO, the idea that a person "should" always do things the same way in
every situation is itself arguably questionable. likewise goes for a
beliefs that something is universally required or universally
prohibited, ... ....
but, ultimately, how much something is relevant will itself tend to
depend somewhat on context.

The fact that there is exceptions to most rules should not lead to
a perception that rules does not matter.

You should strive to go by the rules and only very reluctant go
for the exception if it is really needed.

Arne
 
A

Arne Vajhøj


But please note that you do not invent your own JSON parser
either - you use something already done. In Java there are json.org,
gson etc..
and, in fact 10Hz asynchronous throughput is possible... (this is
typically how most online gaming works).

one can't reasonably get 10Hz synchronous (IOW: request/response), due
to ping times, but this is a different matter.

I am not claiming one can do request/response at 10Hz, as this probably
would be impossible over a WAN (at reasonable ping times).

online gaming generally isn't based on request/response though, so the
problems of not being able to get responses at this rate don't really
matter too much (the user may still notice the results of bad ping
times, namely stuff being out of place or seemingly teleporting around
or similar, but this is a different issue).

TCP has a throughput limit due to ping, where assuming unlimited
bandwidth but a 200ms ping, one will still be limited to somewhere
around 320kB/s or so (assuming a 64kB window).

however, as is, there are typically bandwidth constraints as well (but,
they are a little more subject to fudging).

the main goal is mostly to send everything at a bandwidth low enough
that the connection doesn't risk getting backlogged (depends on internet
connection, but 16-32 kB/s seems reasonably safe, as internet radio
often tends to operate in this range, say, 192kbps is 24kB/s).

stalls are also a potential risk as well.

I can not follow you way of thinking. With multiple interactions
in parallel there are no strict correlation between latency and
throughput.

Arne
 
A

Arne Vajhøj

On 2/11/2012 12:52 PM, Arne Vajhøj wrote:
On 2/10/2012 12:43 PM, BGB wrote:
On 2/10/2012 9:51 AM, Lew wrote:
BGB wrote:
if one is using C, then it is either "write some code to do it", or
suffer with a 3rd party [sic] library dependency (one might validly
choose to
write the code themselves in this case).

"Suffer"? The XML parsers for C are well-established, very reliable,
and no
cause for suffering. Using a pejorative is not the same as
establishing a
point.

There is nothing wrong with the third-party libraries, and the
choice to
roll your own for C is rarely valid. You seem to suffer from NIH
syndrome.


they introduce porting hassles:
does one bundle "libxml" with their app on Windows;
do they use MSXML and then deal with having to switch over to "libxml"
when building on Linux?

LIBXML2 works fine on Windows, so you can use it on both platforms.


yeah, it is an option.
however, it is not a standard library on Windows (in certain cases, one
may need to provide for it, or expect anyone who wants to build from
source to provide for it, ...).

C is not standard on Windows either.

You need to get some things.

probably, but it is a question of how many things have to be worried
about as a part of getting it built (for someone wanting to rebuild from
source). if a program depends on a big pile of 3rd party libraries, it
may be harder to get rebuilt than if it doesn't.

it is arguably bad enough requiring that a particular C compiler be
installed (such as MSVC / Windows SDK), and that the program has to be
built in a certain way.

expecting the person to go download a bunch of libraries, get them
built, and put them all in the library and include paths, well, this is
adding a bit more to the cost.

You could (and probably should) checkin the libs used with
your source code!

No problems getting anything.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top