Download modern_cpp_workshop_1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Video game programmer wikipedia , lookup

Go (programming language) wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Design Patterns wikipedia , lookup

Reactive programming wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Object-oriented programming wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Functional programming wikipedia , lookup

Structured programming wikipedia , lookup

Generic programming wikipedia , lookup

C++ wikipedia , lookup

Transcript
Modern C++ in
practice
Goals
Practical experience of
•
•
•
•
•
C++ best practices, idioms and details
Design patterns in C++
Generic, functional and template programming
Using boost and STL
Utilize APIs, books and mailing lists
Coherent coding style and get to know each other
Why bother with details?
Cons
•
•
•
•
More than 20 years old
Backwards compatible with C
Lots of mistakes in both language and library
Very complex
Pros
•
•
•
•
Powerful features
Well spread
Vivid community
Rapidly developing
Polymorphism in C++
•
•
•
•
•
•
•
•
Virtual keyword
Function pointers
Function overloading
Implicit type conversion
Concepts
Policy classes
Argument dependent lookup (ADL)
Partial template specialization
C++ programming
•
•
•
•
Object oriented programming
Generic programming
Functional programming
Template metaprogramming
Blend these paradigms to acheive code that is
• Simple and easily read
• Decoupled and testable
• Robust to change
• Reusable
Roadmap
Very unclear
Start today and see how it evolves
Think about:
• What you want to learn?
• Should we add or remove goals?
Today
•
•
•
•
•
•
boost::variant
boost::signals
Discuss slots n’ signals relation to bind and function
My observable class
Pair-wise design of a toy problem
Discuss design differences
Toy problem: Cat n’ Rat
Design logical interfaces and concepts for a simple game
2D discrete coordinate world
Contains cats, rats, cheese and obstacles
Move events appear for cats and rats
Collision detection, not handling
Toy problem: Focus
Focus the design on
• Low coupling, high cohesion
• Robustness to future changes
• Event driven information flow
When working try to
• Use boost and STL
• Push error checking towards compile and link time
• Write generic code when it doesn’t complicate design
Future suggestions
Implement logical model
Design and maybe implement:
•
•
•
•
•
Text view
Collision handling
Serialization
Simple client/server
Extend game functionality
Implement message distributor