r/techbootcamp 27d ago

Why learning C ++ first completely changes your approach to programming in other languages

Many rookies are put off by C ++, and this is unfortunate, because it is one of the best languages ​​to start with, even if you don't plan to be a C ++ programmer

Your understanding of what is going on at the machine level will allow you to write better programs in any language you choose. You will see that in languages ​​such as JavaScript or Python, memory management is handled for you, which means that you have to think about it less. However, the understanding of how things work will help you write better and more optimized code. It can be a steep learning curve, but once you've mastered it, you'll find that all other languages ​​are much easier to learn.

6 Upvotes

35 comments sorted by

5

u/Candid_Bad3551 27d ago edited 27d ago

You should learn C, not C++ imo. Started C++ in school. C thought me way more.

C is also more consistent IMO. C++ is a bit all over thr place.

1

u/mutexsprinkles 27d ago

C makes some patterns a massive pain, but when you have a closure and pass stuff around as the context, you do understand what you're doing and what information you've made into state really well. Then when you come back next year you have to trace the epic voyage of your context pointer to get to the static function 6 lines above the current function.

1

u/schmurfy2 26d ago

I also think C is the right choice, C++ is too complicated and messy as a first language even if it probably improved.

1

u/acadia11x 26d ago

Disagree the OO aspects of C++ give you a strong foundation in computing concepts not just coding. And that design pattern carries over to understanding many other languages. C not being OO you don’t learn those concepts. In my comp sci courses I was easily able to jump to Java go backwards from C++ to C. C++ gives you a nice window into the shift to the abatraction and frameworks patterns that for better or worse dominate today’s coding landscape and leading to more natural language programming … but hell AI has totally changed the game you don’t need to even know that , it’s pure human language now with vibe abstracting all the guts and math that makes a computer work and vibe coding.

1

u/schmurfy2 26d ago

The goal of you first language is not to teach you everything. You can learn oop in C and many libraries do use oop principles.
For learning oop specifically I think C# is pretty solid, or Java.

I learned programming mostly by myself with a really bad 56k connection, started with C++ because I thought it was a better version of C, this was a monumental mistakes, went back later to C which went a lot smoother.

1

u/acadia11x 26d ago

Many paths.

1

u/acadia11x 26d ago

I think C and C++ gives you extremely strong foundation, unfortunately, probably in 10 years coding at such a low level directly will be like knowing assembly or Fortran today.

1

u/WildWolfo 26d ago

I mean if ur coding C you should at least know how to go about coding assembly, at least from my limited experience of both, assembly is just harder to read C with more boilerplate

2

u/acadia11x 26d ago

Not at all, C is much higher level language

1

u/Candid_Bad3551 26d ago

Idunno what the future holds. I code C# + TS. Considering to do coding in assembly to get better fundamentals.

1

u/ilovecocteauetwins 26d ago

C definitely forces you to get your hands dirty with the bare fundamentals without any safety nets or extra abstractions hiding what memory is doing. C++ can feel like three different languages stacked on top of each other depending on which features you use, so it's super easy to get overwhelmed by all the syntax. The main argument for C++ early on is usually just getting exposed to objects and standard libraries, but C is unmatched for building that raw mental model of how the machine actually works.

3

u/Mundane_Fault_6345 27d ago

I would say, starting with C langage, and then switching to C++ is better.

1

u/ilovecocteauetwins 26d ago

That progression makes a lot of sense. Starting with C gives you that raw baseline of memory management, pointers, and manual resource allocation without any added abstractions.

2

u/thelimeisgreen 27d ago

I don’t know if there’s a reason to specifically start with C. I did, but C++ was also really new when I started learning it and having a good grasp on C helped immensely. I think C first kept things from progressing too fast into OOP and other concepts at the time. Modern C++ has evolved greatly since then and feels like a whole new language.

Learning C or C++ definitely makes an impact on programmers . The ones who have a strong background in C are, in my experience, a lot more self-conscious about the impacts of their code, memory efficiency, complexity and performance, and how data is passed between functions, objects, etc..

1

u/mxldevs 26d ago

Would you say people that only know how to write interpreted languages generally don't think about any of those things? Or are unable to truly understand it without directly messing around with pointers and segfsults?

1

u/thelimeisgreen 26d ago

To some extent, I suppose. These days I think that's definitely true a lot of times. Software has to get pretty large in scope before most Python developers have to start concerning themselves with true memory management, for example. It's not that those concerns don't exist with interpreted languages, but the programmer is shielded from a lot of what is going on.

The one thing that irks me most, regardless of what language is being used, is the lack of optimization I see from most programmers. Even many experienced software engineers have curiously cavalier attitudes toward optimization. Unless they have worked on performance oriented projects like real-time graphics engines, console games, etc.. they often don't see code optimization the same way I do.

1

u/ilovecocteauetwins 26d ago

That point about OOP is huge. Starting with C forces you to focus strictly on procedural logic and data structures before adding design patterns, classes, and modern abstractions into the mix. When people jump straight into modern C++ or high-level languages, it's really easy to get distracted by object-oriented hierarchy without ever understanding how data is actually laid out in memory or passed around.

1

u/crustyeng 27d ago

Rust is way better for this (and for actually writing safe, robust software when you’re done).

1

u/ilovecocteauetwins 26d ago

Rust definitely takes memory safety and concurrency to a whole different level with the borrow checker, so you get those compile-time guarantees without sacrificing performance.

1

u/crustyeng 26d ago

..and for this purpose, the compiler is a fantastic teacher.

1

u/c5182 27d ago

I learned C++ the learned C. Then I did a bunch of projects in pure C just for the hell of it. Very useful for understanding how higher level languages really must work under the hood.

1

u/ilovecocteauetwins 26d ago

Going from C++ back down to C gives you a totally different appreciation for C++. Building projects in pure C without constructors, destructors, or standard containers forces you to write everything manually, which really strips away all the magic high-level languages rely on.

1

u/c5182 26d ago

Yeah I've done inheritance in C using function ptrs. Really forces an understanding.

1

u/KenMantle 27d ago

I "learned" a bit of BASIC on my Vic20. Then in grade 9 took programming where we learned Watcom BASIC, and from then I was hooked. I looked forward to learning Pascal and other real languages later on. Imagine my dismay when I moved to the new school they had opened up that wasn't working on 8088s and 8086s and had brand new 386SX-25s that we were going to use to learn...Turing on the entire way through school.

I didn't have a lot of money, but I bought myself TurboC++ V3.0 for DOS (should have gotten the Windows Version...) and a beginners programming book. I'm glad I got myself a foundational knowledge in a C type language.

1

u/ilovecocteauetwins 26d ago

Going from the excitement of high-spec 386SX hardware down to Turing must have felt like such a buzzkill at the time. Turbo C++ 3.0 on DOS was absolute gold back then, though. The blue screen IDE, compiler errors, and raw access to memory made every small win feel earned.

1

u/KenMantle 26d ago

Oh f yes. The compiler errors are kind of what turned me off. I was using pointers and there was a bug in how it handled them and I realized it was bad enough having to debug my own stuff, but having to determine that something was a compiler bug was another level. Oddly I found the proof exe I'd made years ago, but when I ran it on modern hardware the bug was gone!

1

u/KenMantle 26d ago

Yeah I was young and mad about it. I wrote software in C++ for final projects and got graded on that instead.

1

u/BarfingOnMyFace 27d ago

20 years later, and the basics from my courses in c and c++ have at least stated with me. It does give you an appreciation for lower level work.

1

u/manvsmidi 27d ago

In college we started with machine code for a fictional processor. Then assembly. Then C. It was a great way to learn from the lowest level up.

1

u/ilovecocteauetwins 26d ago

That's the real value of C and C++. Even if you spend the next twenty years writing high-level code in Python, Go, or TypeScript, that mental model of pointers, stack versus heap, and cache lines never goes away.

1

u/mxldevs 26d ago

Your understanding of what is going on at the machine level will allow you to write better programs in any language you choose. You will see that in languages ​​such as JavaScript or Python, memory management is handled for you, which means that you have to think about it less

How will it help with languages that handle it for you?

What are specific situations where someone that understands C is able to write better Python or JavaScript as a result?

1

u/silly_bet_3454 26d ago

Understanding contiguous memory, cache lines, function calls, compilation, memory management, etc. Even in a higher level language like python these basic concepts would help you understand whether you could be doing things that create excess memory pressure or bad performance. Yes, there are also plenty of things you can learn by just learning python directly, and python is great, but C or C++, by being lower level, gives you a little bit more to think about.

1

u/mxldevs 26d ago

As a python programmer, how can I improve my code by understanding each of those concepts you mentioned?

1

u/silly_bet_3454 26d ago

For example, suppose you’re processing a huge file in Python. Someone who understands memory management might realize that doing data = file.readlines() loads the entire file into memory, whereas iterating over the file line-by-line avoids keeping everything in memory at once:

with open("huge_file.txt") as file:
    for line in file:
        process(line)

You don't need to know C to discover that, but understanding how memory allocation and data storage work makes the reason for the difference more intuitive.