看了篇文章,转过来,分享~~~
url:
http://itscompiling.eu/2016/03/10/why-learn-cpp-2016/
“C++ is dead”
I’ve been hearing this since I went to the university. That’s like 10 years ago. Back then Java was already dominant language in the corporate world, at least in the USA. If you’re a programmer you’re probably familiar with the Joel Spolsky’s famous rant about JavaSchools (good read as always from Joel). It’s dated Dec 2005. C#, which came around in 2000, was a Microsoft answer to Java and was also said to be C++ killer. Then, the dynamic languages were all the rage. Ruby and Python began trending. Given all those easy-to-use languages, why would you choose C++ for anything? Isn’t that a prettier C, which again is a prettier assembly language? If you have an hour you can listen to a great talk given by Herb Sutter, and if not, there’s a shorter talk with concrete examples. Take look a TIOBE index and you’ll see that C++ occupies a steady 3rd place in the list of the most popular languages for the past 15+ years. Not bad for an old language. Which brings me to another point…
大学时代,我就听过这样的说法——差不多十年前的事儿了。
那时候至少在美国,Java已经成了各公司的主流语言。
微软推出C sharp应对Java,也有C++杀手的称号。
这之后,动态语言风靡一时,Ruby和Python开始流行起来。
那么,既然有了这些好用的语言,我们为什么还要选择C++语言呢?从TIOBE语言排行榜中我们可以发现,在过去逾15年的时间里,C++一直稳居最受欢迎语言列表的第三名.
How do you like them pointers?
Most people who instantly associate C++ with pointers have been taught the wrong way. It’s the old school of “C with classes”. I know from my own experience how bad it is. Exercises with passing multi-dimensional C-arrays to functions. Pointer arithmetics. Manual memory management as if containers and smart pointers didn’t exist. Implementing doubly-linked lists. All that, which should be taught in C classes. Maybe there’s nothing wrong in teaching C++ this way? Well, Think again.
Of course, a professional programmer should understand how pointers work. But that’s not what modern C++ is about. C++ is constantly evolving. What used to be deemed proper code yesterday, can be considered bad style today.
The language is getting overhauled. Quoting Bjarne Stroustrup: “C++11 feels like a new language: The pieces just fit together better than they used to and I find a higher-level style of programming more natural than before and as efficient as ever”. C++ now has lambdas, memory model, range-based for loops, move semantics, variadic templates and all other less or more advanced things to help you with a task at hand. You have some old code, which needs an update to the new standard? Boom! clang-tidy to the rescue. It’s a super cool tool that uses static analysis to find old patterns in your code and suggest how to alter it. Lack of tools was always a pain when working with C++ but that’s changing. You thought only Java has automatic refactorings? Listen to Chandler Carruth, the LLVM/clang ninja from Google. They apply automatic refactoring to 100 million lines of C++ code at once!
C++被吐槽最多的应该是指针了,但是指针已经不是现代C++的主旨了,因为C++中也有了智能指针。
。。。。。
Corporate codebase reality
Lots of CS undergrad folks imagine their careers are going to be sort of a rockstar/ninja/superhero experience. “Just wait ’till the world can see what I can do!”. It has to be this way because, well, “I’m above average“, right? You expect long hours of designing and implementing complex algorithms (at least I did). Then you get your first job and WHAM! You get “schlonged” with 20 years old code that appears to be the result of experimenting with hard drugs. strcpy with fixed buffers scattered over hundreds of files, thousand-line-long functions, 5 versions of hand-written linked lists – you name it. You roll up your sleeves to somehow clean up this mess. “Hold your horses, young apprentice! Business needs this feature implemented yesterday. No, we can’t use new GCC, ’cause the other team’s not ready to switch” – says your manager. Now you think “where did I make a mistake…”.
This problem is not C++-specific. Happy debugging of some old Java code created by a reflection enthusiast. If you’re a web dev you’re likely to be exposed to some radioactive PHP. Even if you code in Ruby or Python or some newer language, the amount of grunt work can suck all the energy from you. “Can you move that button to the right and make it pink?”. That’s the reality of working at most companies. What I’m hitting at is that, barring the swaths of legacy or boring code, there are programming jobs that are both challenging and entertaining with a minimal amount of business BS. Some of those jobs happen to be found in areas where C++ shines…
Where C++ is king: games, HPC, compilers, financials…
If you want to avoid spending your lifetime implementing CRUD stuff, you might consider learning C++ along with choosing a niche. Here are some of my propositions.
Game industry. Almost all AAA titles are created using C++. Video game developer is considered to be one of the most rewarding jobs in a software industry. It’s also one of the most demanding areas of it. Speed is very important, which is why writing effective code is essential. Other than knowing C++ specializing in game dev is mostly about learning theory and patterns that transcend particular API/libraries. Strong graphics and mathematical skills are often required. Enough to learn for a whole career.
游戏行业:几乎所有3A游戏都是使用C++编写的。大众公认电子游戏的开发者是软件行业里回报最高的工作之一,也是需求量最大的领域之一。因为速度非常重要,所以编写高效的代码就是最基本的要求。除了要懂C++之外,精通游戏开发更应注重理论与模式的钻研,而不限于特定的API或者Library。通常还必须具备高超的图形与数学技能,这些知识足够你活到老学到老。
HPC. Crunching numbers at extreme speeds requires excellent knowledge of underlying hardware. That knowledge has to be applicable directly in the language. The appearance of GPGPUs along with parallel computation frameworks such as CUDA and OpenCL created demand for C++ programmers with this kind of expertise. If you’re into scientific computing there’s a plenty of jobs out there. Have you heard about machine learning? It’s a hot topic nowadays.
HPC:以极限速度处理数据,要求对底层硬件有深刻的理解,这类知识可以直接应用在语言中。通用图形处理器(GPGPU)及CUDA、OpenCL之类的并行计算框架的出现,引发了对有这类技术的C++程序员的需求。如果深入到科学计算领域,还有很多能做的工作。不知你是否听说过机器学习?这是当今的热门话题。
Compilers. This is my favorite area. The LLVM project is such a huge success that it’s hard to find a popular language which either doesn’t have front end written using LLVM libraries or doesn’t use LLVM to generate bytecode. It’s all C++. Although compilers are written in various languages, the theory standing behind implementations is the same in all cases. You get to work with optimizers, static analyzers, debuggers, standard libraries, linkers and all other related tools. There are engineering problems along with theoretical ones.
编译器:这是我最喜欢的领域,LLVM项目如此成功,以致于很难找到一种既未使用LLVM库编写前端,也没有使用LLVM生成字节码的流行语言,而这些全都是C++。尽管编译器是以各种语言编写而成,但其背后的实现原理是相同的。我们使用优化器、静态分析程序、调试程序、标准库、链接器以及所有其他相关的工具来工作。
If you’re into financials, there’re plenty of jobs requiring ability to write low-latency code. Mathematical background is a big plus in this area. Probably most of those jobs involve developing and maintaining high-frequency trading platforms. Also, it’s a great domain if you don’t want to call yourself a programmer. I’d say quants have the most opportunities to get big bonuses among all coders.
除此之外,金融领域也有很多工作需要有能力编写低延迟代码的程序员。在这个领域,数学背景也是一大加分亮点。该领域的大多工作可能都涉及到开发与维护高频使用的交易平台。另外如果不想挂着程序员的名头,这个领域也是很棒的选择。可以说负责设计并实现金融数学模型的宽客(Quant)职位是所有程序员中最有可能获得高额奖励的。
That’s just a handful of propositions. What’s common for those niches is that you simply cannot throw large enough number of Java rookies at a problem and expect them to come up with a working, maintainable solution. There’s a lot of domain knowledge required, which you can only get when working with experienced people. That means they are not easily replaceable. Ergo, companies have to pay them more and give them interesting problems to work on in order to keep them. Of course, there’s grunt work to be found everywhere, but it’s much more tolerable when you work on something you genuinely care for.
If you have your own C++ niche or disagree with my line of thinking, please let me know in a comment.
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow