What is the best way to learn C++ if I have a bit

2020-02-17 07:11发布

Just would like some thoughts of what you think about my strategy to learn C++. While I understand that it takes years to master a programming language, I simply want to get to the point where I can be considered competent as quickly as possible. Why quickly? Well when I say quickly I'm really saying I'm committed, and that I don't want it to take forever where forever is never. If it takes five years to become competent, it takes five years. I'm not expecting 24 hours or 30 days.

About me: I don't have a CS degree, I have an anthropology degree and a Masters in library science. Learning the CS fundamentals such as Big O notation, and basics such as binary trees and linked lists, sort algorithms has been a challenge. Probably nothing substitutes a good CS degree. :( I do have many years programming experience, starting with PHP in 2001, ActionScript, 2003, JavaScript soon after. I have been writing programs in Python for about two years now and I have learned C (by reading the K&R book and writing some programs), but I'm probably not going to get hired for a C job. Also recently learned Objective C. I work as a JavaScript & Python, & CSS developer at a website at the moment.

Anyhow, this is my strategy: Read the Stroustrup book (I just started on Part I) and at the same time start a simple C++ project, while also doing many of the Stroustrup exercises.

Thoughts?

标签: c++
13条回答
【Aperson】
2楼-- · 2020-02-17 07:36

My usual advice is to keep C and C++ separate. Don't assume that C advice or best practices apply to C++, and vice versa. Keeping that in mind will probably help you avoid a lot of bad habits.

查看更多
我想做一个坏孩纸
3楼-- · 2020-02-17 07:38

Bjarne's book is fantastic, especially for C++ syntax, but the one book that will really make you a competent C++ programmer is Meyers' Effective C++. Get it. Read it.

I as well do not have a CS degree, but I work for a silicon valley startup. It is possible, you just have to be aware of what's out there and never stop learning. Many students who graduate with a computer science degree end up working in a language they didn't study, so be sure to hit the fundamentals. If you hear something that's unfamiliar to you, be sure to find a good book and a coffee shop and get to it. The C++ will come in time - with Stroustrup and Meyers, you've got 90% of what it takes to be good at C++

查看更多
老娘就宠你
4楼-- · 2020-02-17 07:40

I don't htink the Stroustrop book is a good place to start. It's more of an advanced/reference book. I would start with Thinking in C++ (Volume 1) (and Volume 2. And write lots of code. Once you've got a basic handle on the code I would get the Scott Meyer Effective C++ books and definitely the Stroustrop book.

查看更多
够拽才男人
5楼-- · 2020-02-17 07:42

One of the critical things to really become better is to others have a look at your code. When others say 'WTF' to your code, you can improve it and learn from your mistakes.

Try to use code analysis tools, try to use C++ conventions (for example google's http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml), try to use valgrind for memory leak detection. Learn how to write Make scripts manually, try some cross platform compilations to see what parts are tricky.

You might also want to take a look at some popular libraries such as boost.

As of the project, make it opensource so people can look at it and give you suggestions. To really incorporate your lack of CS education, grab a scientific paper and try to implement it using c++. Check the results and compare them.

查看更多
Summer. ? 凉城
6楼-- · 2020-02-17 07:44

Here is the reading/learning list I suggest

  • First read Thinking in C++ first edition (get the syntax straight)
  • Read Scott Meyer's book Effective C++ (get the finer nuances)

After which you can branch out to the following. You can skip all except maybe 1st. You may use boost, STL, whatever to learn these 1 Learn to use strings & other containers (know when to use which container) 2 Assuming you already know XML, learn to use XML from C++ (Write a WBXML to XML translator maybe) 3 Review your TCP/IP fundamentals, (write simple XMPP based chat client maybe) 4 You may wish to learn some GUI toolkit GTK+, Qt, MFC, whatever

At this time you may want to branch out into reading about design patterns. I recommend 'Design Patterns Explained'.

Once you've spent over an year working with C++ you may want to read, among others, "Inside the C++ Object Model".

Also, I don't recommend that you read Stroustrup but YMMV.

HTH

查看更多
Root(大扎)
7楼-- · 2020-02-17 07:44

Quite frankly, if you've done a good job of learning C, and you've done object oriented programming (since you've learned objective C), you don't need to overthink your approach to learning C++.

That said, your plan is good.

查看更多
登录 后发表回答