How did you start learning C++?

Pages: 1234
closed account (1yR4jE8b)
+1 chrisname

I have BiPolar Type II disorder, and when people say "Oh, that's just...." or "Just do this...", it does nothing but piss me off. They have no clue what they are talking about.
oh sry, i was sad that you were so i wrote lots of stuff :/

@darkestfright, its odd, when i piss everyone off i blame part of it on my chemical inbalance, sry dude seriously, shud see a shrink if you can afford it, i get one on the nhs cos i need one, you dont have to talk about feelings, they just dose you up and then cut your medication back to zero again slowly, unless your shrink needs to make money from you which is an american thing
Last edited on
I started programming when i was 12. The language order is as follows: Python, Java, HTML, JavaScript, C, C++, Lisp, Haskell, Scheme. Although I mostly use python, C++ and Lisp/Haskell.

@BHXSpecter: I went through what you are going through, and the only thing that got me through was to start coding again and realizing that every (even if unsuccessful) program I made, put me one (however miniscule) step towards my goals. Hope you start coding again soon :D
Mine was when I was on work placement and the company I worked for used it. I had done C/C++ all through university and learning Java was a challenging and new experience and I haven't looked back since, ever since I saw this

 
public static void main(String[] args)


compared to ugly:

 
int main(int argc, char* argv[])


C++ verbosity and memory error-proneness has turned me off since.
@rapidcoder did you just copy the OP's post?
Didn't like my op rapidcoder?
No, I did like your post, but just saying YMMV. I really started first programming C++, than moved to Java, and I feel Java is usually a little less verbose, e.g. no need to define each method signature twice - once in the header, and once in the implementation. The same about memory - while very small programs in Java do consume relatively much more memory because of JVM overhead, in large programs the memory usage typically comes close to a similar C++ program. Especially if we compare to a C++ implementation using STL, Boost and lot of smart pointers, which do have enormous memory overhead over Java compressed pointers.
Ok it just seemed you were making a joke of my post, while I agree Java can sometimes match the speeds of C++ I find that generally it can't. Also when it comes to using objects, every object is heap initialised in Java that even includes small classes that do very little. This consumes much more memory than how you could statically initialise it in C++. Also on the subject of verbosity, that is very subjective I suppose. But when it comes to header files, Java can be as verbose when you're defining interfaces to a class. Also I find
1
2
3
4
public:
    void someMethod();
    int someMethod2();
    char someMethod3();


1
2
3
public void someMethod();
public int someMethod2();
public char someMethod3();


Also things like pass by reference, pointer arithmetic, the ability to use procedural code and C functions and how iostreams are much easier in C++. The problem I find with Java is that when you're learning it before you learn C/C++ you're usually not taught about the new keyword properly and use it left right and centre whereas its fundamental to C++ and you have to properly understand it to prevent memory leaks. One thing I do miss about Java is that its String class is excellent, much more dynamic and easier to use than C++, like when you want to put an int into a string you just use the + operator as opposed to stringstreams in C++. Each to their own though mate. I wasn't downing Java, because in many instances Java is the much better choice than C++ but Java will never beat C++ for memory usage and speed, if the C++ is properly coded.
you dont have to talk about feelings, they just dose you up and then cut your medication back to zero again slowly, unless your shrink needs to make money from you which is an american thing

That's awesome. I like the way you phrase things sometimes devonrevenge.

It's true that one wants to give careful thought before advising about depression, however the advice offered here:
get more sunlight and work out specter dude

is quite valid. Any therapist worth a lick would require this (sunlight and regular moderate exercise) as these are very effective natural mood elevators.
I've seen studies concluding that those two measures have at least as great an effect as most of the psychtropic drugs prescribed for depression do (OP DO NOT read that as a suggestion to quit taking meds).
closed account (iw0XoG1T)
I took up C++ because I found a book that taught it laying around by house. I would have probably read it and tossed it, but it taught C++ without using a IDE. This was a big plus for me in those days because I find GUIs difficult--all that button pushing confuses me, while typing a line is quite simple.

Then I wanted to learn assembly because that is were the big boys play. But assembly is hard and the only books I could find assumed that you understand C. Because I had learned C++ there were some big holes in my understanding so I took to learning C.

I loved the simplicity of C so much so that I abandoned C++ and forgot that the only reason that I started to learn C was because the book I wanted to use required you to be proficient with C to learn assembly.

Then I found myself trying to solve problems in C and wanting objects. So I took up learning how to program oop in C. Then it occurred to me that it would be easier to program in this style using C++. So I came back.

I don't use C++ to its potential I use it more often than not as others would use a scripting language. Last week I came across the book I started with to learn assembly with--so now I am off to learn another language.

Really what I want to do is learn assembly--because I want to know how my computer works. I hate to have to rely on others. When I am proficient with assembly I will only be relying on others because I want too.

Here is the really sad part--even though I am not a programmer my title at work is programmer--but I am not; all I really do is write scripts that populate spreadsheets.
Last edited on

every object is heap initialised in Java that even includes small classes that do very little


It is not. Please don't spread myths.
http://www.stefankrause.net/wp/?p=64

But generally you are right. Java does not allow for such performance fine-tuning as C++ allows, but in practice if correctly used, differences are small enough that other things matter more (< 2x in most cases; e.g we found that Snappy compression in pure Java is not more than 10% slower than the reference implementation in C++, and several times faster than gzip in C). And I still sometimes use small amounts of native code together with Java - but only in those places I know they might be a bottleneck.


I'm not suggesting Java crawls while C++ runs, not at all. But where you say that its 10% slower, thats 10% can make a huge difference in many different cases. Obviously when it comes to general use software there would be no discernible difference between Java and C++ for the user but if you're talking about large scale software, like what I was working on during my placement. Whereby you had thin clients and a central main database of vms running, there was a 25% difference memory usage between using Java and C++(the company I worked for changed form Java and C# to C++) in their software so there is stats to back it up. Java has made great strides in the past few years with the JIT and general optimisation of the JVM but byte code will never beat native code in certain instances, you'd never see an operating system written in Java(only the GUI elements in Android are Java based) and there is already a C++ based OS in Haiku so it can be very fast. But you are right, Java does get a hard time but I don't personally like it as a language.

As for the link, how does the JVM do that? do you know more about it? I was always under the impression that Java created all objects on the heap. How does it know to create it on the stack?
you'd never see an operating system written in Java

I always thought this had less to do with speed and more to do with the fact that writing an OS that runs on an interpreter is a b**** to handle, as well as a lack of access to low-level features.
Last edited on
closed account (1yR4jE8b)
you'd never see an operating system written in Java


http://www.jnode.org/

Hmmmmmmmmmmm?
Oh for christ sake I've been proven wrong twice in this thread hahaha, I'm gonna hang my head in shame :( I should refrain from making comments about Java again in the future haha
Java only looks fast and scalable until a competitor finds enough money to pay a C++ developer!

Anyway, to keep this thread on topic: I picked up bits and pieces of C++ in the 90s just because it was a language, and I like learning languages, but it wasn't particularly interesting -- I was an assembly/C programmer, and my idea of fun was writing unfinished Forth interpreters, not designing object hierarchies (back then C++ was associated with OOP)

I remember being puzzled by the people getting excited about the 1998 standardization of C++. Then I ran into the first edition Effective C++, and saw that this was actually an interesting language, so I started learning it on my own for real. It also helped that, while working as an OS developer, I got to see C++ in use, by some of our clients, who were handling millions of interrupts per second between hundreds of carefully prioritized real-time threads, back in 2000. After that, it was only a matter of selecting sufficiently challenging C++ jobs, learning on the job, keeping up with new books, papers, boost libraries, and other new developments.
JNode wrote:

JNode is a free, open source Java technology based operating system implemented in the Java language with a very small assembler nano-kernel.


The kernel is assembler. And the kernel largely IS the OS, so I wonder whether it is technically a Java OS?

One could have any number of programs written in a variety of languages that interact with the kernel, so an example might be a kernel written in assembler, with a shell written in Java.

I also agree with ascii
Judging by the use of the term "nano-kernel", I'm guessing the part written in assembly is just a bytecode interpreter and some IO primitives - a tiny amount of code compared to a full microkernel, let alone a monolithic kernel.
Java can't be that bad, Bjarne says to learn it as one of the seven languages to learn.

Main page with full interview: http://bigthink.com/bjarnestroustrup
5 languages a programmer needs to know(thought it turns to 7 fast):
http://bigthink.com/bjarnestroustrup#!video_idea_id=23030

Though it was from 2010, but could it have changed so drastically in 2 years?

His list C, C++, C#, Java, Python, Ruby, and Javascript (for those who don't want to watch it).
Java's great and all, but there are areas that really need to catch up with the times if it's going to continue to be a serious technology.

I started learning C++ when I found myself maintaining a Java webserver framework that suffered from 10 minute pauses while garbage was being collected the heap was being compacted *fixed. I rewrote that framework in (bad) C++ (as it was my first serious attempt with the language), and it's worked great running 24/7 ever since.

Footnote - the previous maintainer just kept putting more RAM on the server box to 'fix' the GC problem. Sure, the server would run longer before stopping, but the stop times increased as well.
Last edited on
Pages: 1234