Which language is better to learn? C++ or Java?

Ingemar Wrote:All three are badly designed languages, locked into design flaws (hacks) made by K&R in the early 70's.

Interesting argument! I can't say I disagree with the idea that they're all "locked" into the hacks by K&R (which of course they did a great job of at the time). What would you say is the language direction you would take today?

Personally, after having tried a whole bunch of them, including various scripting languages, and even creating my own, I still like C the best, although it is admittedly lacking other features I wish it had. Objective-C adds some stuff I would like but doesn't go all the way, and 2.0 was a step backward IMHO. C# is really nice but runs in VM. C++ goes way past where it should have been targeted. I just don't see anything that I can honestly think about as the future of computer languages yet.

For me, FPC is best. GNAT is my second choice. But for this voting, my answer is rather: Don't learn a programming language, learn to program! Learn at least half a dozen languages. And don't just learn a few dialects of the same thing. Learn both procedural, functional and object-oriented programming, and don't listen to all the people who say there's only one way.

It's a C-like scripting language. I learned how to make it from the book Game Scripting Mastery (no, it's not the same one as in the book). It worked, but it isn't very robust, and it isn't finished, and I haven't further developed it in years. I was going to add some object orientation to it, but I never got around to it. It was a fun exercise though, and I learned a lot. I'd highly recommend that book to anyone who's interested.

AnotherJake Wrote:It's a C-like scripting language. I learned how to make it from the book Game Scripting Mastery (no, it's not the same one as in the book). It worked, but it isn't very robust, and it isn't finished, and I haven't further developed it in years. I was going to add some object orientation to it, but I never got around to it. It was a fun exercise though, and I learned a lot. I'd highly recommend that book to anyone who's interested.

Yes, that definitely sounds like a good exercise.

I did something that might be similar once, an interpreter. It worked but never got really useful by its own, but then I took the central parts of the parser and reused it for an expression parser, a "smart calculator", and it is great, one of the most useful tools I ever made!

I like straight C, simply because it generally makes obvious the things that are hidden away in other languages. Almost everything that could possibly go wrong is pretty explicit. Like anything else, it could use a nice cleaning of syntax, because it can get very ugly at times.

I did an 8(intended, was really 6 because I didn't finish) opcode VM once, I was trying to see how many operations were needed to make a Java-strength language. It operated like a tagged-memory stack machine using all sorts of assumptions to make it fast.

I never wrote a compiler for any language I felt like making. I may try at it again soon.

Oddity007 Wrote:I like straight C, simply because it generally makes obvious the things that are hidden away in other languages. Almost everything that could possibly go wrong is pretty explicit.

No offense, but that is absolute bollocks. C, in and of itself, has absolutely no runtime safety mechanisms, but YOU have to be explicit about checking every potential source of error, and the compiler and type system aren't any help, either.

So yes, in a way you are right, everything that can go wrong, will go wrong in C, explicitly so. Pros and novices alike are liable to make a lot of mistakes, and clever programmers tend to make even more clever mistakes, which often end up hiding in plain sight.

You may like the languages or not, still C & C++ compilers make the fastest executables around, and by far.

The "speed doesn't matter nowadays" thing may be true for desktop apps, but for games you often have to push things to the edge to stand out from the crowd, and for embedded games you need all the speed you can get.

Sure python or java may be more elegant, but until they get comparable speeds they're not an option I will consider.

Najdorf Wrote:Sure python or java may be more elegant, but until they get comparable speeds they're not an option I will consider.

Throw C# in there too, for me -- although I *love* the language.

I definitely prefer the languages that ride on the bare-metal all the way, or as much as possible. The elegance of the language itself *does* count, but I'm with you on the instant access to raw performance thing.

Still, you'd think by now we'd have a better wide-spread option for a "bare-metal" language than C/C++. c'mon, where's the future?!

[edit] And another thing: Why TF are we still stuck in "text mode" programming? I mean, man, we've got all this massive programming power available to us where we can drag and drop and organize and stuff, and nobody has nailed a truly visual system of programming that takes advantage of other forms of human perception. Like for instance, one thing that really irritates me about C/C++/etc. is that it's sometimes a pain to read other people's code. It would be so nice if what I was looking at was standardized, and I mean that in a graphical sense, like how a spreadsheet is standardized. I don't know if that makes any sense.

And I don't mean no wannabe graphical programming language, as in drag and drop objects that relate to an existing "text"-based language, but a visual language at it's core that compiles directly to machine language and has no text intermediate.

AnotherJake Wrote:[edit] And another thing: Why TF are we still stuck in "text mode" programming? I mean, man, we've got all this massive programming power available to us where we can drag and drop and organize and stuff, and nobody has nailed a truly visual system of programming that takes advantage of other forms of human perception. Like for instance, one thing that really irritates me about C/C++/etc. is that it's sometimes a pain to read other people's code. It would be so nice if what I was looking at was standardized, and I mean that in a graphical sense, like how a spreadsheet is standardized. I don't know if that makes any sense.

And I don't mean no wannabe graphical programming language, as in drag and drop objects that relate to an existing "text"-based language, but a visual language at it's core that compiles directly to machine language and has no text intermediate.

The longer I use computers, the more I prefer working on the command line and with text-only formats. There are simply too many ways for a binary format to invisibly go wrong. With a textual format, you can see any mess you've accidentally made in the file and clean it up quite easily. Any time I'm using a graphical editor on a file that has no underlying textual representation (and even on some that do, if they're convoluted enough, like Xcode project files), I can't help but feel like there are things in the file that aren't directly exposed to me for editing. It's a big pressure on the developer of the graphical tool to properly expose each piece of their binary format to the user in an editable manner; with text, it's so easy to get right that you don't even need to worry about it.

AnotherJake Wrote:Like for instance, one thing that really irritates me about C/C++/etc. is that it's sometimes a pain to read other people's code. It would be so nice if what I was looking at was standardized, and I mean that in a graphical sense, like how a spreadsheet is standardized. I don't know if that makes any sense.

In my opinion, I think a code "visualizer" might be more appropriate. I know what you mean: coding style is so idiosyncratic that it sometimes make code look like a pile of gibberish (I definitely see a lot of C and C++ code like this). So if there was some kind of tool that could let you view and understand code on a higher, more abstract level, effectively normalizing code from whatever crazy style it was written in, I think that would achieve the same goal without abandoning the text format altogether.

(Of course, there's probably already some kind of tool just like that out there somewhere that I'm not aware of.)

Setting storage and reliability issues aside for a moment, I wouldn't necessarily be opposed to the idea of a completely visual programming environment, in theory. However, it would have to be very streamlined: I'd probably get frustrated using an entirely visual environment if it made development slower or more cumbersome than with text.

AnotherJake Wrote:Throw C# in there too, for me -- although I *love* the language.

I definitely prefer the languages that ride on the bare-metal all the way, or as much as possible. The elegance of the language itself *does* count, but I'm with you on the instant access to raw performance thing.

Still, you'd think by now we'd have a better wide-spread option for a "bare-metal" language than C/C++. c'mon, where's the future?!

[edit] And another thing: Why TF are we still stuck in "text mode" programming? I mean, man, we've got all this massive programming power available to us where we can drag and drop and organize and stuff, and nobody has nailed a truly visual system of programming that takes advantage of other forms of human perception. Like for instance, one thing that really irritates me about C/C++/etc. is that it's sometimes a pain to read other people's code. It would be so nice if what I was looking at was standardized, and I mean that in a graphical sense, like how a spreadsheet is standardized. I don't know if that makes any sense.

And I don't mean no wannabe graphical programming language, as in drag and drop objects that relate to an existing "text"-based language, but a visual language at it's core that compiles directly to machine language and has no text intermediate.