C++ or C?

Started by
97 comments, last by Promit 14 years, 11 months ago
Quote:Original post by moff
I'm really just giving this reply because I'm so tired of so many people always advocating the easy way, quick way.

Well although i am more inclined to agree with Zahlman's point of view than your's i can see why it would be good to understand what you are doing and know the details. But i don't agree with that comment. People here definitely do not advocate the "quick" way, they advocate the best way, which in most cases is the way that has been done so many times before by professionals who know what they are doing. No-one should ever "reinvent the wheel", they can improve it if they know how but i highly doubt a beginner would be in a position to do so. Therefore, the best way usually ends up being the quick, easy way.
As an analogy, take driving a car. If everyone was required to learn how to build a car's engine from the ground up and understand how every part functioned before they were allowed to drive, do you think there would be any cars on the road? Sure people can learn to build a car if they wish but it's not a requirement to learn how to operate it.
/my 2c
[Window Detective] - Windows UI spy utility for programmers
Advertisement
I couldn't agree more with moff. I know a lot of people who learn how to use stuff but they are clueless about what they're actually doing or how it works, thus being unable to optimize things mostly. I personally know how much I've learned from "reinventing the wheel".

By doing as much as possible of the code by yourself will make you learn things you wouldn't otherwise. The "best way" seems to be using complete libraries, even though, in some cases, you could write your own which would be faster.

I really liked your analogy because I have a decent understanding of a car's mechanics thus made it ten times easier to learn how to drive. It's not required but it's a plus.

C++ is the only programming language I know and I haven't found any downside yet.

By the way; The title "Professional" doesn't always address the programmer's knowledge or/and intelligence.
Quote:Original post by Hannesnisula
C++ is the only programming language I know and I haven't found any downside yet.
You probably haven't found any downsides because it's the only language you know, and so aren't aware that other languages may present a better way to achieve something. "If the only tool you have is a hammer, you tend to see every problem as a nail". [wink]

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

first off oop helps in that it keeps you, the coder, from rewritting alot of things that differ by some degree. One thing deign pattern. next get a better tool chain,IDE,
devc++ compiler is great in all but thats when it costed to get visual studio. Since its free and made by the company who make the os u are propably running its best bet to say they have a better tool chain for developing on that environment.And yes visual studio is the best. it has so many features.

Next c# is the language i recommend for you. its much like java but with a touch of c++. the tool chain for it is absolutely the best by far is there anything like it. C# is pretty decent with speed constaint and is used in major companies i would tell you one that i know for that use it some for tool development. but that might put me at risk
Bring more Pain
An alternative would be managed C++ as you can easily call c++ DLL's from it. Using C#, you would have to write a wrapper.

A downside of C++ would be that there's no garbage collector for example. I really miss it sometimes, even more on todays powerful machines.
Quote:Original post by Hannesnisula
C++ is the only programming language I know and I haven't found any downside yet.

That's because you are used to header files, undefined behavior etc.

Switch to another language with a proper module system and garbage collections for a couple of weeks, and believe me you will see some downsides in C++ ;)
Quote:Original post by moff
Yes, it will be harder than a language like C#, Python, or Java, but I find the results are much more rewarding from learning the harder way to do things before learning the easy way.


If you want rewarding, donate to a charity.

Quote:
It is much harder to go from knowing the easy way, to learning the hard way (and you are much less inclined to bother) - better to have a clean slate, and make sure to get a good solid foundation.


A good solid foundation can never be gained by learning with C++. You spend too much time dealing with bullshit than actually learning to program.

Quote:
I still usually use character arrays more often than strings, or if I want a string, I'll write my own class - the standard string class isn't that great.


There's a pointless exercise.

Quote:
But, the point is, I learned a lot about the details of how memory is stored, accessed, and what pointers are by starting with the harder way first.


Which is useless knowledge. Taking some time to learn some algorithms, or how to architect programs... y'know, actually program?

Quote:
In the end, you'll know more about why and how things work.


Not really. Even C provides just a facade over how things work.

Quote:
But if you want the instant pay off, sure, go with an easy language that will handle all of your memory and bounds checking for you.


You are not a manly man for fighting through hardship. Sitting around keeping tabs on bounds is time and energy you could have spent learning. Or making a game. Using your keys to turn a screw is stupid when there's a perfectly good power driver right in front of you.
Quote:Original post by Telastyn
Quote:
But, the point is, I learned a lot about the details of how memory is stored, accessed, and what pointers are by starting with the harder way first.


Which is useless knowledge. Taking some time to learn some algorithms, or how to architect programs... y'know, actually program?


What? The Von Neumann architecture is here to stay, and our algorithms are based around that model. Better understanding that isn't "useless knowledge."

Understanding the stack and function calls, and virtual function dispatch--that stuff helped me become a better programmer. I'd take a doctor who knows how medicines work over one who can read journals and match up symptoms.

OP:

C++'s implementation of OOP sucks pretty bad. It's not the best language to learn those techniques.

C is pretty much THE standard implementation of structured programming. It's a great language to learn those techniques. (read me).

C++ is the best way to learn C++.
Anthony Umfer
Quote:Original post by Telastyn
actually program?


slight misunderstandig about that programming is the act of programming, not the act of hammering together the something in particular that you currently think of. Also, how do you define your "actual programming"? E.g., I don't want to go through the pain of writing device drivers, high throughput surface copy, mmap() based code, or coherent kd-tree/ray traversal code in C#. I can only imagine how the unsafe blocks, forced manual object disposals and explicit stackallocs clutter all my code.

Telastyn, nothing against C# (actually I am quiet fluent in it), but not using pointers, direct memory accesses and explicit memory handling is not automagically "actual programming". And really, C# is not the Snake Oil that, as it seems to me, you try to sell us. In the meanwhile we all know how much Telastyn lieks C#, where at the same time Telastyn's arguments against the dread C++ basically can be reduced to "coz' it's"
Quote:Original post by Telastyn
bullshit.


Btw, the following has been done by an act of actual programming, too:
image of IBM402 plugboard, showing how programming was back in the day

Or, by "actually program", did you really mean something that goes into the direction of "Applications Development"?
You could always check out D http://digitalmars.com/d/

It's modern and doesn't suck, but it is also "low level" systems language with inline assembly if you really want it. It has direct access to C as well.

This topic is closed to new replies.

Advertisement