Hello /prog/, professional shitposterTM here. One of my Cisco classes for the second 8-week session of this semester was canceled due to low enrollment, and there aren't any other open Cisco classes for me to take, so I was thinking that I'd take a programming class. However, due to my schedule, and the fact that not all classes are open anymore, my only options are either a class on Java or one on C++. Which one would you suggest that I take?
I know regular expression, can make some simple bash scripts, and I mainly work with Cisco IOS and GNU/Linux in my networking classes, so although I don't know a whole lot about programming, I'm not exactly tech-illiterate either.
inb4 read SICP
no classes which fit into my schedule teach Lisp, so that's not an option
>>2
C is possibly worse. C++ is more practical for the most part. Unless you were making little toy programs, the choice would be C++ over C for most people.
Don't bother asking /prog/ for advice. Nobody here actually knows C++ or Java, and you should hence ignore unsubstantiated claims such as "Java is slow" or "C++ is shit". The best path is to research the pros and cons for yourself, but here's a basic summary.
C++ and Java are two very different beasts, but it really only comes down to one thing: are you planning on getting a job as a programmer, or is this just a side-interest?
If you want to get a job writing code for a living, take the Java course. Java is the de-facto language that most large companies use. This is because Java offers a lot in the way of productivity and 3rd party tools, which allows their programmers to write less error-prone code in less time.
Also, Java runs on what is called a VM (Virtual Machine). This means that your program will be (theoretically) portable across all platforms that the underlying VM is written for.
Java utilizes a built-in GC (Garbage Collector) to clean up for you so it doesn't have to be done manually. This frees you up to concentrate on what really matters, which is the logic and structure of the program. Java is an Object-Oriented language, meaning that you will spend most of your time defining and manipulating data structures called objects in various ways.
Java's portability and safety come at a price; any given Java program will be slower than an equivalent C++ program (although optimizations to the VM and the increasing power of computers serve to make this more or less a non-issue).
If you're just interested in learning programming, I'd suggest C++. Its syntax was the base for Java syntax, so the two don't look radically different. C++ is the same as Java in that it is Object-Oriented, but you have the ability to mix different programming paradigms within a single program. This means that you are not restricted to just using Object-Oriented Programming, unlike Java, which is strictly OO. there are also some aspects of Object-Oriented Programming that it does differently.
The main advantage of C++ is its speed, and its vastly more powerful templates (though this facet can often be a double-edged sword). C++ does not use a VM like Java, and it is not garbage collected. This means that C++ programs are not portable across different systems (although its source code generally is; the distinction isn't really important for a beginner), but it is faster than Java; often quite a bit faster.
C++'s speed also comes at a price, however. It is not as safe as Java's sandboxed environment. C++ allows you to manipulate pointers, which are dangerous and can crash your program if not used correctly.
(Anecdotal: I also find that, on average, Java code is much easier to debug. The C++ compiler will often give you very cryptic errors that are hard to track down. This is in part because of Java having a simplified syntax compared to C++. Whether this is a bad or good thing, is up to you).
TL;DR: Java will get you a job. It's safer than C++, and your programs will be write once, run anywhere. It forces you to only use Object-Oriented Programming, and is also somewhat slower.
C++ is fast and is more powerful, in some cases. It can also be Object-Oriented, but doesn't force you to use OOP exclusively. It is also more dangerous, and has a slightly more complex syntax.
Name:
VIPPER2012-02-01 16:42
>>18
Thank you very much for your response. I really appreciate it. All the "hurrdurr x language is shit, use y" weren't really helpful.
Name:
Anonymous2012-02-01 16:48
>>18
That's the single dumbest thing I've read so far. Now please tell us what you do for a living.
Name:
182012-02-01 16:49
JAVA IS SHIT
C++ IS CRAZY
Name:
Anonymous2012-02-01 17:23
>>15
You're just mad because C++ is evidently more useful.
>>24
Of course you can do some acrobatics to work around it, but the fact that there's any barrier to writing procedural code at all is telling, don't you think?
>>27
Let's start with the fact that you can't define a freestanding function. It *has* to be wrapped in a class.
Name:
Anonymous2012-02-01 22:01
>>28
THINK OF CLASSES AS NAMESPACES, THERE HAS TO BE SOME DEFAULT NAMESPACE WITHIN THE DEFAULT PACKAGE THAT CONTAINS STATIC VOID MAIN(...) AND THE REST OF YOUR PROCEDURAL FUNCTIONS