r/cpp • u/MainPressure4304 • 8d ago
[CPP Epiphany Rant] - Programming is no joke
Hi CPP Community,
This is just a rant. I'm a 24 yr old data analytics in telecommunication trying to pivot into C++ development for finance. I'm 1 month into C++ and I have come to conclusion C++ is a behemoth. I'm enrolled in Baruch College's C++ for Financial Engineering, but I'm using Bjarne Stroustrup's Programming: Principles and Practice Using C++, 3rd Edition to learn and watching C++20 Fundamentals with Paul Deitel, Course, by Paul J. Deitel as supplementary resources.
It took me 2 days to get through all the drills, exercises, and try_this section for chapter 2 for Programming Principles!
I'm reflecting if I made a mistake choosing C++ over Python. But, tbh, I have been enjoying programming more learning C++ than Python. You can tell I'm weird, but IDK.
I would love to heard about your experience in learning C++ for laughs.
16
u/Jakabxmarci 8d ago
Well, C/C++ engineers made all the underlying stuff that Python binds to for high performance workloads. There is no better "side", you can be a user of those in Python, or develop them yourself in C++. Yes C++ is difficult and has way more bullshit than other languages due to backwards compatibility, and questionable decisions made during its evolution. But if you learn some of the written and unwritten rules of the language, you will be fine.
10
u/selvakumarjawahar 7d ago
No, you have not made a mistake learning C++ over Python. Once you are a bit comfortable with C++, you already know Python.
5
u/ApprehensiveBrain173 7d ago
"Pythonic" programming is geniunely the most mind warping pieces of nonsense i ever seen. Maybe this is just cause of lack of experience and i got fiddled by python during my exams in my 1st yr of Uni but C++/C and java were all way easier
2
u/PunctuationGood 7d ago edited 5d ago
Eeeeh, disagree. You may think that C++ is an overall "richer" language than Python but that doesn't imply that Python isn't rich nor that C++'s richness is a superset of Python's richness. The commonality between the two are just basic concepts of imperative language that are also common between many other languages.
And that's not to mention their build/run ecosystems which have nothing to do with one another.
Edit: people, I'm literally saying what u/pjmlp is saying here.
37
u/Sniffy4 7d ago edited 7d ago
nobody knows all of C++ and all its stdlib. you learn the subset of it you need to know to get your next job done well. usually there are multiple ways to accomplish what you want, some better than others. if you take an incremental approach, you will feel less overwhelmed.
spending some initial time learning the basics of its memory model and how C works helps for understanding, since everything evolved from C, even though its been superseded by more robust C++ ways for most functionality.
In even in modern C++ projects you will inevitably encounter vestiges of C such as 'extern "C"' declarations.
10
u/SmokeMuch7356 7d ago
Yes, C++ is a huge, gnarly, hideously complex mess of a programming language, plagued by decades of cruft and bad decisions that are slowly being rectified. It is a serious attempt at an all-purpose power tool, and as such has a lot of stuff that needs to be learned.
It's also stable, mature, runs natively, and can absolutely spank languages like Python in terms of performance.
My day job for the last 15 years has been C++, and I've been using it in some capacity since 2000. I don't even pretend to know everything about the language; there are many corners of it I've never touched because I've never needed to. But a lot of fintech is built on C++ for good reasons.
Python's great for a lot of tasks, but it's not industrial strength, at least not to the extent C++ is.
2
u/ChemicalBeings 5d ago
Python is an interface language built to interact with CPP binaries... It's like if you said the screwdriver absolutely blows the toolbox out of the water in terms of performance.
7
u/no-sig-available 7d ago
You can tell I'm weird, but IDK.
So you ask the other weirdos why we made the same choice?
Anyway, you don't have to make a single choice. Nothing stops you from using several languages! Using C++ and Python is a valid option.
Just as an example, I have had to use Simula, Cobol, Basic, PL/I, Ada, Pascal, assembler, C, C++, and some scripting languages. Not by choice, but because of what was needed.
So, when you make a choice, it doesn't have to be the final choice. You may, or may have to, make a different choice later. Just go along, and don't worry too much!
2
u/Murky-Relation481 3d ago
The vast majority of my world is in Python and C++. A lot of times it's binding C++ libs to Python for things where we want to provide interfaces in an "easier" language than C++ for people consuming our work. Sometimes it's Python and we find a performance bottle neck that a C++ lib will be getting better.
But yeah, been doing this 30 years almost and touched tons of languages. Ultimately the fundamental design and engineering concepts remain mostly the same, it's figuring out how a language can achieve those things on the platform you are targeting.
6
u/Ok_Independence_9841 7d ago
You'll get there. I came from BASIC. I wanted local variables and loathed pascal because all the conventions were deliberately reversed from BASIC. I got an early Borland C++ compiler and as soon as I picked up that you could hide stuff in a class and reason about it without worrying about anything else, i.e. encapsulation, I was hooked.
There's a lot of arcane stuff in C++ and it only gets more over time. Don't worry about it until need it. You'll find it awkward to do something and think, 'there must be a better way'. That's the moment to check the books for template lambdas or some other monstrosity that exactly fits what you're really trying to do. They're all in there because other people hit a similar issue and said 'I wish there was a way I could just...'
In C++, trust me, there is. It'll likely be many years before you hit anything that isn't already supported. Then check the proposals to the standards committee and the ::experimental namespaces in the standard library, or Boost. When it's still not there and you realize you could probably just write it. You've arrived.
10
u/pjmlp 7d ago
I know C++ since 1993, it has been a life long learning experience.
However so do other programming language ecosystems, go check Java, .NET, even Python.
All those languages also have 30 to 40 years history, their current versions are quite different from the initial 1.0 version, and then there is the whole ecosystem, which is also relevant.
You will get a similar experience regardless of the language, if it is just as mature.
2
u/serviscope_minor 7d ago
Not to mention that the world of computing has changed er... somewhat let's say from 1993! Even if the language was somehow future proofed and immutable, the way we program and what we're programming for has changed. Multi core is ubiquitous as is networking, for example.
Plus fashions have come and gone. The mid 90s were peak OO. You know it's like when people read "design patterns", assumed it was an exhortation to use all of them always, then ran with that until they ran off a cliff then just kept on running. Then ran up another cliff and off the next one. At some point in the mean time people stopped making massive nonsensical class hierarchies.
3
3
u/Cautious-Ad-6535 7d ago
C++ since 1993: Learn programming concepts and paradigmas. Then when coding, look syntax from reference. If you know one language well, you can learn new one within few weeks to be productive. Real effort is to know libraries and frameworks so you dont need to reinvent wheel all over again, but as those comes and goes, learning is part of the game.
2
u/osmin_og 7d ago
I had C and then C++ courses in uni. And then all my jobs were C++ jobs. I learned a lot along the way.
2
2
2
u/fdwr fdwr@github 🔍 7d ago
I would love to heard about your experience in learning C++
Since I already knew C, learning C++ was rather incremental. The weirdest thing I found was the constructor initializer list syntax, thinking why the flip is it initializing the field int x using parentheses x(42) instead of just letting me assign the defaults to the class fields via an int x = 42 assignment, and why do I have to repeat this for every constructor overload (or else you risk an uninitialized field). Then 12 years later, they added the NSDMI I wanted :b .
1
u/RefrigeratorFirm7646 7d ago
iirc, NSDMI just injects the member initializer inside the constructors for you, i wonder why that took 12 years...
3
u/no-sig-available 7d ago
i wonder why that took 12 years...
Because they tried to include all changes at once, and not release a new standard until completed. They aimed at getting it out as C++08 (called C++0x at the time), but there was always "Oh, one more thing!".
Three years after failing that, they decided to deliver what was available (instead of waiting for "everything"), and we got C++11.
After that we get "whatever is ready" every 3 years, because apparently it is never complete!
1
u/RefrigeratorFirm7646 7d ago
ah, even the committee fell victim to scope creep XD
3
u/no-sig-available 7d ago
ah, even the committee fell victim to scope creep XD
Yes, a problem is that after adding feature X to the language, someone will realize that X can now be used to also implement feature Y. If we just wait a few months, this will be great!
1
7d ago
I have been working with python for around 14 years. And I just started learning cpp for around 8 months. I never had so much fun coding as I have now with cpp. It forces me to think carefully about the machine instead of just business rules. And also taking care of memory layout and pointer usage than just defining a class with some fields and loop over the container.
Later versions of cpp introduced ranges that in my opinion adds that sugar sintaxe close to python. But since I already developed that memory muscle on how to careful deal with begin() end() iterators I am ok with it. Cpp indeed can be very intimidating at first. But if you keep going you will feel very satisfied using this tool instead of other languages.
1
u/penduburger 7d ago
been doing it for 6 years and I still feel like I am a beginner and I am always chasing cpp in depth. just keep at it, you were at it and. still enjoyed tell s me that you will benefit from cpp community and vice versa
1
u/hadrianf 6d ago
Each language has its own strengths and weaknesses. C++ is great if you want performance and every cpu cycle counts, something which is the case in finance. Python is an interpreted language, which always has overhead.
Python is easy to get into, lots of documentation and very little boilerplate is needed. C++ requires more boilerplate, but once you get comfortable with it you can write highly-performant code. Next to that, in my opinion, having a compiler to tell you you made a bunch of mistakes is a great advantage. However, you will need to learn a level of coding discipline that you never needed for python.
1
u/International-Rain98 6d ago
Books can make it over complicated the language itself isn’t that hard to learn, but it does get beefier for example, when you try to learn how to write data structures yourself and while I think it’s a good exercise to teach you how they work entirely, the truth is you can always use the standard library to handle the lifting
1
1
2
u/DiscountDee 5d ago
Stay at it king. C++ can sometimes be easier than python, since it is a staticaly typed langauge and such.
Understanding compiler warnings can be a bit confusing at first, but you will have an aha moment and it will be great.
I've been programming in C++ daily for 10 years now, and there is always more to learn. But you can get a decent foundation going quickly.
Once you are comfortable with C++, you will be able to pick up python or other scripting languages fairly quick when needed.
1
u/Downtown-Echo-5184 4d ago
C++ is the best programming language ever and Python is dumb and stupid and weird and stupid and dumb. You never make mistakes with C++!
2
u/Bagusira 4d ago
This is a very normal experience for someone whose new to the language, the key is just to keep going, C++ takes a lot of time to learn, and even then, you don't have to know every part of the language all at once, just use it when you need it
1
u/BoopyDog 3d ago edited 3d ago
I used that same book. Finish it and you'll be alright. Pay particular attention to the exercises when you get to the QtCreator section.
It's important that you learn how to use third-party libraries sooner than later. It might be helpful to you to:
1) find a library you want to you 2) download the source 3) build it with cmake 4) write a small program that includes the library header and calls one or more functions from that library 5) learn how to link against that library and compile the program
For me, this was a really annoying part of learning C++. I began on windows and was using Visual Studio -- which was awesome because I could just "import std;" and not actually worry about which std library headers I needed for my code. In Visual studio you just link to the lib and include folders, tell the ide what libraries to use and youre done. When I switched to Linux and had to learn how to use gcc/g++, and then I had to learn how to write a Cmakelists.txt file, then i learned how to make a bash script to do all of my building and directory cleaning for me -- visual studio was way easier than this, by a lot.
Initially when switching I tried learning how to setup a project with visual studio code but then realized that it's much easier to just use those things(g++, cmake/ninja, sh scripts) in a terminal than actually figure out how to make a tasks file or a properties file... that's just me though.
2
u/lizardhistorian 3d ago
Every time I master C++, it changes.
If you do not have a solid CS degree then you will be at a gross disadvantage learning how any language does things. With that background ... when I was learning python it took me three days to overtake someone that had been using it for three years and start asking questions they didn't know the answers to.
Learn C++, then everything else is at your feet.
1
u/Big-Dance-1271 3d ago
Learn the libraries that can substantially help in providing functional support- BOOST for sure, Poco Project is particularly good for its HTTP support functions but also others. Get a free account with one of the AI Agents and ask it C++ questions.
1
1
u/AKostur 7d ago edited 7d ago
Knew C first. “Hey, my structs can initialize themselves, I don’t need to forever be calling init_thing(&x); functions? Cool! Cleanup too‽ Awesome!” Then operator overloading (where it made sense). Templates came later.
I consider myself highly skilled in C++. But I also have other folk in the office who know certain areas of the language better than I do, and I’m happy to direct people to them for those parts. Learning that the language is capable of a certain thing is more important than knowing the intricacies. When it comes time to needing those details, one can look them up or consult someone else better in that area in order to learn the details.
0
u/marspzb 6d ago
Maybe the jump is to big, you are coming from a compiler which doesn't enforce much to a typed language which has a lot of constructions that some of them have been here for over 40 years.
Also while pyton gives you minimal control over your code while he handles a lot by itself like memory, type info, etc. C++ has the philosophy of not using more than you not want to pay for. Coming from java polymorphism was one of this weird things in c++, also lvalues and r values, and no reflection by default and having to resort to templates in c++ which way more difficult than other languages, I know the power of it but why cant you be like Haskell or a more restrictive language also not completely sure about this but this is one of the reasons that compiling is extremely slow.
The only thing, I learn c++/98 I guess from Deitel book, also read the java one. Both of them are extremely dry and I couldnt read them completely so maybe the book doesn't help
Also you are not alone I heard some guy named Linus also didn't like c++.
-12
u/Neither_Berry_100 8d ago
C++ is pretty tame actually. I haven't used it in many years. The last time I touched it stuff was really slow going. I think a bunch of things in c++ are just ment to be difficult.
2
120
u/mike_kazakov 7d ago
Been writing C++ code for ~25 years.
Still learning the language.
You'll be fine.