C++ as a first language [closed]

2020-02-16 06:44发布

I've been self-learning C++ for about 4 months now. I'm enjoying it, and I think I'm doing quite well. However, an answer to a question of mine got me thinking that I might be setting myself up for a fall.

So, what do people here think about C++ as a first language to learn? And is it worth me just carrying on now that I've made a good start?

标签: c++
30条回答
冷血范
2楼-- · 2020-02-16 06:58

Go, go, go! Everybody is gonna love you for reiterating their early-on efforts and see themselves in you etc. All the sentimentals aside, yes personally i think you should. You will have much better credibility and hence self-esteem.

查看更多
啃猪蹄的小仙女
3楼-- · 2020-02-16 07:02

If you were just about to start out I wouldn't recommend C++ as a first language, because the first thing you need to understand as a programmer are the programming concepts, and in C++ you'll spend a lot of time wrangling with the syntax.

But since you're four months in and enjoying it then it sounds like you are doing okay, so I'd say carry on. But round it out with some more general reading. Something like Structure and Intepretation of Computer Programs. It will teach you things that just ploughing throw in C++ won't occur. Things that will make your C++ programs better (and make you better in other languages as well).

查看更多
Viruses.
4楼-- · 2020-02-16 07:04

For me C++ was my first language too and I guess it was a good choice. You learn all the basic principles of OOP and will understand the logic structure of programming. But of course it depends on what you wanna do with it.

But I'm pretty sure if you switch to rails to do all the fancy web-apps you'll become a much better developper than anyone who started with PHP or - worst case scenario - Rails.

So go for it!

查看更多
Lonely孤独者°
5楼-- · 2020-02-16 07:04

You will make mistakes in any language that you begin to learn. Some languages may have less pitfalls to watch out for, some may have quite a few. Whatever be the language, you are sure to invent your own pitfalls. Now that you have spent about 4 months, I'd suggest you carry on. A switch now may make things more difficult given the fact now you have two things to accomplish:

  • Unlearn C++
  • Learn language X from scratch
查看更多
孤傲高冷的网名
6楼-- · 2020-02-16 07:06

C++ isn't an easy language to learn as noted by everyone else, but there are a few reasons that it makes a decent place to start:

  • it doesn't tie you to a specific programming paradigm (e.g., Java and OOP) so you can experiment with different techniques easily
  • C++ doesn't have the bells and whistles so you can concentrate on making the building blocks if you want to know how they are built
  • since it is a language and not a platform, you can choose the library or libraries that best fit the task at hand or your chosen programming style (e.g., choosing something like Poco for a Javaesque feel, ACE for the gritty early style OO, etc.)
  • it is a general purpose programming language, not a platform (had to say that twice)

The trick is learning it carefully and correctly the first time. I know that I, like many others, have struggled with it by learning it as "C + objects" before really understanding it. It is a hard language to learn. I would recommend looking for an experienced C++ mentor to attach yourself to as well as reading a lot of the "highly recommended" books on how to and how not to write C++. Avoid learning bad habits up front.

For a starting reading list in no particular order:

  • "Accelerated C++" by Koenig and Moo
  • "Effective C++/STL" by Scott Meyers
  • "Object-Oriented Software Construction" by Bertrand Meyer
  • "Expert C Programming" by Peter van der Linden
  • "STL Tutorial and Reference Guide" by Musser, Derge, and Saini
  • "The C++ Standard Library" by Josuttis
查看更多
ゆ 、 Hurt°
7楼-- · 2020-02-16 07:06

For me learning C++ is mostly about learning how NOT to shoot yourself in the foot. It can be a painful exercise as with C++ there is always another edge case that will make the gun go off as it's pointing at your hoof.

The up shot is, if you manage to finish the exercise, you'll be a better developer for it, and you will be able to spot future foot shooting opportunities before they happen, in what ever languages you end up using.

Also, when some third part library shoots it's self in the foot, you'll be better positioned to grok what went wrong than others that haven't repeatedly shot their feet for months on end.

I'd say stick with C++, it's not a waste of time, even if you never write a single line of production C++ code.

Hope this helps :)

BW

查看更多
登录 后发表回答