C++ Vs. Flash Programming
Byeka
Name changed from Freak83Toronto Join Date: 2003-03-13 Member: 14484Members, Constellation
in Discussions
<div class="IPBDescription">Which is better to learn?</div> Ok here's where I stand. I may have the chance to learn either (or perhaps both) C++ or Flash programming. Now here's what I know or at least think about them so far.
<b><u>Flash</b></u>
An internet programming tool. Most animations and online games are done in Flash. Useful for creating internet websites.
<b><u>C++</u></b>
Creating things that are not done on the internet. Software and games even such as Natural-Selection for one. Useful for programming as a career.
Am I correct so far? Anything to add? Which is better to learn? I'm interested in both at this point.
<b><u>Flash</b></u>
An internet programming tool. Most animations and online games are done in Flash. Useful for creating internet websites.
<b><u>C++</u></b>
Creating things that are not done on the internet. Software and games even such as Natural-Selection for one. Useful for programming as a career.
Am I correct so far? Anything to add? Which is better to learn? I'm interested in both at this point.
Comments
If you really really want to learn to program, take a class. It's pretty hard to get started using a book. There are a lot of concepts like OOP and general good design that's hard to hash out on your own.
PS: I could've sworn there's an Off-Topic thread, too lazy to search though (or was it comparing with Java...)
Being able to say, "I know C++" takes about 2 years.
No. Totally wrong. Flash's programming language, Actionscript, was originally based off JavaScript specifications, but has now extended to take in some of the functionality of Java. Flash can also be programmed in an OO fashion. And you can do so much more with Flash that people expect, provoding you couple it with the correct technologies (I could code an IRC client or a 3D engine in Flash, with a little PHP, its entirely possible). It is also useful, there are definately uses for people with applicable Flash knowledge (I should be doing Freelance work at the moment).
What can Flash do? <a href='http://www.box7.co.uk' target='_blank'>Check my website</a> for a small example. Those were all done very quickly also.
As for which you should learn, which interests you the most? The internet and graphical-based coding (leading to web application coding), or client applications? Or borrow a few books on Actionscript and C++, see which one looks the most fun, and go with that one.
As for "will C++ become outdated", yes, it will, but so will Flash. The object of learning how to program is not learning a specific language, but learning skills that enable you to use lots of different languages. I started with C++, switched to Flash. The languages have different purposes and uses, but they are pretty similar.
Last I heard Flash was actually based on java =o
Anyways, while flash is neat it's not exactly efficient with resources compared to well-programmed C++ so if you genuinely want to make games learn ye olde language, buuuut if you just wanna make fun lil 2D things just learn flash =3
As for the comment about C++ ruling, I tend to hold the belief that computers will become more dependent on the internet, web services, and distributed web applications, which C++ is not amazing at (I believe .NET offers this though, I havnt done much research on it). So I think its hard to predict. There are more and more people learning something like PHP/ASP as a primary language these days.
Flash could design the Half-life menus.
C++ could design Half-life.
That's the difference. Have fun with C++.
Maybe someday, when web apps stuck sucking complete arse in 99% of business apps, you will be right. Until then, people will do what they have done 90% of the time for the last 10 years of Windows computing, use VB.
And personally, I'm a lover of script-based 'semi-compiled' languages for my line of work. And thin-client based computing as a whole over the lameness that is web-based computing...
It'll be replaced by something based on C, like C# or something. Most of what you learned already will carry over. Even Java is somewhat based on C.
I just learned it this past semester (CMSC331 - Concepts of Programming Languages) so that we could implement a LISP interpreter in it... and I've grown a fair amount of distaste for the language.
It has some neat features... simple UI creation and auto-documenting are two that I can appreciate... and I'll grant that it's easier to get a semi-finished product out with Java than C++... but.......
JAVA concentrates a little too much on making sure you CAN'T do certain things. Now, in certain cases this is understandable... you don't want a little java program running in your browser to start reading or writing on your personal computer. That'd be terrible. But Java won't even let you use pointers, which I've fallen in love with!
That's not even getting into the whole garbage collection thing. I mean, yes, I understand that garbage collection is one of the trickiest aspects of C/C++, and memory leaks are some of the hardest buggers to track down... but automated garbage collection slows any java program down so much that it's unusable for many tasks. You know why there's no good java games in existance? Garbage collection is why.
The worst part of java however, in my estimation, is bytecode. I can see only one benefit to bytecode: portability. But then, purely interpreted languages have the SAME portability...
For those of you not familiar with this aspect of the language, quick refresher course. Computer languages are generally either compiled, or interpreted. Compiling translates the language directly into machine language. Not assembly, which is compiled as well, but directly to 1s and 0s. Compiling code makes that code run really fast, at the cost of, well, having to compile it when you want to have the program work. Large programs can take hours to compile.
Interpreted languages, on the other hand, are never converted into machine language. Instead, another program is run which emulates a machine that can understand the language you want to run directly. BASIC is generally an interpreted language. Visual Basic is interpreted when you run it in debug mode. This emulated machine is considerably slower than your actual box, but on the plus side, you don't have to compile it to make your code work. Good for "on the fly" programming. You get to see what you've done instantly... if you're willing to see that code run slower than your machine can handle.
So what does Java do? Both. It compiles your code into an intermediate language that humans can't understand, and then this intermediate language is interpreted. So you have the WORST of both worlds. It's compiled, which takes time, and it's interpreted, which takes more time. And that's on top of the garbage collection. Java has got to be one of the slowest languages on the planet!
This wouldn't tick me off so much if java didn't LOOK so much like C++. C++ is one of the freest programming languages around. Not the fastest... assembly langauge is faster, as is ansi C for certain specific tasks, but you get the most bang for your buck there. Freedom to shoot yourself in the foot if you want, power to access any part of the computer you need, and the speed to do it with. It's the perfect language for making programs! Particularly games... games CAN be written in other languages, but not GOOD ones. Not ones that make you go ooh and ahh and wow.
But then, application programming bores me to tears. Buisness programming is worse. Those can run slower without much problem, so I suppose java is okay for certain situations....
But that doesn't mean I can't still hate it. And show all my scorn and derision and bile towards it whenever the subject comes up.
And now off into left field...
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->but automated garbage collection slows any java program down so much that it's unusable for many tasks. You know why there's no good java games in existance? Garbage collection is why.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Would be nice to actually check statements like that. False BTW.
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->For those of you not familiar with this aspect of the language, quick refresher course. Computer languages are generally either compiled, or interpreted. Compiling translates the language directly into machine language. Not assembly, which is compiled as well, but directly to 1s and 0s.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Most compilers use at least one intermediate form before producing machine code, so "directly" is misleading.
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Compiling code makes that code run really fast, at the cost of, well, having to compile it when you want to have the program work.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
"can make the code run comparatively faster on a single type of computer" is more accurate there. Platform-specific optimizations are much more available to a locally interpreted language -- hence the move toward general shader languages in graphics.
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Large programs can take hours to compile.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
In most cases the overhead is linking rather than the actual compilation phase. The two do tend to get fuzzed together, but it is not horribly difficult to speed things up with modern (i.e. not C++) structured languages.
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->So what does Java do? Both. It compiles your code into an intermediate language that humans can't understand, and then this intermediate language is interpreted.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
So the runtime is independent of the language and it is non-trivial to modify a distributed program. Sounds like a plan...
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->So you have the WORST of both worlds. It's compiled, which takes time, and it's interpreted, which takes more time.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Except the compilation runs very quickly because there is no linking phase. Try Jikes some time... Except for the variety of JITs and bytecode-to-native compilers floating around. Some of the most interesting research in optimization of object-oriented languages works based on using run-time metrics; and reorganizing raw machine code based on those results is not something I'd want to get stuck implementing.
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->And that's on top of the garbage collection. Java has got to be one of the slowest languages on the planet!<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
In my experience, only when someone doesn't know what they are doing. Unfortunately Sun's engineers are guilty of this as well -- compare Swing with the eclipse.org SWT package.
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->games CAN be written in other languages, but not GOOD ones. Not ones that make you go ooh and ahh and wow.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Har har. Having had the priviledge of optimize C++, it's time for the performance-minded industrial programmers to go back and learn how to use C.
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->But then, application programming bores me to tears. Buisness programming is worse. Those can run slower without much problem, so I suppose java is okay for certain situations....
But that doesn't mean I can't still hate it. And show all my scorn and derision and bile towards it whenever the subject comes up.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
And I suppose this is the root of the problem. Let's exclude all the areas in which a safe language executed from an intermediate form has advantages, and it does not work very well. Let's ignore the other technologies to transform the intermediate form to something with higher performance. Come on...
For the web, server-side stuff is the way to go. PHP is pretty nice although it's a messy language IMO. Don't use JavaScript heavily since it's client-side, not to mention that browser seem to disagree on what's valid JavaScript.
Fieari, Java has gotten a bad reputation for being incredibly slow. That was true a couple years ago. Nowadays, we have pretty good JIT compilers, and Sun has sported the Hotspot technology since 2000 (I think). Here's a really good <a href='http://www.aceshardware.com/Spades/read.php?article_id=153' target='_blank'>article</a> concerning Hotspot and JVMs in general. Java is still slower than C++, but it's not orders of magnitude slower now.
The goals of Java are:
1) reducing the chance of programming error
2) portability (which seems to be rather unappreciated)
3) being suitable for developing large and complex applications in which it would be convenient to ignore mundane details like memory leaks.
It's not supposed to be used for applications that require heavy optimization.
Nevertheless, I agree that Java feels rather limited. While it's possible in Java to do most things that you can in C++, it's object-oriented strictness makes it cumbersome. For example, passing functions (via adapter interfaces) as arguments is awkward and makes for unintuitive looking code. The lack of generics (e.g. C++ templates) results in a bunch of typecasts that wouldn't be necessary in C++.
I'm tempted to switch to C#. Microsoft's .NET is similar to Java in that it's a 2 step process (compile into byte code, interpret byte code), but there is 1 notable difference: Java is only 1 language and is OS-independent, while .NET works on 1 operating system and is language-independent. I'm not sure I want to sacrifice cross-platform portability and I only intend to use 1 .NET language (C#).
Nevertheless, I've read the specification of C# and it looks very promising. I like how it combines the useful features of previous languages - it's basically a more flexible Java that includes the concept of delegates (think safe function pointers) from Delphi. IMO, the best feature is that primitive data types (like int and float) are derived from a base object class without performance issues - no more awkward adapter classes! However, C# lacks generics (templates). I think I'll wait until the next specification of C# is released, which will support generics.
Yepp, binary trees, linked lists and function pointers are teh pwn!