SlideShare a Scribd company logo
1 of 31
Download to read offline
ACCU York is looking for
• Sponsors
• Pay for zoom
• Speakers
• Study groups
• ACCU Members
Agenda
• Welcome
• C++ workshop
• Post talks chat / drinks
meetup.com/ACCU-York
@accuYork
C++ workshop
Clickbait?
Why a
workshop?
 Programming has lots of complex
aspects
 We want to be proficient at as many
aspects as possible
 This can be achieved via practice and
discussion
 A workshop is not completely freeform,
there are particular learning outcomes
in the workshop, I will guide/facilitate
your learning
How to get the most out of this
 If I am vague, omitting detail, using unfamiliar terms, or you feel lost
 Tell me
 I can refine my explanation
 We can diverge onto other necessary topic
 If you disagree
 Tell me
 Could be a misunderstanding
 It may be different trade-offs or priorities
 I may be wrong
“This stuff is obvious”
 It may be
 Lets communicate (we can’t read minds)
 Opportunity to share extra detail
 Knowing something and articulating something are very different
 Improve communication skill
 Refine your understanding
 Don’t ruin it for others
 “Its not obvious to me”
 Nothing to be ashamed of
 Develop your understanding
 This is a safe space
 Through mistakes, we learn and gain new understanding
The workshop!
A simple code exercise
 If it was too complex
 not everyone could do it
 the lessons learned may be hidden by the complexity
 This is literally an interview question I found on the internet
 we don’t care about if you can solve the puzzle
 as a group we will all have the solution in less than a few minutes (I will tell you)
 we are just using the exercise as coding practice
https://godbolt.org/z/HpVcXw
Using STL
containers and
algorithms
STL (July 1994)
Alexander Stepanov
 Massive influence on the STL
 “primary designer and
implementer of the C++
Standard Template Library”
 Philosophy based on:
 Mathematics
 Category theory (regular types)
 Performance (zero cost
abstraction)
Iterators
 Controls
 Access to item
 Traversal to next item
 Access and traversal are decoupled
 Iterator pointing somewhere nonsense is fine, just don’t
access it
 Access and traversal can be to whatever the iterator
wants
 Transform iterator?
 Filter iterator?
Half open intervals
[ begin(), end() )
Iterators decouple
containers from algorithms
 Generic programming
 {vector, list, array, deque, string} x {find, copy, partition, nth_element}
 9 implementations
 20 combinations
 Works because iterators are a customization point
 Controlling access and traversal
All problems in computer science can be solved
by another level of indirection -- David Wheeler
Clickbait?
 How do things with C#’s List?
 x.Reverse(), x.Sort()
 Just there “dot thing…”
 How do things with Java’s ArrayList?
 Collections.reverse(x), Collections.sort(x)
 Elsewhere, but you can still apply it to a collection
 How do things with C++ std::vector?
 std::reverse(x.begin(), x.end()), std::sort(x.begin(), x.end())
 Elsewhere, but done via iterators, and C++ iterators are not the same as C#/Java
https://godbolt.org/z/HpVcXw
https://en.cppreference.com/w/cpp/algorithm
Less than 15 lines
of code
https://godbolt.org/z/DzKkMz
 Readability
 STL algorithms/methods
 find, reverse, next
 Variable names
 Variable scope
 Small dedicated loops
 Const variables
 No exceptions
 No error cases
 No allocation
 Not optimizing for the
unexpected case
More practice 1
https://godbolt.org/z/5o3hM6
https://en.cppreference.com/w/cpp/algorithm
https://godbolt.org/z/5o3hM6
https://godbolt.org/z/5LAYiZ
More practice 2 https://godbolt.org/z/An6CAN
https://godbolt.org/z/An6CAN
https://godbolt.org/z/NWeNZL
https://youtu.be/W2tWOdzgXHA

More Related Content

Similar to ACCU May 2020

James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016Foo Café Copenhagen
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oopcolleges
 
Master Beginners' Workshop September 2018
Master Beginners' Workshop September 2018Master Beginners' Workshop September 2018
Master Beginners' Workshop September 2018Miguel Pardal
 
Creativity vs Best Practices
Creativity vs Best PracticesCreativity vs Best Practices
Creativity vs Best PracticesSupun Dissanayake
 
MLlecture1.ppt
MLlecture1.pptMLlecture1.ppt
MLlecture1.pptbutest
 
MLlecture1.ppt
MLlecture1.pptMLlecture1.ppt
MLlecture1.pptbutest
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - IntroductionNeeldhara Misra
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionSamuelAnsong6
 
Xen Project Contributor Training Part 3 - Communication v1.0
Xen Project Contributor Training Part 3 - Communication v1.0Xen Project Contributor Training Part 3 - Communication v1.0
Xen Project Contributor Training Part 3 - Communication v1.0The Linux Foundation
 
Helping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMSHelping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMSMartin Homik
 
Framework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users GroupFramework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users Groupbrada
 
The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)
The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)
The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)Dave Hogue
 
Reverse engineering and theory building v3
Reverse engineering and theory building v3Reverse engineering and theory building v3
Reverse engineering and theory building v3ClarkTony
 

Similar to ACCU May 2020 (20)

James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
Master Beginners' Workshop September 2018
Master Beginners' Workshop September 2018Master Beginners' Workshop September 2018
Master Beginners' Workshop September 2018
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Creativity vs Best Practices
Creativity vs Best PracticesCreativity vs Best Practices
Creativity vs Best Practices
 
MLlecture1.ppt
MLlecture1.pptMLlecture1.ppt
MLlecture1.ppt
 
MLlecture1.ppt
MLlecture1.pptMLlecture1.ppt
MLlecture1.ppt
 
Lec 01 introduction
Lec 01   introductionLec 01   introduction
Lec 01 introduction
 
d.Maps: Discussion 3 Prototyping
d.Maps: Discussion 3 Prototypingd.Maps: Discussion 3 Prototyping
d.Maps: Discussion 3 Prototyping
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - Introduction
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
 
Xen Project Contributor Training Part 3 - Communication v1.0
Xen Project Contributor Training Part 3 - Communication v1.0Xen Project Contributor Training Part 3 - Communication v1.0
Xen Project Contributor Training Part 3 - Communication v1.0
 
2CPP19 - Summation
2CPP19 - Summation2CPP19 - Summation
2CPP19 - Summation
 
BDD Primer
BDD PrimerBDD Primer
BDD Primer
 
Helping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMSHelping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMS
 
Framework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users GroupFramework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users Group
 
The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)
The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)
The Complexity Curve: How to Design for Simplicity (SXSW, March 2012)
 
Reverse engineering and theory building v3
Reverse engineering and theory building v3Reverse engineering and theory building v3
Reverse engineering and theory building v3
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

ACCU May 2020

  • 1.
  • 2.
  • 3.
  • 4.
  • 5. ACCU York is looking for • Sponsors • Pay for zoom • Speakers • Study groups • ACCU Members
  • 6. Agenda • Welcome • C++ workshop • Post talks chat / drinks
  • 10. Why a workshop?  Programming has lots of complex aspects  We want to be proficient at as many aspects as possible  This can be achieved via practice and discussion  A workshop is not completely freeform, there are particular learning outcomes in the workshop, I will guide/facilitate your learning
  • 11. How to get the most out of this  If I am vague, omitting detail, using unfamiliar terms, or you feel lost  Tell me  I can refine my explanation  We can diverge onto other necessary topic  If you disagree  Tell me  Could be a misunderstanding  It may be different trade-offs or priorities  I may be wrong
  • 12. “This stuff is obvious”  It may be  Lets communicate (we can’t read minds)  Opportunity to share extra detail  Knowing something and articulating something are very different  Improve communication skill  Refine your understanding  Don’t ruin it for others  “Its not obvious to me”  Nothing to be ashamed of  Develop your understanding  This is a safe space  Through mistakes, we learn and gain new understanding
  • 14. A simple code exercise  If it was too complex  not everyone could do it  the lessons learned may be hidden by the complexity  This is literally an interview question I found on the internet  we don’t care about if you can solve the puzzle  as a group we will all have the solution in less than a few minutes (I will tell you)  we are just using the exercise as coding practice
  • 16.
  • 18. STL (July 1994) Alexander Stepanov  Massive influence on the STL  “primary designer and implementer of the C++ Standard Template Library”  Philosophy based on:  Mathematics  Category theory (regular types)  Performance (zero cost abstraction)
  • 19. Iterators  Controls  Access to item  Traversal to next item  Access and traversal are decoupled  Iterator pointing somewhere nonsense is fine, just don’t access it  Access and traversal can be to whatever the iterator wants  Transform iterator?  Filter iterator?
  • 20. Half open intervals [ begin(), end() )
  • 21. Iterators decouple containers from algorithms  Generic programming  {vector, list, array, deque, string} x {find, copy, partition, nth_element}  9 implementations  20 combinations  Works because iterators are a customization point  Controlling access and traversal All problems in computer science can be solved by another level of indirection -- David Wheeler
  • 22. Clickbait?  How do things with C#’s List?  x.Reverse(), x.Sort()  Just there “dot thing…”  How do things with Java’s ArrayList?  Collections.reverse(x), Collections.sort(x)  Elsewhere, but you can still apply it to a collection  How do things with C++ std::vector?  std::reverse(x.begin(), x.end()), std::sort(x.begin(), x.end())  Elsewhere, but done via iterators, and C++ iterators are not the same as C#/Java
  • 24. https://godbolt.org/z/DzKkMz  Readability  STL algorithms/methods  find, reverse, next  Variable names  Variable scope  Small dedicated loops  Const variables  No exceptions  No error cases  No allocation  Not optimizing for the unexpected case
  • 28. More practice 2 https://godbolt.org/z/An6CAN