Server Help

Trash Talk - C++ or Java?

Assassin2684 - Thu May 18, 2006 8:24 pm
Post subject: C++ or Java?
Hey, recently I have been hearing that Java is soon going to outbeat C++, in fastness and well... just plain easyer to learn yet keeping the power. Right now I personally think java is easyer because I have been working with it for a while. But anyways, what im really asking is is Java better or C++? I was origanally going to learn C++ but now im not so sure, because if java is easy to learn and is just as powerful as C++ I rather learn Java. Also I plan on making a game with one of the 2. So any help would be appriciated.
Anonymous - Thu May 18, 2006 8:58 pm
Post subject:
I prefer Java over C++, but if your going to make a big game and not something like tic-tac-toe, then go with C++. Get some things from both fields. Buinesses make software in Java. Even ATMs run on a special form of Java. Decide what field you want to go in if you want a career in programming.

Summary:

C++ = Game Design
Java = Buisness software
Mr Ekted - Thu May 18, 2006 9:41 pm
Post subject:
Java can never beat C/C++ in execution speed. Its benefit is being platform independant. When you do that, you necessarily give up speed. That being said, I've seen some pretty snappy Java apps, but they surely aren't doing a lot of data processing in the "Java layer".
SamHughes - Thu May 18, 2006 11:22 pm
Post subject:
They're both crappy languages, and in that sense, picking them is like picking presidents. Anyway, Java was designed for average programmers, so if you want to become an average programmer (and you shouldn't), maybe that's the language to go with.

Fortunately, while you only get one choice for presidents, I don't see what is stopping you from learning multiple languages. They're not religions (except Ruby).
Cerium - Fri May 19, 2006 4:09 am
Post subject:
...

Or perhaps Java was designed to be powerful for developing applications in RAD enviornments that will run on multiple platforms with minimal recoding. But hey, dont let me get in the way of your zealot-like opinion.

So, since youve 'nixed' two extremely popular languages that have possibly the largest user base (for lack of a better term); tell me, oh wizard, what you use when developing your uber-l33t appz.
SamHughes - Fri May 19, 2006 8:00 am
Post subject:
Hey, I'm just repeating the words of the guy who designed Java. What are you going to do, get all offended at me?

And I'm not a wizard. Whatever that is.
i88gerbils - Fri May 19, 2006 9:10 am
Post subject:
So you're telling us you quoted someone and failed to give them credit in your post? That's bad form. Normally we use quotation marks and put the man's name or the source's name in paranntheses (or footnotes if you want to bother with subscript and chicago style). Also acceptable only in forum environments is to use the QUOTE block tags.
SpecShip - Fri May 19, 2006 11:19 am
Post subject:
Assembly FTW?

I'm with C++ > Java.
(Deactived B l a h e r) - Fri May 19, 2006 4:31 pm
Post subject:
If you want to program for both windows and macintrash (I wouldn't see why you would, in the first place), I would go with java since it has a run time enviroment for most Operating sytems out there. But for over all power, a OO language, and managbility, I would choose C++ over Java.
Java was the first one built with .NET in mind, and then .NET came out and it was incoperated into C++ compilers, so there is really no need for Java, since VC++.NET has a little newer features.
Cyan~Fire - Fri May 19, 2006 5:20 pm
Post subject:
blah-er wrote:
Java was the first one built with .NET in mind


You obviously still have no clue what you're talking about.
SamHughes - Fri May 19, 2006 7:38 pm
Post subject:
i88gerbils wrote:
So you're telling us you quoted someone and failed to give them credit in your post? That's bad form. Normally we use quotation marks and put the man's name or the source's name in paranntheses (or footnotes if you want to bother with subscript and chicago style). Also acceptable only in forum environments is to use the QUOTE block tags.


I did not say verbatim.

And FTR, Java and C++ are two of the best languages out there. (But they're still crappy.)
Cerium - Fri May 19, 2006 9:37 pm
Post subject:
blah-er wrote:
If you want to program for both windows and macintrash (I wouldn't see why you would, in the first place), I would go with java since it has a run time enviroment for most Operating sytems out there. But for over all power, a OO language, and managbility, I would choose C++ over Java.
Java was the first one built with .NET in mind, and then .NET came out and it was incoperated into C++ compilers, so there is really no need for Java, since VC++.NET has a little newer features.


What in the hell are you even talking about? Im seriously curious what goes on in that mind of yours to make you actually hit submit after typing that pile of shit. Do you actually believe what you wrote, or are you just trying to fit in? I dont understand why you -- or anyone -- types something so horribly inaccurate and thinks theyre actually being helpful.
<insert obligatory 'kill yourself' comment here>.

Edit:
Im begining to wonder if blah-er is actually Qndre.




SamHughes wrote:
I did not say verbatim.

And FTR, Java and C++ are two of the best languages out there. (But they're still crappy.)


Stop skirting the goddamn issue and stop trying to talk down to everyone. If C++ and Java are terrible, than what is your definition of good? Stop being so fucking ambiguous.



Christ, you and blah-er are like polar opposites. Having both of you reply in the same topic should cause the server to explode; its a miracle that it hasnt happened yet.
SpecShip - Sat May 20, 2006 3:34 am
Post subject:
Cerium wrote:
Im begining to wonder if blah-er is actually Qndre.


You actually had a doubt?
Assassin2684 - Sat May 20, 2006 9:15 am
Post subject:
Thanks guys, you helped me alot. I guess im going to go with C++ then. Im going to break out my old book this summer and start reading agin.
SamHughes - Sat May 20, 2006 9:23 am
Post subject:
Okay okay! In these languages, you have to write the same things over and over again. How many times have you had to write "for (i = 0; i < n; ++i)"? And why can't you make a shortcut for that? Java does have a shortcut for that, in fact, but not C++. You're limited to the shortcuts that are built in to the language.

And I'm not talking down to anybody.

In some languages, like Scheme, or Lisp, you can make shortcuts for that. Since every program in Scheme is just a list of lists, it is straightforward to add these things. It's part of the language, and it's a way of doing things. (It's completely better than C's preprocessor.) For example, you could add the keyword 'for' to the language so that "(for i (range 0 5) ...do stuff...)" becomes valid syntax. (And "(for x (in some-vector) ...do stuff...)" would work too.) But Scheme has many of its own problems (in that it sucks, and everybody does everything differently).

So ok, there are some issues like having to write things out, but that's not so bad. But there are other things C++ and Java lack. Like the ability to make procedures, pass them between functions, and return them, catching all the variables in lexical scope. E.g. in Javascript:
Code: Show/Hide
function greeter(greeting) {
  return function (name) {
    print(greeting + ", " + name + "!\n")
  }
}
var x = greeter("Greetings")
var y = greeter("Hello")
x("Earthlings")
y("world")


Each procedure captures the variables defined in its lexical scope, so x's "greeting" is different than y's "greeting". C procedures, with static variables, are like singleton versions of what's here.

In C++, they call these 'objects', which are less flexible but good in many ways.
Code: Show/Hide
struct greeter {
  std::string greeting;
  greeter(const std::string& s) : greeting(s) {}
  void operator() (const std::string& greetee) {
    std::cout << greeting << ", " << greetee << "!\n";
  }
};
Code: Show/Hide
greeter x("Hello");
x("world");




Okay, just imagine C++'s <algorithm>, only without the headaches. For example, what would be in C++,
Code: Show/Hide
vector<int> foo;
...
vector<int> bar;
transform(foo.begin(), foo.end(), back_inserter(bar), some_function);

would look more like this if C++ borrowed from other languages:
Code: Show/Hide
// the type of foo is figured out implicitly
...
let bar = map(some_function, foo);


Using a few of these things, especially map and for-each procedures, makes the code much more readable than nested for/while loops filled with declarations and assignments, and caters much more towards human thinking. C++ and Java are designed more around making it simple to compile. Which is useful and is why C++'s existence makes sense, since many times, well-organized low-level programming is needed. But Java doesn't make sense; it's basically (C++) + garbage collection + libraries + marketing - operator overloading, and still, all the code you write is tailored to the compiler, not to the way humans think. Java as in the language isn't very good; Java as in the JVM is good.

Right now, I'd say that Haskell is one of the best languages. It's a pretty weird language (the weirdest relatively well known language meant for practical use?). So I wouldn't be surprised if people disagreed with me. But, for example, it took about 35 minutes to write a program that finds all solutions of the n queens problem in C++, only 5 in Haskell.

If I wanted to write a program that printed the first 10000 prime numbers in Haskell, first I'd write a function, 'primes', that returns an infinite list of all the prime numbers (using the sieve of Eratosthenes). Then the main function takes the first 10000, converts them to strings, appends newlines, and prints them out:
Code: Show/Hide
primes = filterComposites [2..]
    where filterComposites (n:ns) = n : filterComposites (filter (indivisible n) ns)
          indivisible n x = (0 /= x `mod` n)

main = mapM (putStr . (++ "\n") . show) (take 10000 primes)


An infinite list is possible because Haskell uses lazy evaluation, meaning that expressions are only evaluated when their value is needed. Then, (putStr . (++ "\n") . show) returns a function that takes a number, and converts it into the outputting of that number (with a newline). (That's one way to think about it.) Then mapM combines those all into one IO () object.

Yes, this seems like a crazy way to think. (Because, well, it is a crazy way to think.) But it works and is surprisingly productive. More and more people are coming to this conclusion, and so the language has had an explosion of growth. (When you start near zero, everything is an explosion!)

What's above doesn't look very readable to somebody just looking at it, since, well, I didn't design it with that in mind. But it is readable to anybody who uses the language. (And it's as readable to you as std::cout << "Hello, world!" << std::endl; was the first time you saw that.) But this is because in the code above, there's no extra syntax, no variable declarations. Every single character there is either whitespace, an equals sign, a parenthesis, or part of the name of a function or datastructure. Just for another example, here's one other example, of how to define a factorial function, and then that greeter from before:

Code: Show/Hide
factorial 0 = 1
factorial n = n * factorial (n - 1)

greeter g gee = putStr (g ++ ", " ++ gee ++ "!\n")

programmerGreeter = greeter "Hello"

alienGreeter = greeter "Greetings"


It doesn't get simpler than that.
Cyan~Fire - Sat May 20, 2006 12:17 pm
Post subject:
What makes those preprocessors you were talking about so much better than C's? What's wrong with
Code: Show/Hide
#define MYFOR(max) for(i = 0; i < max; i++)

or some variant?
SpecShip - Sat May 20, 2006 3:17 pm
Post subject:
So basically, his complaint being that upper ring program languages aren't user friendly enough like the lower rings to simplify things for him, like having macros?
Just create your own compiler or something then... :rolleyes:
Anonymous - Sat May 20, 2006 6:08 pm
Post subject:
He's just a whiney lazy bitch. icon_smile.gif
Mr Ekted - Sat May 20, 2006 8:45 pm
Post subject:
The reason low-level languages like C don't have dynamic types is because of run-time speed. That is why they are so damn fast. There's no checking going on for every line of code, every expression. Yes, that's more dangerous when you have inferior coders, but it's a trade-off.

The reason for (i = 0; i < max; i++) is not hard-coded into C is because that is only one of the many ways to write it. The for statement can be used in any generic way you want:

Code: Show/Hide
for (;; i++)

Code: Show/Hide
for (i = 7;;)

Code: Show/Hide
for (; i < 22;)

Code: Show/Hide
for (a=3,b=12;c < 14 && d > 9; calc(), build(), e += 3)

(Deactived B l a h e r) - Sat May 20, 2006 8:51 pm
Post subject:
Cerium wrote:

Christ, you and blah-er are like polar opposites. Having both of you reply in the same topic should cause the server to explode; its a miracle that it hasn't happened yet.

That's my main goal. icon_confused.gif

And what I said came out of my C++ and Java books, so I'm guessing it's wrong...
I think what I meant to say is that Java was the first of it's kind or something and it lead into the .NET framework, but that's just me.

And no I'm not quan, but he's my idle (just messing yo fools).
SamHughes - Sat May 20, 2006 8:52 pm
Post subject:
The macros in Lisp are better because they're like regular functions. They take an expression (a list) as an argument, and return another list (another expression), and this is done using Lisp code itself. You have complete freedom to rearrange expressions. C's preprocessor is mostly string-based pattern replacement, and run before the actual compilation pass. With Lisp-type macros, you could, for example, add object-orientedness to the language, completely mimicking the organization of C++. Depending on which variant of Lisp you're using, you could, for example, add Perl-style regular expression syntax to the language.

Hookeralla79 wrote:
He's just a whiney lazy bitch.

I am probably whiney, but I don't see what is wrong with being lazy. icon_smile.gif

SpecShip wrote:
upper ring ... lower rings

What are these 'rings'?
Cerium - Sun May 21, 2006 10:38 am
Post subject:
blah-er wrote:
And what I said came out of my C++ and Java books


No it didnt; shut up and die already, stupid.


Sam:
The others pretty much covered what I was going to say. I think youre expecting too much to be done for you without having to give something up. But hey, heres to dreaming...
Cyan~Fire - Sun May 21, 2006 10:51 am
Post subject:
So you're saying C's macros suck because they aren't functions. OK, how about a function? Or possibly an inline function?
Dr Brain - Sun May 21, 2006 11:34 pm
Post subject:
For the record:

1. Java can do some things faster than C++ because it's interpreted (if you find this hard to believe, think for a moment). For most practical applications running server side, a Java based program runs just as fast as a C++ based one, and can be developed much more quickly.

2. The rant about "for each" left out the fact that Java 5 has that functionality.

Also, People who like to skimp on typing by making something a macro are just asking for trouble.
Muskrat - Sun May 21, 2006 11:51 pm
Post subject:
To me, using a macro would be primarily to help make the code readable.

I'd say that Java's main strength is being, as Brain said, much faster to develop programs under; a strength too often scoffed at.
Mr Ekted - Mon May 22, 2006 12:12 am
Post subject:
Dr Brain wrote:
1. Java can do some things faster than C++ because it's interpreted (if you find this hard to believe, think for a moment).


Done thinking. Give me a clue.
Dr Brain - Mon May 22, 2006 11:48 am
Post subject:
If there is only one non-abstract class in existance of a certain superclass, Java doesn't have to do virtual function table lookups, it just compiles the function pointer straight into the code (or inlines it). Of course this compiled code is discarded by the JVM if another non-abstract class comes into play. But with C++, a virtual function always involves a virtual function table lookup.

EDIT: was missing a word
Mr Ekted - Mon May 22, 2006 5:15 pm
Post subject:
Ok, but that's hardly a reason to use Java "for speed". It's still slower overall in every way from a functional point of view.
Dr Brain - Mon May 22, 2006 6:03 pm
Post subject:
No, but JVMs are getting smarter every day.

The difference between a console Java program and a C++ one is not notacable except in certain rare circumstances (doing extremely varied computations (just a simple computation over and over would get compiled to native by the JVM and run the same as C++)).

The differences between C++ and Java GUIs *is* humanly noticable, but this is where I point out that Java GUIs can be developed in a fraction of the time. Unless you're coding professionally (and sometimes even then), the slower GUI is quite worth the quick development time.
Cyan~Fire - Mon May 22, 2006 7:10 pm
Post subject:
Brain wrote:
The differences between C++ and Java GUIs *is* humanly noticable, but this is where I point out that Java GUIs can be developed in a fraction of the time. Unless you're coding professionally (and sometimes even then), the slower GUI is quite worth the quick development time.

Which is why I really don't understand the current trend towards Java servers.
Dr Brain - Mon May 22, 2006 7:26 pm
Post subject:
The server side JVM is extremely good at what it does. Server programs run for a long time, so the JVM actually takes the time to compile and heavily optimize the native code it generates. This means that for all intents and purposes the server side programs run every bit as fast as C++ programs, but with all the niceities of the Java language.
SamHughes - Mon May 22, 2006 8:39 pm
Post subject:
Cyan~Fire wrote:
Which is why I really don't understand the current trend towards Java servers.


Where do you think the bottleneck on the server side is? It's not the programming language, it's the network and storage. There's no point in skimming a few microseconds off the time it takes to call some 10 ms database query, if it requires any amount of extra human labor.
SpecShip - Tue May 23, 2006 4:36 am
Post subject:
You can lead a horse to water, you may even force it to drink but all the kick ass games and their servers are still being made in C++ and runescape is gay java crap that UO laughs about at nights.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group