CSDN: How do you think of writing the book "in-depth application c++11: Code Optimization and Engineering application"? Are there any stories to share?
Iqiyi Art Account
Qiyu: as a developer who used c++11 earlier, when applying c++11 in a project, there was a limited amount of data to be consulted, mainly through the ISO standard (IEC 14,882:2011), Wikipedia, MSDN and http:// en.cppreference.com/w/and other websites to learn c++11. However, the introduction of new features in these places is fragmented, and although you know the basic usage of these new features, sometimes you don't know why you need this new feature, how to apply it in a real project, or what the best practices are, and no one is telling you because there are very few people trying to use C + +. 11, these need to continue to practice, to ponder, then how much hope to have some guidance c++11 practice information AH. In the process of continuous practice, my understanding of c++11 deepened, c++11 constantly bring surprises, in my spy to c++11 the beauty, I would like to share with more people, so that more people better grasp the use of c++11 and appreciate the charm of c++11. This is my intention to share some of the experiences and experience of application c++11 on my technical blog, and the original intention of writing this book.
Hollywood Update
CSDN: Which reader is this book for? What are the main contents of the book? What is the design idea?
Qiyu: suitable for ordinary C + + developers, both novice and veteran, it is necessary to learn and apply the powerful features of c++11,c++11 can greatly improve productivity, make our project development more handy.
This book is divided into two parts, the first part focuses on how to improve our existing procedures to introduce the C++11 new features. This allows the reader to learn about the use of these new features, and it also allows the reader to know how these features improve existing programs, thus enabling a deeper understanding of the new features of C+11, and the latter part of a rich development case to show how to use c++11 to develop projects. Believe that these practical cases can bring more in-depth thinking to the reader.
CSDN: There are many benefits of code optimization, but it doesn't mean that all the code needs to be optimized, sometimes over-optimization is counterproductive, and how do you understand that? How do you operate in the process of practice?
Qiyu: It is true that over-optimization of the code can make the code more obscure, which should be avoided as much as possible, and premature optimizations are not advocated. In fact, in the actual project development process, the code optimization is not to do too much, but do too little, in many cases is to catch up with the progress of the task, or due to their own level of limited, lack of initiative, very few people will spend a lot of time to think about the code optimization, It will not take the initiative to improve the code by applying new technologies or by refactoring.
In the development of the project I will use some best practices to ensure that the code is not easy to make mistakes, such as I do not use bare pointers, only with smart pointers and guard techniques, so I do not have to worry about memory leaks, through the type_traits at compile time to do some constraints to ensure that we at compile time can be early detection problems. Project development to a certain time I will use some third-party tools to review the code, such as source moniter and simian, see if my Code has duplicate code, there is no deep nesting, cyclomatic complexity is not too high and so on, and then refactoring. Doing these things may seem to slow down your development progress, and it doesn't even help your KPI, but it can be very helpful for the quality of your project, maybe someone else is busy fixing the bug after the project is delivered, and you're ready to have a leisurely cup of coffee.
CSDN: What do you think of the new standard for C + +? Are there any new features that make you feel impressive? Does it affect the design of the API? How are existing libraries kept up to date?
June 27 PPS Update
Qiyu: The new C + + standard means stronger productivity and makes C + + more powerful, making it more fun to write C + +. It is said that the important words to say three times, this sentence please repeat three times.
The new C + + standard has many features that are impressive, such as rvalue references to avoid unnecessary copies and improve program performance; variable template parameters make C + + generic programming more powerful; Type_traits can make it easy to calculate types at compile time Smart pointers Let us not worry about memory leaks; libraries allows us to easily write portable concurrent programs; Auto+decltype not only allows us to write code more succinctly but also makes it easier to infer the return type of template functions, Lambda makes the algorithm clearer, and so on. No wonder Bjarne Stroustrup said C++11 looks like a new language, I believe that learning and use of c++11 friends must have Obsession Yan.
The new standard will make the API more reasonable--API design will evolve toward a more concise, clear, grammatical, and semantic noise direction. More important, of course, depends on the users who use these features.
Existing libraries to upgrade to the new standard cost is very small, I hope that the vast number of C + + developers to upgrade the compiler in a timely manner, in the new project to use the new standard, you have lost only an old compiler, and get a huge productivity!
Csdn:c++ 's applications are getting smaller, what do you think is the evolution direction of C + +? Where are the strong areas of C + +? What kind of development will it have in the future?
Qiyu: with the rise of the web and mobile, the application of C + + is relatively small, when a domain under a specialized language to achieve a more concise package, but also easy to use, and no longer need to emphasize the efficiency of the time, C + + is replaced is very normal. In fact, C + + is a general-purpose language that implements the encapsulation of an abstract concept that is sufficiently elegant to be as efficient as possible. So the same, we can see in the foreground pattern bursting case, the background use C + + to do the key performance part is very natural choice. For the core algorithm, the use of C + + can be used to encode multiple compilations at a time, so that under any platform has the best performance, and the upper part can be based on the actual situation and the platform to choose specialized language to write efficiently. In addition, in the server, security, gaming, embedded and other fields, C + + is still a choice, with the advent of new standards, modern C + + will appear in more areas.
Although C++11 has changed a lot compared to c++98/03, C + + is still evolving, vibrant, such as the c++14 and upcoming c++17, C++17 will introduce concept, file libraries, parallel libraries, network libraries, and Coroutine, These are very well-deserved, predictable future, and the development of C + + will be more and more good. With the development of the new C + + standard, the introduction of more and more modern programming language features, C + + will be more and more popular, C++11 's appearance has confirmed this point, in StackOverflow's latest survey, C++11 in all programming languages ranked second, it is no surprise.
Csdn:go language syntax and C + + similar, domestic and foreign advocates are more, do you think it will replace c/c+ in the future?
Qiyu: There is a certain similarity between the two, which, syntactically speaking, is like a C + + that is wrapped in a heavy syntactic sugar, and also removes the ability to compute the compile-time/pre-compilation period. For me personally, the templates and template elements of C + + are interesting and an important reason why I love C + +, which is undoubtedly a lot less fun for programming languages without templates and template elements.
Le View account update
I don't think that go will replace C + + in the future because they don't have the same range of applications. Some of the shortcomings of Go language also affect the go promotion, for example, can not ignore import errors, some key implementations (such as GC) improved sluggish production of software defects and so on. The go language is likely to be better at concurrency and distribution than C + + (this will be remedied in the upcoming new standard c++17, in fact C++11 already has the foundation), while C + + is more rigorous, simple and generic, for C + +, The abstraction that is richer and more concise than go can be achieved while ensuring greater efficiency. As long as you want to do it, C + + can implement most of the keywords in Go (like Go/defer/switch).
In fact, no matter what language, as long as you like and enjoy the fun it brings enough, and to join the language of the full of the struggle for the language of love to do a little practical things.
CSDN: Besides C + +, what languages do you like? What are the tools you use in your daily work?
Qiyu: I also like the C # language, commonly used development tools are VS2013, VIM, eclipse,intelij;uml design tools are EA, code inspection tools are source moniter and simian.
CSDN: Do you open up multiple projects, and will these projects be maintained frequently? What was your purpose in designing? What do you think of the evolution of the open source community?
Qiyu: It's still being maintained, and new projects are being added, and more and more people are involved.
After developing some projects in C # and Java and then going back to C + +, I can't help but feel that C + + has a lot less useful libraries than C # and Java, such as AOP, IOC, ORM, Steam API and so on, so I hope I can do something to make the C + + world a better place, so C + + The days of the developers are getting better, especially after the c++11 comes out, the desire is even stronger, which is the original intention of me to open up some of the basic libraries I have developed in my work, and it is also the motivation for me to invest in the open source community.
I understand that the open source community is not utilitarian, relying on a large number of programming enthusiasts love of programming, rely on a little dream. In addition to these, the development of the open source community should be realistic and practical, so that more people will be willing to participate. Now for the C + + community is a golden age, because of the continuous development of new standards, some of the previous difficult things to do with modern C + + has become very simple, with modern C + + to do what predecessors did not do, to make up for the shortcomings of the C + + world is just its time. The C + + community (purecpp.org) I created was born in this context, with not only high-quality original technical articles in the community, but also wired technology salons (recently organized a technology salon with a theme of C + + magic, details here: http://purecpp.org/?p =202), as well as active open source projects, here is an interesting thing we're doing right now, an open source project in our community, a modern web framework inspired by modern C + +, and our community upgrades will use this framework, Community sites will also be developed in modern C + +, so stay tuned.
CSDN: Share some experiences and insights for C + + enthusiasts.
Qiyu: interest is the best teacher, enjoying the fun of modern C + + makes it easier for you to learn C + +. Any book or material can only get you started, the most important thing is practice. When you enjoy your favorite programming language, be thankful, when you do something for the development of the language in your spare time, life will add more fun.
C++11 makes the program more concise and more modern