Your SlideShare is downloading. ×
0
The Renaissance of C++by Victor Haydin, Head of R&D Office, ELEKS
AgendaA bit of C++ historyWhy C++ is popular again?The future of C++
Quick SurveyWhat programming languages do you know?
A bit of C++ history
The Prehistoric Age         (1979-1989)    Research:C with Classes   ARM C++
The Classic Age          (1989-1999)   Mainstream:    Wide usagestandardization
The Dark Age                               (1999-2009)Coffee-based languages domination:         Productivity over Efficie...
Let’s compare them all                       Efficiency          Flexibility         Abstraction   ProductivityCEfficient ...
Perception     Performance     & Control     Productivity
Reality          Performance   Productivity          & Control
C++ Values   Never compromise on performance and control.       Efficient abstraction (e.g., inlining by default)      ...
Priorities   C++ says:     “Provide default-on guard rails and programmer productivity too,      but never at the expense...
Why C++is popularagain?
Change driversMobileCloud/DatacenterPlatform shifts
Mobile
Power
Hardware limitations
Complex user experience
Vendor’s point of view 1st version          N/A                Java         .NET2nd version    Objective-C, C, C++   Java,...
Datacenter/Cloud
Power consumption           57% Hardware +           31% Power = 88%           of expenses are directly           dependen...
Platform shifts
The Renaissance             (2009-2019)Return of the King:            C++11 Productivity tools
Developer survey    Q: How long has your current application been in development?   (N=387)
C++11   Corollary: Lots of what people “know” about C++ is no longer true.   Changes to coding style/idioms/guidance.   ...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );    return s;}int main() {    vector<future<string>...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );                                                   ...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );    return s;}int main() {    vector<future<string>...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );                               asynchrony    return...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );                                     lambdas    ret...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );    return s;}int main() {    vector<future<string>...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );    return s;}int main() {    vector<future<string>...
Taste of C++11string flip( string s ) {                                                                              move ...
Taste of C++11string flip( string s ) {    reverse( begin(s), end(s) );    return s;}int main() {    vector<future<string>...
Taste of C++11string flip( string s ) {                                                                   program is guar...
Summary   Modern C++ is clean, safe, and fast.       Strong abstraction: Type-safe OO and generic code for modeling powe...
The Future          (2019-????)Here be dragons:   End of Moore
Moore’s law
Reality
Register atacademy.eleks.combefore February 15And may the Forcebe with you!
Got a question?      Ask!
Upcoming SlideShare
Loading in...5
×

The Renaissance of C++

916

Published on

Inspired by Herb Sutter

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
916
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "The Renaissance of C++"

  1. 1. The Renaissance of C++by Victor Haydin, Head of R&D Office, ELEKS
  2. 2. AgendaA bit of C++ historyWhy C++ is popular again?The future of C++
  3. 3. Quick SurveyWhat programming languages do you know?
  4. 4. A bit of C++ history
  5. 5. The Prehistoric Age (1979-1989) Research:C with Classes ARM C++
  6. 6. The Classic Age (1989-1999) Mainstream: Wide usagestandardization
  7. 7. The Dark Age (1999-2009)Coffee-based languages domination: Productivity over Efficiency People over Hardware
  8. 8. Let’s compare them all Efficiency Flexibility Abstraction ProductivityCEfficient high-level + + Non-goal Non-goalportable codeC++C + efficient + + + Non-goalabstractionJava/C#Productivity At the expence of At the expense of + +
  9. 9. Perception Performance & Control Productivity
  10. 10. Reality Performance Productivity & Control
  11. 11. C++ Values Never compromise on performance and control.  Efficient abstraction (e.g., inlining by default)  Flexibility to express exactly what you need (e.g., specialization)  Exact control over memory layout (e.g., stack/member allocation)  Determinism and ordering WYSIWYG (e.g., stack/member lifetime) Deeply believe in trust and zero overhead.  “Leave no room for a language lower than C++” other than asm  “Zero overhead” / “Don’t pay for what you don’t use”  “Trust the programmer” (  pitfalls! still give usability, guard rails)  “Always provide a way to open the hood and get down to the metal”
  12. 12. Priorities C++ says: “Provide default-on guard rails and programmer productivity too, but never at the expense of performance and control.” Coffee-based languages say: “Provide performance and control too, but never at the expense of always-on guard rails and programmer productivity.”
  13. 13. Why C++is popularagain?
  14. 14. Change driversMobileCloud/DatacenterPlatform shifts
  15. 15. Mobile
  16. 16. Power
  17. 17. Hardware limitations
  18. 18. Complex user experience
  19. 19. Vendor’s point of view 1st version N/A Java .NET2nd version Objective-C, C, C++ Java, C, C++ .NET, C++
  20. 20. Datacenter/Cloud
  21. 21. Power consumption 57% Hardware + 31% Power = 88% of expenses are directly dependent on efficiency
  22. 22. Platform shifts
  23. 23. The Renaissance (2009-2019)Return of the King: C++11 Productivity tools
  24. 24. Developer survey Q: How long has your current application been in development? (N=387)
  25. 25. C++11 Corollary: Lots of what people “know” about C++ is no longer true. Changes to coding style/idioms/guidance.  That’s why it feels new. Style/idioms/guidance define a language.  Features that significantly change style/idioms/guidance include:
  26. 26. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); return s;}int main() { vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  27. 27. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); always there: scoped lifetimes return s; by construction (stack, member)}  strongly exception-safeint main() { vector<future<string>> v;  deterministic v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  28. 28. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); return s;}int main() { vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  29. 29. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); asynchrony return s;}  201x’s best friendint main() { vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  30. 30. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); lambdas return s;}  invasion of the functionalsint main() {  capture by ref or by value vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  31. 31. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); return s;}int main() { vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  32. 32. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); return s;}int main() { vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  33. 33. Taste of C++11string flip( string s ) { move semantics reverse( begin(s), end(s) ); = return s;  the semantics of value types} (no pointers! declared lifetime!)int main() { + vector<future<string>> v; // <-- look ma, no *  the efficiency of reference types (no deep copying!) v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); }}
  34. 34. Taste of C++11string flip( string s ) { reverse( begin(s), end(s) ); return s;}int main() { vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); Hello, Lang.NEXT! }}
  35. 35. Taste of C++11string flip( string s ) {  program is guaranteed to reverse( begin(s), end(s) ); allocate only three strings return translate_to_french( move(s) );}  high compute / low latencyint main() { vector<future<string>> v; v.push_back( async([]{ return flip(" ,olleH"); }) ); v.push_back( async([]{ return flip( ".gnaL"); }) ); v.push_back( async([]{ return flip("n!TXEN"); }) ); for( auto& e : v ) { cout << e.get(); Bonjour, Langue.SUIVANTE! }}
  36. 36. Summary Modern C++ is clean, safe, and fast.  Strong abstraction: Type-safe OO and generic code for modeling power, without sacrificing control and efficiency.  Full control over code and memory: You can always express what you want to do. You can always control memory and data layout exactly.  Pay-as-you-go efficiency: No mandatory overheads.“The going word at Facebook is that ‘reasonably written C++ code just runs fast,’ which underscores the enormous effort spent at optimizing PHP and Java code.Paradoxically, C++ code is more difficult to write than in other languages, but efficient code is a lot easier.” – Andrei Alexandrescu
  37. 37. The Future (2019-????)Here be dragons: End of Moore
  38. 38. Moore’s law
  39. 39. Reality
  40. 40. Register atacademy.eleks.combefore February 15And may the Forcebe with you!
  41. 41. Got a question? Ask!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×