C vs C++
Posted: 01 May 2017, 09:09
I remember a while ago we had a pretty lively discussion on here about why this project is a "C++" project and not a "C/C++" project. At the time all I really knew about C was that it is a "subset" of C++, so I did not understand why it would be incorrect to refer to this project as being programmed in "C/C++".
Boy have I learned a lot since then. I've been through a C++ course, a data structures course taught in Java which highly focused on OOP, an Assembly course, and recently I've been doing quite a bit of C programming.
The C program I wrote recently needed to be optimized as much as possible for speed. I'm pretty proud of it and will probably share it here after I turn it in. But through my programming, due to the optimization and the constraints of the project, my C code evolved into something that, to me, was very apparently glorified assembly code. I was treating memory as a malleable resource, instead of an abstract one. Now, if I was writing a program that would need to be a more general solution and that would need to be maintained in the future by other people, I certainly wouldn't write like this even in C, but the difference between the C and the C++ approach became very clear to me. C was the right solution for my tiny project that needed to run as fast and tight as possible.
C would never work for a project as large as this one, in my view. I'm sure there's amazing C programmers out there who could do it without breaking a sweat, but C++ is obviously the right solution when you need to handle memory in an abstract way, and to enforce permissions and object-orientedness in your code. Without incredibly skilled C programmers, a project of this size would devolve into an unstable mess very quickly if it was written with the C approach.
Anyway, this is kind of a rant, but I wanted to share. My schooling is making me fall in love with C++ and now C more and more! I'm curious to hear what our devs here who are more experienced than me think about my personal revelations.
Boy have I learned a lot since then. I've been through a C++ course, a data structures course taught in Java which highly focused on OOP, an Assembly course, and recently I've been doing quite a bit of C programming.
The C program I wrote recently needed to be optimized as much as possible for speed. I'm pretty proud of it and will probably share it here after I turn it in. But through my programming, due to the optimization and the constraints of the project, my C code evolved into something that, to me, was very apparently glorified assembly code. I was treating memory as a malleable resource, instead of an abstract one. Now, if I was writing a program that would need to be a more general solution and that would need to be maintained in the future by other people, I certainly wouldn't write like this even in C, but the difference between the C and the C++ approach became very clear to me. C was the right solution for my tiny project that needed to run as fast and tight as possible.
C would never work for a project as large as this one, in my view. I'm sure there's amazing C programmers out there who could do it without breaking a sweat, but C++ is obviously the right solution when you need to handle memory in an abstract way, and to enforce permissions and object-orientedness in your code. Without incredibly skilled C programmers, a project of this size would devolve into an unstable mess very quickly if it was written with the C approach.
Anyway, this is kind of a rant, but I wanted to share. My schooling is making me fall in love with C++ and now C more and more! I'm curious to hear what our devs here who are more experienced than me think about my personal revelations.