Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Omega wrote:
Gee, well, that depends. On http://www.freechess.org/, it's possible to play chess online without having any client installed, thanks to Java. That would not be possible with C++. This also ensures it is possible to do this on any operating system, as long as it supports Java.
That's really not an aspect of the Java language, it's the matter of using a VM to run it. If someone made a C++ VM and a byte code option got added to C++ compilers, you can do the exact same thing as long as you stuck to standard C++ and libs.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Joined: 11/22/2004
Posts: 1468
Location: Rotterdam, The Netherlands
Nach wrote:
Omega wrote:
Gee, well, that depends. On http://www.freechess.org/, it's possible to play chess online without having any client installed, thanks to Java. That would not be possible with C++. This also ensures it is possible to do this on any operating system, as long as it supports Java.
That's really not an aspect of the Java language, it's the matter of using a VM to run it. If someone made a C++ VM and a byte code option got added to C++ compilers, you can do the exact same thing as long as you stuck to standard C++ and libs.
That's true. When I say that Java is neat for that reason, it's only because there isn't any other way to make profound programs that will run out of the box on most machines, integrated into webpages. I don't know anything about the programming language Java itself.
Actually, is there any other way to integrate programs into web pages that will run very easily, without having to install much (or anything), while keeping compatibility with free software?
Not really. Brainfuck may be turing complete (IOW it can implement everyting that a turing machine can) but that doesn't mean it *is* a turing machine. A pure turing machine needs only 2 instructions while Brainfuck has 8.
Seriously, I have no idea what everyone keeps talking about when they say C is better, and they always refuse to elaborate when asked.
Back in the 80's everything (especially in the Unix world) was made in C and C was the pet of most programmers. Every respectable unix hacker/guru/wannabe knew how to do fancy things in C, how to kludge it to do whatever they wanted to do, and things like making obfuscated C code was fun.
Because C was very limited and didn't have OOP capabilities (except for some *really* dirty and ugly hacks which barely provided some minimal OOP) C++ was developed. At first these old C hackers approached this new language with reserved enthusiasm.
However, the major problem with many of these C hackers was that they weren't able to comprehend that C++ is actually a completely different language than C, in which things should be done differently. While it supports (almost) everything C supports, it's still a different language and programming with it should be approached in a completely different way. The problem was that these C hackers still coded C++ in the exact same way as C, just using a few of the enhanchements of C++.
Thus they started to feel that most of the new features of C++ were useless overhead. Many didn't even bother to study OOP nor these new features. Another major factor was the prejudice about the conceived speed of C++: Most of these C hackers had the misconception that C++ produced much slower code than C. (This might actually have been true 20 years ago, but any such problems have been long ago solved in C++ compilers.)
They felt alienated from their beloved C. They started to feel like C++ was C with tons of useless overhead added just because of all the OOP hype. Thus a counter-reaction to the C++ hype started arising, a counter-reaction which can be seen in many even today: They started claiming that "C is much better than C++". Of course none of the excuses they give for this claim are valid, but that doesn't stop them from defending their pet.
Personally I like to think that C++ is a completely different language from C, and that thinking that "C++ is just an enhanced C" is very wrong. Also, IMO, C sucks and C++ rules, to put it bluntly.
When you code something in C++ your basic approach is completely different from C. This is very especially true as the size of the program grows. C might be ok for very small programs (less than 1000 lines of code), but I wouldn't like to code anything bigger with it.
The advantage of C++ over C is that the former gives you the tools to make safe code (at least when obeying some basic coding pratices). It is possible to make huge programs which use lots of dynamically allocated memory, which simply don't have any danger of memory leaks nor accessing freed memory nor out-of-bounds accesses (as long as some simple coding guidelines are followed). In C it is very difficult to do that, and you are constantly in danger of those things (unless you resort to really awkward coding style which is hard to write and read).
The cool thing is that this safe code doesn't necessarily have to be any slower than the equivalent C code. In fact, sometimes you can perform behind-the-scene optimizations which make the code faster (something which would be much harder and awkward in C).
Of course it *is* possible to make unsafe code with C++, and sometimes it isn't even obvious that something is unsafe. However, experience and good programming practices usually avoid these pretty effectively. For example, I worked in a rather C++ project (as may payjob) for about 7 years as one of the two lead programmers. The entire project consisted of about 50000 lines of code, and it used dynamically allocated memory *a lot* (for manipulating directional graphs). We didn't suffer from even one single memory leak in the entire duraction of the project, ever. All thanks to good OOD, OOP and C++ programming practices.
But of course reaching this level of C++ knowledge is not easy. It requires years of experience and studying. C++ is *not* good as the first programming language. (And C is *definitely* not a good first language. I wouldn't recommend it to anyone.)
As for Java, as Triumph would say: I think that Java is a really excellent programming language... for me to poop on.
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Omega wrote:
Actually, is there any other way to integrate programs into web pages that will run very easily, without having to install much (or anything), while keeping compatibility with free software?
Not really.
You can't even depend on Java either. Some people just don't have the VM installed. Some Linux and BSD distros even refuse to bundle the Java VM because they don't like it's license and feel it's closed source or whatever.
If you do something server side you never have to worry about compatibility, but that you can't do anything dynamically on the user's side.
For client side, there's ASP, ActiveX and VB and whatever scripts from MS which no one else supports. JavaScript which is implemented differently or incompletely among various browsers, and a bit underpowered (but still useful). Lastly Java which is *icky*, and requires a VM which you can't depend on being there.
Personally if I want client side scripting I'll use JavaScript and test and tweak it on all browsers so I know it'll work right 99% of the time for people who have JS existing and enabled. But sometimes though there's just things you can't do. Sanely anyway.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
ASP ? active server pages ? on client side ? 0.o;;; you must be mistaking...
Warp wrote:
When you code something in C++ your basic approach is completely different from C. This is very especially true as the size of the program grows. C might be ok for very small programs (less than 1000 lines of code), but I wouldn't like to code anything bigger with it.
so true, that it makes me wonder if Boco was trolling or never programmed anything over 1000 lines of code... :)
I never sleep, 'cause sleep is the cousin of death - NAS
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
SXL wrote:
Nach wrote:
For client side, there's ASP
ASP ? active server pages ? on client side ? 0.o;;; you must be mistaking...
Yes, I threw that in with the other MS technology by mistake.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Joined: 11/22/2004
Posts: 1468
Location: Rotterdam, The Netherlands
Nach wrote:
Omega wrote:
Actually, is there any other way to integrate programs into web pages that will run very easily, without having to install much (or anything), while keeping compatibility with free software?
Not really.
You can't even depend on Java either. Some people just don't have the VM installed. Some Linux and BSD distros even refuse to bundle the Java VM because they don't like it's license and feel it's closed source or whatever.
Isn't there a GPL Java VM, a separate project, which works to a large degree but cannot always run programs that weren't tested on it?
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Omega wrote:
Nach wrote:
Omega wrote:
Actually, is there any other way to integrate programs into web pages that will run very easily, without having to install much (or anything), while keeping compatibility with free software?
Not really.
You can't even depend on Java either. Some people just don't have the VM installed. Some Linux and BSD distros even refuse to bundle the Java VM because they don't like it's license and feel it's closed source or whatever.
Isn't there a GPL Java VM, a separate project, which works to a large degree but cannot always run programs that weren't tested on it?
I heard about that.
However it now means Java doesn't run the same everywhere.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
I have a slightly different question and I'm now shamelessly high-jacking this thread.
I have a younger brother of 13 who I would like to introduce to the wonders of programming. What language would you suggest he starts with?
Consider things like good programming practices, ease of use, and giving some kind of result early on so he doesn't think it's boring.
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Normally I'd suggest good ol' BASIC. Although dijkstra said BASIC causes brain damage, although he also said the same about OOP.
Pick a BASIC with functions and stuff, and teach him cleanly, it should work out well.
Once you have the general programming ideas down, input, output, conditionals, loops, functions, arrays. You can then jump into C++, show him the new syntax, explain memory and pointers. Then he'd be on his way to full fledged programming. Once you know any two diverse languages, you should be easily able to pick up more on your own with a reference.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
I was very fortunate to have begun to learn programming with a language such as BASIC. Although it was far from good programming practices, it was highly motivational as it let accomplish things quickly without requiring to learn complicated things about syntax and machine internals like the languages of C and Pascal origin do.
On that perspective, in today's world, for a zero-starter of similar age I was (I was 14), I would recommend DarkBasic or Ruby or Python, with pointers to abudance of some graphically impressive simple example code.
Microsoft examples such as Nibbles and Gorilla, that came with QBasic, were highly motivational learning material to me, although I started with GW-Basic on text-based code with no examples other than those found in books.
I also had no prior experience of computers, which helped me not to get disappointed when I couldn't accomplish the same as the world's best game houses. :) It is a let-off for many programmers today; they get disappointed when they realize that it's actually impossible for them to accomplish anything that they think is the today standard for "cool" at computers. They lose all their motivation and cannot think of anything cool to create after that.
How can I be trolling by saying I prefer C to C++? I didn't say it was better, or that C++ sucked, or any of that.
Anyway I like it better because it translates pretty directly to machine code.
Of course there are a lot of better languages than C. But I like C better than C++. So?
someone is out there who will like you. take off your mask so they can find you faster.
I support the new Nekketsu Kouha Kunio-kun.
I started learning QBasic when I was 12, I believe, and for the reasons stated above, it's a great beginner's tool. I still prefer many things about it for making a simple program.
Nibbles!! I love that game.
<Swordless> Go hug a tree, you vegetarian (I bet you really are one)