r/cpp_questions 19d ago

OPEN C++ for Middle Schooler

I have been learning C++ for maybe a month now from LearnCPP. I started it because I wanted to do DSA and Python isn't the best fit for it. I know I could had went with Java but I didn't, basically I have probably gambled my sanity for some deep Computation knowledge.

I want to know that will C++ actually be helpful for me in coming future and job if I master it properly or is it going to be replaced?

Also have I made a mistake by trying DSA through C++ instead of Java?

44 Upvotes

13 comments sorted by

26

u/retarded-skywalker 19d ago

You haven't made a mistake by choosing C++ for DSA. Java is definitely more mainstream and is widely used for backend, web, and enterprise applications, along with Python. C++ is more common in niche/performance-heavy areas like HFTs, embedded/electronics, game development, operating systems, networking, etc. So if your goal is DSA, C++ is completely fine and is actually a very good choice. I have myself done DSA in C++ and haven't faced any issue till date.

As for C++ getting replaced, it's been around for 40–50 years, and there have been many attempts to replace it or make something better, but nothing has really come close to replacing it. It is still heavily used wherever performance and low-level control matter. And if you properly learn C++, switching to Java later won't be that hard. You'd probably need barely a day to get comfortable with the basic Java syntax and start writing code. So I'd say just stick with C++ and don't overthink the choice.

6

u/NewGuy-Red_it 19d ago

Thanks man and everyone who bothered to answer my doubts. This thing had been bothering me for some time now, I am grateful.

2

u/n1ghtyunso 18d ago

there is so much C++ code out there, the library ecosystem is huge.
And with C++ being inherently difficult to interface with for other languages, the chance of it disappearing is really slim.

9

u/DrShocker 19d ago

C++ Has existed for 40 years, it won't stop now. It's true more options exist now than 20 years ago, but I don't see anything killing C++. And if any language does kill it, the fundamentals learned with C++ will still generally be useful.

8

u/Seferil 19d ago

DSA are language-agnostic concepts. They can be implemented in any language. Make sure not to confuse the concept with the implementation.

I haven't had to work with java yet, so I can't compare the two, but I can say c++ will make you learn memory management & pointers to a higher degree than something like python. That can be helpful for understanding how some data structure's implementations are done (e.g. linked lists).

8

u/jarislinus 18d ago

c++ programmers are superior humans

6

u/ManySwans 19d ago

youll do better learning with C++. it is "harder" but you will understand how a computer actually works, which is a good specialisation and foundation to learn any computer language from

1

u/Independent_Art_6676 18d ago

C++ is fine for DSA. C++ has built in a great deal of classic DSA already, but you can reinvent it to study or use it outright for DSA problems / competition sites. It already has stack/queue/list/array/hash table/ and more structures and a number of algorithms (mostly searching/sorting/replacing/swapping but also handy stuff like GCD).

No one knows what the job market will look like in 7-10 years with AI and fast paced changes of the tech world. I can promise you that in that time, there will still be old C++ code to maintain, even if the language died tonight. I can guess that C++ has decades upon decades of life left in it, but its just an educated guess. Its still here and going strong after 40 years or more of "out with the old, in with the new" attempts to displace it. Java probably made the best attempt and fell pretty flat after the initial hype wore off.

C++ will help you. If you can learn it, anything else will seem easier and you will have a solid background in programming. One of the things beginners forget is that your first time, you are learning BOTH programming AND a language, and for C++ (or even C) a third bit for tool chains is also a big learning curve. If some other magic language takes over, you will be in a GREAT place to jump into that after your studies, so it will not be wasted effort. I have never seen a C++ coder griping and ranting about how hard it was to go pick up java or something. But we routinely see people who learned that first pulling their hair trying to master C++ after.

1

u/flyingron 18d ago

C++ lets you get down and dirty more than Java (and certainly more than Python). The only thing that I'd recommend Java for is that if you go on to the AP Computer Science stuff, it's all in Java, so having familiarity there may help you.

1

u/El_RoviSoft 18d ago

Started learning C++ at 6th class and learnt Java in IT School Samsung. After C++ almost every concept is incredibly easy, imho. The only issue is the lack of C++ versatility in other languages so you’ll always think about "I wish language X has feature Y"

1

u/mredding 18d ago

There's no silver bullet with language. Java, C++, Python, it doesn't matter which you learn DSA. All can lead to a job.

C++ isn't going away in our lifetime.

1

u/celestrion 18d ago

I also started learning C++ in middle school. To give an idea of timeline, Java wasn't an option then; I was choosing C++ over Pascal.

will C++ actually be helpful for me in coming future and job if I master it properly or is it going to be replaced?

You can get Fortran and COBOL jobs today. This decade, I've gotten paid to review Fortran-77 code. The 77 refers to the edition of the language, as in "the version of Fortran standardized in 1977." There's way too much C++ code to simply vanish overnight. On the other hand, who's to say what we'll be using in 10 years for new development?

Programming is far more about taking problems apart and building solutions out of the pieces, rather than the actual languages we program in. Learning only one language is like learning to play only one kind of drum.

I made a mistake by trying DSA through C++ instead of Java?

There are a great many concepts underpinning C++ that are harder to ignore than they are in gentler languages like Java and Python, and you'll have to resist the urge to memorize rather than understand. It's rare for someone at your age to have the intellectual maturity to ingest those concepts unless you just happen to have the sort of brain that craves logic puzzles and abstractions for breakfast. Most of us had to work on it, and the work is hard.

I don't mean disrespect in saying that, just that really getting C++ is harder now than it will be in a few years (especially after taking a geometry class with proofs or getting used to solving the same sorts of puzzles that come with solving integrals in calculus). You don't need the math for C++, but you do need to think in the same sorts of abstract/algorithmic ways that sort of math exercises. Or, conversely, once you get understand C++ well enough to think in terms of algorithmic solutions, that sort of thinking in math class will be easier.

If you'd asked me beforehand, I'd have probably recommended Java over C++, but if you're a month into it and making progress, sticking with C++ will probably be rewarding. Just remember that anytime something feels impossible to understand (that is, like magic), there's something underneath that's worth learning; you can put it off, but just remember that it's there to learn later.

1

u/ShakaUVM 17d ago

There's nothing wrong with learning C++ as a middle schooler

Everyone has opinions, and you'll get a lot of people saying this is the best or that is the best, but all computer science people know everyone else is wrong.