473,545 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why doesn't C++ have comprehensive API like Java?

No, I'm not a troll, just angry. I just started learning
C++, and find it extremely lacking compared to Java.
For example, I had to write my own functions to do something
as simple as a case insensitive string comparison, and a
substring search. Then I found that there are no networking
classes to speak of (except sockets). After I thought about
it, C++ really pales by comparison. Java has a rich set of
networking classes, regular expressions, JSP, micro edition,
security classes, imaging, swing GUI, etc., etc. I can also
build executables for several different platforms with one set
of source code.

One thing that Java cannot handle is promiscuous sockets.
I began writing a port sniffer type program in Java, and
found it has no support for this. Still, I'm somewhat
disappointed with C++, and wish they would add some more
standard functionality like networking or HTTP type classes.
Well, there's my rant, I feel better now. If I'm wrong,
I just don't see it.

Jul 23 '05 #1
31 2556
somebody wrote:
No, I'm not a troll, just angry.
Nope. Anyone who shares a strong opinion with the 'net that disagrees with
mine is obviously a complete troll. ;-)
I just started learning
C++, and find it extremely lacking compared to Java.
Java is extremely lacking, period. Try Ruby.
For example, I had to write my own functions to do something
as simple as a case insensitive string comparison
Because that's just stricmp(), you might not yet know how to browse the
various documentations.
and a substring search.
strstr(). But both of those functions are essentially hacks, grandparented
into C++ due to wide use in pre-existing applications.

To write unhacked versions, you have a wide variety of locale, regular
expression, and string management libraries to choose from. Unifying all
this wealth just to put it into a single distribution would be a pyrrhic
victory. Here's why...
Then I found that there are no networking
classes to speak of (except sockets).
We are discussing 3 C++'s here. The raw C++, defined by the ISO Standard,
contains the _minimum_ that C++ implementations must implement to be allowed
to call themselves Standard. And Standard C++ should be implementable on
platforms as diverse as cell phones and satellites, so we can't ask for the
ISO committee to throw in the kitchen sink. (That's available at
www.boost.org ;)

The second C++ is the distribution you are actually using. It will come with
numerous extensions and numerous hooks into your platform. Those hooks
include locale stuff, to get case-insensitive string comparisons right
across a wide variety of locales, each with differing opinions what "case"
means.

The third C++ is the union of all the compatible libraries you could Google
for and re-use. Go nuts.
After I thought about
it, C++ really pales by comparison. Java has a rich set of
networking classes, regular expressions, JSP, micro edition,
security classes, imaging, swing GUI, etc., etc. I can also
build executables for several different platforms with one set
of source code.
Right. And that largesse limits the platforms that can run complete Java,
_and_ the platforms that can run a stripped-down version.

But you don't care; you just want to write desktop applications. That's
fine. For C++, download a library like wxWidgets.

Gee, wxWidgets comes with networking classes, regexps, JSP, security stuff,
graphics stuff, a complete GUI, etc. etc. You can also write source that
compiles for several different platforms with one set of source code.

The point is the language and the platform are different things, and
expecting each language to always support one favored platform is specious.

Now try Ruby. Because it comes with a monolithic platform, based on GNU, it
satisfies your checklist too. And this raises a new question: Unless you are
writing a new database engine or videogame engine, why are you trying to use
C++? It's not the best language for minor applications.
If I'm wrong, I just don't see it.


To put it simply: If you weren't "wrong", then a huge number of companies
who have come to rely on C++ _not_ enforcing a monolithic platform would be
completely screwed.

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand
Jul 23 '05 #2
On Mon, 02 May 2005 02:46:56 +0000, Phlip wrote:
somebody wrote:
No, I'm not a troll, just angry.
Nope. Anyone who shares a strong opinion with the 'net that disagrees with
mine is obviously a complete troll. ;-)
I just started learning
C++, and find it extremely lacking compared to Java.


Java is extremely lacking, period. Try Ruby.


I don't understand at all how you can arrive at that conclusion.
Have you seen Java's API documentation?
For example, I had to write my own functions to do something
as simple as a case insensitive string comparison
Because that's just stricmp(), you might not yet know how to browse the
various documentations.
and a substring search.


strstr(). But both of those functions are essentially hacks, grandparented
into C++ due to wide use in pre-existing applications.


Yes, I struggled my way through the stricmp() and strstr() dilemma,
and found that these were not standard functions, leading me to
write my own. C++ has been around long enough, and should have
standard classes to handle such trivial things.

To write unhacked versions, you have a wide variety of locale, regular
expression, and string management libraries to choose from. Unifying all
this wealth just to put it into a single distribution would be a pyrrhic
victory. Here's why...
Then I found that there are no networking
classes to speak of (except sockets).
We are discussing 3 C++'s here. The raw C++, defined by the ISO Standard,
contains the _minimum_ that C++ implementations must implement to be allowed
to call themselves Standard. And Standard C++ should be implementable on
platforms as diverse as cell phones and satellites, so we can't ask for the
ISO committee to throw in the kitchen sink. (That's available at
www.boost.org ;)


Well, Java just went to Mars, and can run on cell phones and numerous
other devices, yet it has ten times the functionality "out of the box"
as C++.

The second C++ is the distribution you are actually using. It will come with
numerous extensions and numerous hooks into your platform. Those hooks
include locale stuff, to get case-insensitive string comparisons right
across a wide variety of locales, each with differing opinions what "case"
means.

The third C++ is the union of all the compatible libraries you could Google
for and re-use. Go nuts.
After I thought about
it, C++ really pales by comparison. Java has a rich set of
networking classes, regular expressions, JSP, micro edition,
security classes, imaging, swing GUI, etc., etc. I can also
build executables for several different platforms with one set
of source code.
Right. And that largesse limits the platforms that can run complete Java,
_and_ the platforms that can run a stripped-down version.

But you don't care; you just want to write desktop applications. That's
fine. For C++, download a library like wxWidgets.

Gee, wxWidgets comes with networking classes, regexps, JSP, security stuff,
graphics stuff, a complete GUI, etc. etc. You can also write source that
compiles for several different platforms with one set of source code.


I've read a bit about wxWidgets. I'm a bit apprehensive about using
3rd party libraries for any major development tasks. They could be
here today, gone tomorrow. This is the type of functionality I'd
like to see standard in C++.

The point is the language and the platform are different things, and
expecting each language to always support one favored platform is specious.

Now try Ruby. Because it comes with a monolithic platform, based on GNU, it
satisfies your checklist too. And this raises a new question: Unless you are
writing a new database engine or videogame engine, why are you trying to use
C++? It's not the best language for minor applications.
If I'm wrong, I just don't see it.


To put it simply: If you weren't "wrong", then a huge number of companies
who have come to rely on C++ _not_ enforcing a monolithic platform would be
completely screwed.


What I'd like to see are more standard classes for C++, similar to Java.
Then the functionality would be there if you wanted to use it, or not.

Jul 23 '05 #3
Val

"somebody" <so**@body.co m> wrote in message news:pa******** *************** *****@body.com. ..
| On Mon, 02 May 2005 02:46:56 +0000, Phlip wrote:
|
| > somebody wrote:
| >
| >> No, I'm not a troll, just angry.
| >
| > Nope. Anyone who shares a strong opinion with the 'net that disagrees with
| > mine is obviously a complete troll. ;-)
| >
| >> I just started learning
| >> C++, and find it extremely lacking compared to Java.
| >
| > Java is extremely lacking, period. Try Ruby.
|
| I don't understand at all how you can arrive at that conclusion.
| Have you seen Java's API documentation?
|

You can count on it that Phlip and many other C++ coders have "seen" the Java API documentation :).

But you missed the whole point.
If you don't write system applications, or low level code in general like engines, you (or anyone) shouldn't be bothered by C++ to
start with. Java has it's merits. And so does Ruby (if you like OO). But so does C++. I stick with it because I have more options
to code more OO like. More then with Java. Some coding is required, but I won't do for less. In fact, I am seriously considering
to make the step towards Ruby for desktop apps :).
Anyway, it doesn't make sense to compare the Java functionality with C++.
wxWidgets is here to stay. In fact, new developments are highly promising again. Try downloading wxDev-Cpp:
http://wxdsgn.sourceforge.net/
It has a much better GUI designer than any other commercial GUI design interfaces. Your C++ compiler would be fairly up-to-date as
well.

But it the end, it is up to you see the beauty of all kinds of programming languages.
- Val -
Jul 23 '05 #4
somebody wrote:
I don't understand at all how you can arrive at that conclusion.
Have you seen Java's API documentation?
Language advocacy is a sad USENET addiction. All languages suck. However...

Here's the Ruby code to invoke a function on another computer:

require 'drb'

class TestServer
def doit
"Hello, Distributed World"
end
end

aServerObject = TestServer.new
DRb.start_servi ce('druby://localhost:9000' , aServerObject)
DRb.thread.join # Don't exit just yet!

Here's the trivial server-side code:

require 'drb'
DRb.start_servi ce()
obj = DRbObject.new(n il, 'druby://localhost:9000' )
# Now use obj
p obj.doit
I have heard that's harder to set up and run in Java. I suspect it's
extremely difficult in C++.
Yes, I struggled my way through the stricmp() and strstr() dilemma,
and found that these were not standard functions, leading me to
write my own.
So what if they are not "standard"?
C++ has been around long enough, and should have
standard classes to handle such trivial things.
They are _supported_, meaning you are just as encouraged to use them as if
they were Standard. You are not thinking of writing a program portable to
cell phones, right?
Well, Java just went to Mars, and can run on cell phones and numerous
other devices, yet it has ten times the functionality "out of the box"
as C++.
You are still not connecting. Not _all_ of the core of Java went to Mars.
Enforcing a single platform from an ISO Standard would _limit_ that
Standard's applicability. _Not_ extend it.
I've read a bit about wxWidgets. I'm a bit apprehensive about using
3rd party libraries for any major development tasks. They could be
here today, gone tomorrow. This is the type of functionality I'd
like to see standard in C++.
Okay. You want someone else to appoint what library you _should_ use.

How can you write a program that does _anything_?
What I'd like to see are more standard classes for C++, similar to Java.
Then the functionality would be there if you wanted to use it, or not.


Sounds like www.boost.org again. Ask them why they don't do GUIs or various
other things on your list...

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand
Jul 23 '05 #5

somebody wrote:
On Mon, 02 May 2005 02:46:56 +0000, Phlip wrote:
somebody wrote:
No, I'm not a troll, just angry.
Nope. Anyone who shares a strong opinion with the 'net that disagrees with
mine is obviously a complete troll. ;-)

I learned java long time ago in college, and recently when I tried to
program in java I also hated it :) it doesn't have so many nice things
I like about c++, but I didn't go to comp.lang.java because I was angry
with java :)
I just started learning
C++, and find it extremely lacking compared to Java.


Java is extremely lacking, period. Try Ruby.


I don't understand at all how you can arrive at that conclusion.
Have you seen Java's API documentation?
For example, I had to write my own functions to do something
as simple as a case insensitive string comparison


Because that's just stricmp(), you might not yet know how to browse

the various documentations.
and a substring search.


strstr(). But both of those functions are essentially hacks, grandparented into C++ due to wide use in pre-existing applications.


Yes, I struggled my way through the stricmp() and strstr() dilemma,
and found that these were not standard functions, leading me to
write my own. C++ has been around long enough, and should have
standard classes to handle such trivial things.


Who told you that strstr isn't standard? There's a lot of libraries
around that can help you do what you want. One thing to note - string
insensetive comparision is very easy for us/english locale to write,
but is very complicated think in general for all locales
I've read a bit about wxWidgets. I'm a bit apprehensive about using
3rd party libraries for any major development tasks. They could be
here today, gone tomorrow. This is the type of functionality I'd
like to see standard in C++.

You are free to make such proposal...
The point is the language and the platform are different things, and expecting each language to always support one favored platform is specious.
Now try Ruby. Because it comes with a monolithic platform, based on GNU, it
ly on C++ _not_ enforcing a monolithic platform would be completely screwed.
What I'd like to see are more standard classes for C++, similar to

Java. Then the functionality would be there if you wanted to use it, or

not.

make this proposal as well

Jul 23 '05 #6
Val wrote:
You can count on it that Phlip and many other C++ coders have "seen" the

Java API documentation :).

Actually, I have not. I'm probably quite rare. I'm thinking of bragging at
the top of my resume, "Java Free Zone".

While I admit to a few flight hours with Java, what I know about it comes
from reading tens of thousands of posts, blog entries, magazine articles,
and books about it.

Java is one company's successful attempt to populate web browsers with a
stable and useful thick-client solution using virtual code. If Java had not
been invented just when web browsers exploded in popularity, you would never
have heard of it.

To hit that sweet spot, Java competed only with C++ and simpler languages,
like the Basics. It did not compete with Smalltalk, Perl, or the functional
languages that were investigating a new aspect of Object Orientation. Those
languages typically permit virtual methods without inheritance from a common
base. Put another way, a language with dynamic typing inherits all classes
from a magic class called Object, with the potential for every method. That
permits much faster coding (at the expense of a little runtime speed).

Next, such languages support block closures. They are are more than a
convenience: Variables must always have the narrowest scope possible, and
variables linked to a block, such as x, have the narrowest conceivable scope
over an indefinite lifespan.

To whit:

Binding events to GUI controls is the heart of GUI architecture, and the
best bindings are block closures. Not many languages provide these,
including many inexplicably popular languages designed specifically to
support GUIs. To learn about them, add an experiment to our Temporary
Interactive Test:

X = 42

oval.bind('Butt on-1') {
|event|
doc(event)
puts x.inspect()
}

Ruby statements between { and } (or begin and end) form an object, called a
block, which passes into any method on its left. That method can evaluate
the statements inside the block immediately, and can store the block as an
object, called a Proc, so something can call it later. The block links to
instances of variables seen from functions around it, such as our x, even
after such functions return. Each instance of the block links to a parallel
instance of each variable, so such variables persist until the block itself
destroys. Languages such as Perl and Smalltalk also use these "block
closures". They are more than a convenience: Variables must always have the
narrowest scope possible, and variables linked to a block, such as x, have
the narrowest conceivable scope over an indefinite lifespan.

Ruby executes the above statement by calling bind(), and passing into it a
handle to the block that starts on its right. bind() stores the block in the
oval control's private memory. Control Flow then enters Tk.mainloop(),
paints the window, and waits for hardware events. When we click on the oval,
Tk constructs an event object, and passes it into our block. It arrives in
our |event| parameter variable, and we drop it into a function called doc(),
which displays what makes it tick.

Now, why might a C++, C#, or Java user never have heard of dynamic typing or
block closures? Because really big companies push C++, C#, and Java, while
only newer, more experimental languages support dynamic typing and block
closures.

This wouldn't be such a bad situation, except that all the generic OO books
these days use Java as their reference language, "because everyone else was
doing it." So such books don't cover dynamic typing or block closures. They
limit their value, and they don't show how simple some code could be.

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand
Jul 23 '05 #7
somebody wrote:
No, I'm not a troll, just angry. I just started learning
C++, and find it extremely lacking compared to Java.
For example, I had to write my own functions to do something
as simple as a case insensitive string comparison, and a
substring search. Then I found that there are no networking
classes to speak of (except sockets). After I thought about
it, C++ really pales by comparison. Java has a rich set of
networking classes, regular expressions, JSP, micro edition,
security classes, imaging, swing GUI, etc., etc. I can also
build executables for several different platforms with one set
of source code.

One thing that Java cannot handle is promiscuous sockets.
I began writing a port sniffer type program in Java, and
found it has no support for this. Still, I'm somewhat
disappointed with C++, and wish they would add some more
standard functionality like networking or HTTP type classes.
Well, there's my rant, I feel better now. If I'm wrong,
I just don't see it.

I wonder how many times we will face this. :-)
When people mention "Java" they are actually talking about two things. The Java language
(syntax) and the Java framework (JVM). The last is open only to the Java language. So when
you are programming for the JVM you are targeting only one platform, the JVM.
If JVM was open to other languages like C++, then C++ programmers would also target it,
and thus would also have the same JVM facilities (like garbage collection etc).
This is what is happening with other virtual machine frameworks, like .NET (a CLI
compliant VM). C++ .NET applications are always targeting the framework and thus always
have the garbage collection and other facilities of the framework.
So in few words, C++ takes advantage of all facilities a system provides. If you target a
virtual machine you get all the facilities of the virtual machine, if you target a native
machine you get the facilities of the native machine.
I hope this makes things clear.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #8
On Mon, 02 May 2005 04:05:21 +0000, Phlip wrote:
Now, why might a C++, C#, or Java user never have heard of dynamic typing
or block closures? Because really big companies push C++, C#, and Java,
while only newer, more experimental languages support dynamic typing and
block closures.


I object to your assertion that only "newer, more experimental" languages
have features present as far back as the original Lisp.
Jul 23 '05 #9
Ioannis Vranos wrote:
somebody wrote:
No, I'm not a troll, just angry. I just started learning
C++, and find it extremely lacking compared to Java.
When people mention "Java" they are actually talking about two

things. The Java language (syntax) and the Java framework (JVM). The last is open only to the Java language. So when you are programming for the JVM you are targeting only one platform,

the JVM.

You are right. C++ is a language not a framework. But what prevents the
C++ community to provide a set of useful libraries as in Java, Python,
Perl, ...? I don't mean contrieved template hackery a la Boost and I
don't think that 'we' should wait and hope for the next C++ Standard
(to be finished probably in 2034). Perl has CPAN, PHP has PEAR, Python
has ... and C++ has nothing in this vein.

A.

Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2006
by: Geoffrey | last post by:
Dear Java-lovers, We need a really good charting tool for the users to do all kind of things to the graphs, but we don't have time to develop one, so we decided to purchase an existing one out there. The basic requirements are as follows: * coded in Java * source code can be purchased * includes drawing features (e.g. trend, fibonacci,...
30
1939
by: somebody | last post by:
I'm posting a new message regarding this subject, since the one posted previously is getting rather large. I just received the June 2005 issue of Dr. Dobb's Journal, and it contains an article titled "The Technical Report On C++ Library Extensions". After debating this issue with various group members, all I can say is: I Win!!! (Just...
0
7420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
731
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.