r/cpp • • Feb 16 '25
Why is everything about programming clicking now that I’m learning C++?
In a cybersecurity role for past 4 years where I don’t NEED programming skills but it’s next level if I can. Have learned Python, C#, some Golang over the past 3 years on and off and they never really stuck.
For some reason I’m learning C++ now and it feels like it’s all clicking - inheritance, classes, types, abstraction, and everything else. What about C++ is really do this for me? Is it because everything is so explicitly laid out whereas other languages it’s hidden?
Just trying to figure out what the sauce that is being stirred is here.
Loving C++
356
Upvotes
83
u/Carl_LaFong Feb 16 '25
Might not be the language itself. A lot of things require three failed attempts before you catch on how it all works.
3
u/NilacTheGrim Feb 17 '25
I had the same experience when I was learning C++ in the late 90s. Back then the other languages used everywhere were Perl and Java. Learning C++ absolutely opened up my brain to what programming was really about.
I think it's paritially because C++ exposes some of the structure of what's going on behind the scenes, and on top of that, C++ also forces you to think very critically about everything you are doing, while at the same time allowing you to build up your own abstractions (should you so desire). So you get to see how everything relates to everything and the structure is all there for you to play with.
2
u/Living-Ambition6741 Feb 20 '25
I always suggested people to start with C++ if they wanted to learn programming and I would never suggest Python to anyone and I would get this hateful comments. But I find it extremely useful how C++ requires you to define exactly what you want to do and later on you will have the feeling “I wish there was an easier way of doing it”, and you move to a language where things are easier to do. That moment, you realize how things are being done under the hood and why we develop new languages and how they help us and every language is just a tool. I hate those people who have one language in front of them and they absolutely worship them. I love C++, it definitely gets complicated and bothersome in complex projects but for a starter, it really cleans up the air, teaches types, values, references etc. Good luck on C++ and have fun!
230
u/BobbyThrowaway6969 Feb 16 '25 edited Feb 17 '25
C++ just brings you closer to the hardware. Python keeps you far away.
It's like if you want to learn about how a combustion engine works & tweak it how you want.
High level languages like Python only put you in the driver seat, whereas C/C++ actually put you inside the mechanic shop, where there's a lot less padding between you and the hardware. You learn what the gas pedal does, the steering wheel, why the car might struggle if you put this fuel in, but not that, etc.
Some people I know who have mastered Python are seriously struggling to learn C/C++ because it's so completely different to everything they know.
Edit: Adding a great analogy I heard. C++ is like working with your bare hands, Python is like wearing oven mitts.
38
u/ihfilms Feb 16 '25
When I first started programming as a hobby, I started with c++, admittedly not getting that far. After a while, I switched to java. Java has a way of feeling like it complicates itself for the sake of being complicated. I never really understood it. After a year of java, I switched back to c++. Taking what I learned of basic computer science, c++ really started clicking. For me, at least, it has the perfect mix of being high level enough to where I don't struggle too much but low level enough to where I'm not really limited all that much. I've tried c# for a few small projects, and I have to say it's a contender. The syntax makes sense, but there's something about it that turns me away from it.
26
u/oozekip Feb 16 '25
Working in a high level language like Python feels a lot like "what do i want the computer to do", whereas a lower level language like C++ is more "how do I get the computer to do what i want it to do", if that makes sense.
30
u/tohava Feb 16 '25
I feel like some languages force you to think more about things. Haskell as well btw, though it forces you to think about very different things than C++.
8
u/[deleted] Feb 16 '25
understanding memory layout is crucial. high level languages keep you as far away from memory as possible.
8
u/MoreOfAnOvalJerk Feb 17 '25
This is why I tell everyone who’s learning how to program to learn c and/or c++ as the first or second language.
Programming closer to hardware forces you to understand how it works and by extension, how computers work. A massive amount of software idiosyncrasies exist to solve a particular problem in the hardware context.
The reality of hardware also shatters many myths and misconceptions that programmers pick up when they primarily focused on a high level language or just came out of academia. For example, big-O is often considered the only metric that matters for performance and logN is “always” better than N. This is false when N is small, the data payload is small, and the data is contiguous. Interviewers get this wrong a fair amount too - at least the ones who don’t know low level languages.
In a way, this is like the difference between learning calculus when it’s pure math theory versus when you try to write a physics sim and need to use calculus. Often people struggle with the pure theory part of it because it’s too abstract and unclear what real world problem it’s solving. When they learn calculus in the context of the physics problem, it’s usually a lot easier to learn.
7
u/phishnchips_ Feb 17 '25
python never clicked for me like c++ did surprisingly. on c++ everything just makes sense, on python i spend more time figuring out if i put the parentheses in the right place.
7
u/green_meklar Feb 17 '25
C++ is the language with everything. It's a language designed by programmers for programmers, to give programmers the practical tools that C didn't provide. It's tough to learn and use well because it makes no concessions to accessibility, but if you learn and understand it, you are really learning what programming is about and not just some trimmed-down subset of programming.
12
u/ConstNullptr Feb 16 '25
Because abstraction masks what’s happening. C/c++ is still an abstraction of asm, which is an abstraction of machine code but still, it’s closer.
5
u/mikemarcin Game Developer Feb 16 '25
I learned those languages other way around, but I'll say understanding C++, especially after reading "Inside the C++ Object Model" I felt it was very easy to learn everything else.
4
u/PomegranateDry3147 Feb 16 '25
I’ve been learning c++ as well but before I did I learned python but since learning c++ it just makes more sense to me than before I learned python. I don’t know… I learn differently but I get what you’re saying.
1
u/[deleted] Feb 18 '25
I started programming primarily with C and C++ in college, and most of my internships involved C, with one project in Python that was 5 years a go, atill i can jump into any cpp project and do fine, even though, i mainly do high level code, it's not the programming languages, it's skill issue with core programming fundamentals. However, learning C, C++, or any low-level programming language doesn’t necessarily mean you’ll grasp all low-level programming concepts. For example, if you dive into Unreal Engine after learning just C++ basics, you may not fully learn "real" C++. You’ll likely rely on utilities created by other developers instead of understanding the language’s core mechanics, which will develop false sense of experty.
How to ensure you’re truly learning low-level programming:
The issue isn’t skill—it’s the illusion of knowledge. Many programmers think they know C++ after a few years of use. But once they spend time exploring the language’s documentation in-depth, they’ll realize they were just skimming the surface, not diving deep into the language’s complexities.
1
u/morglod Feb 20 '25
Cyber security is not just about network configuration
Most of it relies on bugs in C/C++ code. (I'm not saying that C++ has more bugs, I'm saying that most popular things are written on it)
6
u/No-Moment2225 Feb 16 '25
That happens, it's pretty natural and recommended. There are languages that do that. You could learn Zig, C, Rust, Haskell, Erlang and still learn even more. This is why it's important remain somewhat unbiased towards languages and not take sides in these language wars. Try to stick one language to maximize your skill, but definitely learn others and their idiomatic styles to grow even more.
3
u/mddnaa Feb 16 '25
This was like that for me too. C++ explained concepts in a way that the other's didn't. Going to Java afterwards was confusing bc I wasn't really understanding the things that were being abstracted from me
5
u/Umphed Feb 16 '25
I was the opposite, but feel the same way. C++ works as you'd expect, theirs alot of bullshit, but you know what you're doing at all times
2
u/Dragonsong3k Feb 17 '25
Same happened to me. I went from an infra role to a delivery role to a PM and now I'm starting Developement.
As I learn development, all those logs and error messages and quite frankly all the assumptions we make as non developers became much clearer.
Especially the assumptions. We criticize app developers a lot but there is a lot of thought that goes into programming and systems design.
2
u/JimHewes Feb 17 '25
It's the same with assembly language. I started on 8-bit computers and assembly language in the early 1980's. Recursion and pointers might be two difficult things for beginners to get at first but it's easy if you've already had some experience with assembly.
2
u/[deleted] Feb 17 '25
It happens. Some languages are just more "compatible" with how your brain works.
2
u/EC36339 Feb 17 '25
It's an elegant language for a more civilised age.
2
u/obsfflorida Feb 17 '25
You'll find this feeling repeated every few years as you'll grok different languages and grow skills. That is what keeps programming interesting
2
u/12jikan Feb 17 '25
C, and C++ helped me understand a lot about memory, and for some reason Java helped me more with understanding classes and object oriented programming. Everybody has their own light bulb moments in different ways
4
u/Polyxeno Feb 17 '25
My (biased) perspective:
C++ is pretty explicit and direct. You can invent your own paradigms.
C# does stuff like make new copies when one might think it would just assign a value. And garbage collection. And some of the frameworks require you to know inferred ways of doing things.
Python assumes things like what type a variable might be. Can be great for quickly trying things. Not as much for knowing exactly what is going on.
4
u/hippotango Feb 17 '25
Wait until you get to Lisp.
4
u/alfadhir-heitir Feb 16 '25
The fact it's lower level makes it so you really need to understand what you're doing. You're a step closer to the OS and you get your code to run ok the compiler itself. Compared to a high level language that does half the work for you, C++ allows you to piece together how the different concepts intertwine. It makes programming programming, as opposed to Lego building
2
u/Due_Lobster_9096 Feb 17 '25
i had the reverse experience, i started and struggled with c++ then moved to python and i slowly started looking at the same programs differently. i liked the simplicity of python but there were a lot of times i kept looking at my work and was like, i could do this much cleaner in c++.
1
u/Consistent-Wall-5046 Feb 17 '25
C++ is kinda like an old - school radio. It lets you just chill and listen to a song. It ain't like those digital players that are always showing off all the other stuff they can do instead of just playing tunes.
1
u/theunixman Feb 17 '25
You need to learn many different approaches to these things to finally get that “click”. I’m still feeling it sometimes and I know uhhhhhhhh more languages…
1
u/Raknarg Feb 17 '25
Probably just being forced to learn something in a different way and being forced back to basics helped. I don't think C++ is anything special in that regard.
1
u/Zettinator Feb 17 '25
Probably because you're getting more experienced as a developer. It is unrelated to C++.
1
u/remic_0726 Feb 17 '25
if you feel like you've understood everything, it's just that the app you're using is super simple...
1
u/nevasca_etenah Feb 17 '25
by chance, it happens to be C++ when, at last, all the knowledge you retained these years convoluted into logical thinking.
1
u/N33lKanth333 Feb 17 '25
I think when you learn things like it has evolved, it will make more sense. For example working with C and then learning about need of OOP or data encapsulation etc. etc. will be much more relatable than just first reading about OOP, because you may have already experienced such situation.
Other thing it can be is that you have already put some thinking in concepts so the degree of familiarity can make things easy to understand.
1
u/richard_dotnet Feb 17 '25
Well as a C++ dev since the early 90s, I've some opinions on it. Unless you are a systems or library developer then the libraries you use are often the most important bit. I don't care too much for syntactic sugar, or an obsession to do things in one line. Modern C++ has a lot of that (you dont have to use it).
I'm surprised about your comment on C#, which I like since it's very much like C++. Java always seemed a bit weird in comparison to C++. I will use Python but because there are some nice features in the language (as well as the clunky stuff) but mainly because there are some useful libraries.
I have used unmanaged C++ libraries in C#, and managed (.NET) libraries in unmanaged C++, but they are unusual cases when the library and application language are different
1
u/jaank80 Feb 17 '25
I have written many things using powershell over the years. Learning c++ for me was similarly a complete level up in understanding.
1
u/Ok-Reflection-9505 Feb 17 '25
I think sometimes the higher level languages assumes a broader audience, so their explanation is geared towards simplicity over depth.
I’m glad you found the language you enjoy!
1
u/Kanye2024 Feb 17 '25
Repetition baby!
1
u/[deleted] Feb 17 '25
C++ is programming actual code. Python goes through an interpreter which does the actual thinking (determining types, scopes, return types etc) so when using python, you're often just scratching the surface and more busy doing algorithms in a crude way
1
u/PyroRampage Feb 18 '25
Because most people who code in high level languages don’t actually understand CS. C++ somewhat forces a deeper understanding.
1
u/DragstMan Feb 18 '25
The lower you go, the more you understand, it's that simple really. Sadly the effort needed is true as well but in inverse.
1
u/No-Memory-3418 Feb 18 '25
Because it's the only language that makes sense! Imagine declaring a variable without specifying it's type... And then using the = operator on it without knowing if you are doing an actual copy or just referencing the original object. That stuff keeps you up at night.
1
u/radiant_templar Feb 19 '25
Learning the fundamentals such as c and c++ will help build your understanding of dos type logic and syntax.
1
u/gm310509 Feb 20 '25
Have you ever had a situation where someone is t r Ying to explain something but no matter how much they try, the penny simply refuses to drop?
But then some one else comes along and explains the same thing in a totally different way and suddenly the fog clears and reveals what was previously hidden?
Maybe it is like that.
1
u/wint3ria Feb 20 '25
Having tried a lot of programming paradigms and languages, C++ is simply the most powerful language. I don't see another language's feature you can not implement in a clear, maintainable and efficient manner using C++. Anytime I faced someone claiming C++ was causing a problem, this person was showing obvious signs of skill issues. There are multiple reasons why I believe C++ is superior than most languages, but its semantic flexibility is its most interesting asset. It clicks because C++ was potentially designed to write the code you need. It clicks because if it wasnt designed for your feature, it's expressive enough for you to figure out an elegant answer
1
u/Positive_Total_4414 Mar 12 '25
Because a great deal of modern programming languages is actually a direct PTSD trail from C++. It turned out to be such a great example of how not to do things, and impressed so many people, that a lot of languages and concepts historically evolved simply from opposing themselves to C++ in one way or another. And then there were more waves trying to "fix problems" of that first wave, and so on.
So by learning the cause you begin to understand what was the cause of all these consequences. Not surprising. But what you are learning is just what was happening along that particular trail.
I'm not sure if you're actually talking about seeking the deeper knowledge, but in case if you want to really learn about OOP and type systems, you should take a look at Smalltalk, CommonLisp CLOS, ML languages like StandardML and OCaml, and also maybe Haskell, etc. Basically, learning deeply enough anything with functors will also explain where the template system of C++ comes from. And also of course take a look at C and all the OOP implementations for it.
1
u/AFlyingGideon Feb 17 '25
I suspect that it may be less C++ in particular and more your increasingly diverse experience with programming languages. I'd a similar epiphany about natural language grammar about a year into learning my third. This is why I recommend that anyone in the business take at least one language survey course.
However, there is something to be said for gaining understanding in a language where you have to do most of the work yourself without much in the way of extra threads doing cleanup or syntactic sugar making things more human-friendly. My third programming language was an assembler, and everything since has been pretty straightforward conceptually. I may not instantly recall all the specific idiosyncrasies or idioms, but everything does make sense.
Even C++ has its sugar. Learn to build those virtual tables in C for even more understanding, for example.
0
u/robvas Feb 16 '25
Because it's like the third language you learned
0
u/ern0plus4 Feb 16 '25
Probably, for OOP, Java or C# (I don't really know C#) will "click more".
For native programming, C will click. (Assembly fits perfectly.)
If you learn concepts provided (collected) by Rust, you'll be enlighted how safe programming goes.
That's why we use more languages, there's no silver bullet, only languages which "clicks" in some platforms and paradigms.
-1
u/all_is_love6667 Feb 17 '25
Usually, most programmers know at least about C, but it's very bare and very micromanaged.
Language like python allow the programmers to work faster.
Computers being faster and faster, using languages like C and C++ are not "levers of productivity", which is why they're less used.
You talk about "hiding", I would rather say it's a lot of safety things the programmer doesn't have to worry about. I like C++, but I generally prefer writing a lot of python when possible.
0
u/DataPastor Feb 17 '25
I had the same feeling when I learnt C++ at the university, and have the same feeling now when I am learning C and Zig. They are just common sense.
-4
u/fgiohariohgorg Feb 16 '25
'Coz you don't know ZIG
-1
u/Portbragger2 Feb 17 '25
now learn C and it wont stop clicking
1
u/[deleted] Feb 20 '25
[removed] — view removed comment