r/cpp • • Aug 25 '21

Experience C++ developers: do you enjoy using C++ (even for personal/hobby projects?)

Do you actually enjoy using C++, or do you only use it for work, or purely for performance? This question is aimed at people with years of experience, who've worked on large projects in C++. I see people who dislike the language, but use it purely for performance reasons. This sort of discourages me from learning it. I don't want programming to feel like work.

204 Upvotes

327 comments sorted by

View all comments

Show parent comments

9

u/gnosnivek Aug 25 '21

> why not just use C?

This is actually a really interesting question that I haven't thought about. I wonder if schools feel like they have to give both a low-level and high-level introductory programming experience, don't want to have one class for each, and fall back to C++ because you "can" do both in the same language.

I remember trying to tutor a student who was taking a C++ intro programming class, and after going through classes, constructors, inheritance, operator overloading, and some basic data structures, the class suddenly went "now for your final project, write a game of life simulation using only C constructs (arrays, malloc/free, printf)"

It was a gratuitous turn into "low level" programming (low level in massive air quotes here) and I wonder if that was there because someone said "well we need to make sure the students have experience with C before moving on" and nobody was willing to commit to actually having a quarter to properly teach it.

6

u/[deleted] Aug 25 '21

[removed] — view removed comment

2

u/SirClueless Aug 25 '21

I think it can work. At my university, they teach a freshman course aimed at future CS majors in Java, and in your sophomore year you have two courses you can take in either order taught in Java (Algorithms) and C and Assembly (Programming Systems) respectively.

It works out pretty well, I think. I firmly believe that anyone looking to be a software engineer should take a class taught in C at some point in their life, but it doesn't have to be your introduction to programming.

2

u/jk-jeon Aug 26 '21

Here is my perspective.

I started programming with VB6 when I was 11 yo and it was a lot of fun. I learned C after that and eventually abandoned VB6 in a few years because it looked like everyone was regarding VB6 as "a children's toy". But when I first learned C, the console and CUI thing looked boring and pointless since I could make more decent-looking GUI's with VB6.

My point is that, it really depends on the audience. If "the first course" is for children of age 4-9, do you think C will be more effective than something like Scratch? Or, how about the first course in university for students not majoring in CS?

Another point is this. For me, even after learning C, computer was still a total mystery until I learned a lot more details later. I mean, what the hell is monitor and keyboard, and how is it relevant to this pointer and memory thing? You know, monitor, keyboard, speaker, mouse, or whatever UI devices (and possibly including HDD/SSD?) are how ordinary people perceive computer. They don't understand why those are called "peripheral" devices. There is still too deep gap between their daily understanding of computer and what basic knowledge in C teaches them. So teaching C might not be that "touching". At least it really wasn't to me.

2

u/[deleted] Aug 25 '21

I think every student should learn and use C for a moderately complex project at some point in their life, if only to learn all the ways you can shoot your own foot with it, and get a better understanding and appreciation for what modern languages do for us.

3

u/gnosnivek Aug 25 '21

I absolutely agree. C demands a discipline unlike many modern languages and it's good to work in a no-guardrails environment just to appreciate what you really have.

That being said, I also think it's strange to detour into C at the end of a C++ intro class. Especially in the case I mentioned, the students hadn't been given the proper tools (either computational or conceptual) to successfully work with C code, and most of them just slapped things around until it (sort of) passed the tests.

1

u/[deleted] Aug 25 '21

Yes, going from C++ to C would only confuse the students, they're completely different languages.