C++11/14编程实战

C++11/14编程实战
    马上咨询


    丁老师  历任美国纳斯达克上市的顶级大数据技术平台公司的高级技术经理、架构师, EMC首席工程师、趋势科技技术经理等。
    从业超过10年,熟悉大数据平台构建技术、大数据分析可视化技术,安全领域技术等,长期任职于大数据平台DevSecOps、AIOps的构建相关领域的产品与研发工作。Python领域公认专家,擅长Python、C++、JS与Scala。在大数据处理与安全领域,拥有6项美国专利。深入浅出的讲解分享。PyCon首席讲师、云栖专栏讲师等,分享过20+场演讲或直播,覆盖AIOps、大数据分析处理、调度监测、可视化分析与Python核心系列等十多个不同议题系列,观众赞誉极高。  

    课程目标

    本课程帮助学员能够:

    • 理解并掌握C++11/14的语言核心,从核心基础如统一初始化,有用组件如lambda,到高级主题如唯一指针、多线程到内存模型。
    • 深入理解C++11/14的陷阱并且知道如何在适合场景试用它们。
    • 理解面向对象的技术、以及高级的继承相关问题,如私有继承、多继承和虚拟继承。
    • 使用不同内存管理技巧和策略来定制和优化C++程序的内存使用。
    • 设计、实现和使用模板函数和模板类,并利用标准C++库。
    • 使用C++异常来简化大型程序的错误处理。
    • 使用设计模式、习语和泛型编程技术来编写高可用、可维护、高效与高性能的C++程序。
    • 知道如何编写有效安全的多线程代码。

    课程大纲

    第一天上午
    介绍Introduction
    - 自我介绍Introduction tomy self
    -课程大纲 The courseoutline
    - C++历史Evolution of C++
    C++11/14
    - C++ 11 特性与实例Features withexamples
        --auto
        --decltype
        --nullptr
        --for-loop
        --C++ 03 初始化
        --C++ 11统一初始化
        --简化的类初始化
        --default/delete
        --final/override
        --可变模板参数variable template args
        --改进的库介绍
    - C++ 14 特性和实例
        --函数返回类型识别function return type detection
        --const 表达式
        --改进的库介绍
    C++ 面向对象原则与知识
    - 抽象与封装Abstraction and encapsulation
    -继承与多态Inheritance and polymorphism
    -关系Relationships
    -模式与习语Patterns and idioms
    -拥有关系Has-a
    -“是”的关系Is-A
    -由…实现的关系Is-Implemented-in-terms-of
    -“是”关系的C++实现Is-A, Is-Implemented-of in C++
    -私有继承习语Private inheritance idiom
    复制与转换Copyingand Conversion
    - 隐式转换implicit conversion
    - 上转与下转up-cast,down-cast
    - 类的隐式转换implicitconversion for class
    - 构造转换函数constructconversion function
    - 赋值与转换函数assignment& conversion function
    - 第二转换2nd conversion
    - 转换操作符Castingoperators
    - 静态转换Static Casting
    - 动态转换Dynamic Casting
    - 物理转换Physical Const
    - Const化: enum and pointer
    - Const化: class field
    - Const化:类函数内
    - Const不是灵丹妙药
    - 逻辑Const化: mutable
    - 左值 vs. 右值
    - 移动习语支持 (右值应用)
    练习与作业
    第二天上午
    内存管理MemoryManagement
    - 对象什么周期Object lifecycle
    - 分配失败Allocationfailure
    - 内存对其Memory Alignment
    - 空基类优化习语Empty BaseOptimization Idioms
    - 资源返回问题Resource ReturnProblem
    - 资源返回习语Resource Returnidioms
    - C++11 智能指针: unique_ptr
    - C++11 智能指针: shared_ptr
    - 智能指针并非万能
    异常处理与异常安全ExceptionHandling/Safety
    - 为什么异常Why exceptionhandling?
    - 异常分类与处理Classifyingand handling exceptions
    - 抓取异常与抛出异常Catching andthrowing exceptions
    - 标准异常体系Standardexception hierarchy
    - 违背约定Contractviolations
    - 异常安全级别ExceptionSafety levels
    - 构造函数中的异常Exceptions inconstructors
    - 析构函数中的异常Exceptions indestructors
    - RAII习语与异常安全
    - 复制与转换习语Copy-and-SwapIdiom
    - 安全转换习语Safe swap Idiom
    第二天下午
    模板与函数子改进Templateand functors improvement
    - C++11的模板技术改进
    - C++11的Type traits
    - STL 容器的改进
    - Lambda (C++11)
    - Lambda 改进(C++14)
    更多设计模式与习语   
    - The Object Adapter pattern
    - The Null Object Pattern
    - AOP, Decorator Pattern
    - 装饰器模式DecoratorPattern
    - AOP and Parameterized Base Class Idiom
    - 策略模式Strategy Pattern
    - Policy based class design
    - 模板方法模式The TemplateMethod pattern
    - Default virtual implementation idiom
    - Named Parameter Idiom
    练习与走也
    第三天早上
    并发
    - 并发与并行
    - 异步与并发
    - 任务与线程
    - C++11 并发一览
    - 多线程的Hello World
    - 管理线程
    - 线程退出
    - 避免线程提前退出
    - 线程本地存储 (C++ 11)
    - 高性能计算
    - HPC 例子
    - 多线程方案
    并发
    -
    - Mutex
    - shared_mutex (C++ 14)
    - lock_guard/unique_lock
    - Locking and Dead lock
    - std::lock
    - std::call_once
    - 线程间共享对象
    第三天下午
    高级对象分享
    - Semaphore
    - 条件变量
    -
    - promise
    - packaged_task
    - futures
    - future
    - 共享的future
    - async
    原子类型
    -
    - 内核模式vs. 用户模式锁
    - 原子操作
    - std::atomic_flag
    - Lock-free 编程
    数据竞争与内存模型
    - Data Race examples
    - Memory Order
    - Memory Model
    - x86 scenarios


















































































    Overview   

    C++ isthe standard language for implementing object-oriented designs, but althoughbased on C, C++introduces many subtle syntactic and design issues. Fordevelopers whose C++ experience goes back further,many ofthe changes as a result of standardization make standard C++ a very differentprogramming environment.This course will keep the audience abreast of these changes. It covers fourmain areas: new andadvanced language features; using the standard library; implementingobject-oriented concepts and patternsin C++; effective C++ programming techniques and idioms. It also suggests waysto maximize efficiency,code quality, and reusability. Delegates will gain a greater understanding ofthe capabilities and potentialpitfalls of the C++ language and will be more able to use C++ language featuresto write robust,qualitysoftware and you will also have a good grounding to make the best use ofspecific component technologies,such as Design Patterns, Idioms, STL.

    This a comprehensive two-day course with a combination oflectures and practical sessions for each chapter toreinforce the topics covered throughout the course. The practical use codeskeletons, so that you can concentrateon specific C++ features.

    Beforethe training, it presumes Delegates:

    - 2+ years working experiences of softwaredevelopment would be helpful. At least 1-year working experiences with C++

    - A paper examination will be conductedbefore the training to ensure the delegates pass the criteria of this trainingthat is listed as below:

            - Know C++ basic syntax including what is C++, howto define class, inheritance. Know reference, overloading, constructor,destructor, virtual meaning in C++.

            - Know basic concept of template, STL. Some experiencesof using STL would be helpful.

            - Know Object-oriented basic concepts and OO designlike interfaces vs. class. Know what is exception.

            - Know basic concept of operation system. Knowdifferences of process and thread. Knowledge of basic memory and Processmanagement by OS would be helpful.

    OnCompletion, Delegates will be able to:

    §   Understandand master C++ 11/14 new features from fundamental features like universalinitialization, handy tools like lambda to advanced topics like unique_ptr,multi-threads and memory modal.

    §   UseDesign patterns, idioms and generic programming techniques to write highusable, maintainable, effective and efficient codes in a C++ program

    §   Deeplyunderstand the pitfalls of C++ Core features including conversion, memory managementand exceptional consideration and know the

    §   Understandpitfalls of C++ STL and know the correct ways to solve routine tasks

    Contents

    Day1Introduction- Introduction to my self
    - The course outline
    - Evolution of C++
    C++11/14- C++ 11 Features with examples
    - auto
             -decltype
             -nullptr
             -for-loop
             -C++ 03 initialization
             -uniformed C++ 11 initialization
             -simplified class initialization
             -default/delete
             -final/override
             -lambda
             -improved library overview
    - C++ 14 Features with examples         -function return type detection
             -const expression
             -improved library overview
    C++OO Refresher-         Abstraction and encapsulation
    -         Inheritance and polymorphism
    -         Relationships
    -         Patterns and idioms
    -         Has-a
    -         Is-A
    -         Is-Implemented-in-terms-of
    -         Is-A, Is-Implemented-of in C++
    -         Private inheritance idiom
    Copyingand Conversion- Implicit conversion
    - Up-cast, down-cast
    - Implicit conversion for class
    - Construct conversion function
    - Assignment & conversion function
    - 2nd conversion
    - Casting operators
    - Static Casting
    - Dynamic Casting
    - Physical Const
    - Const-ness: enum and pointer
    - Const-ness: class field
    - Const-ness in class function
    - Const is not panacea
    - Logic Const-ness: mutable
    - L-value vs. R-value
    - Move semantics support (R-valuereference) in C++ 11
    Exerciseand Homework
    Day2MemoryManagement- Object life cycle
    - Allocation failure
    - Memory Alignment
    - Empty Base Optimization Idioms
    - Resource Return Problem
    - Resource Return idioms
    - C++11 Smart Pointers: unique_ptr
    - C++11 Smart Pointers: shared_ptr
    - Smart Pointers is not omnipotent
    ExceptionHandling/Safety- Why exception handling?
    - Classifying and handling exceptions
    - Catching and throwing exceptions
    - Standard exception hierarchy
    - Contract violations
    - Exception Safety levels
    - Exceptions in constructors
    - Exceptions in destructors
    - RAII idioms for exception safety
    - Copy-and-Swap Idiom
    - Safe swap Idiom
    STLeffectiveness and efficiency- Print members in a data container
    - Effective ways to iterate container
    - Vector’s internal
    - Shrink container
    - Customized structure as key in map
    - Pitfall of removing items from sequence
    - Pitfall of removing items from map
    C++11 Template and Container- C++11 Static Assert
    - Thin Template Idiom
    - Template Alias
    - Template Function Default Value
    - C++11 template var args
    - C++11 Containers
    - C++ 11/14 Tuple
    - C++11 array

    - STL Containers Overview

    - Type traits in C++11
    - STL Container improvement
    - Lambda (C++11)
    - Lambda Improvement (C++14)
    MoreDesign Patterns and Idioms- The Object Adapter pattern
    - The Null Object Pattern
    - AOP, Decorator Pattern
    - Decorator Pattern
    - AOP and Parameterized Base Class Idiom
    - Strategy Pattern
    - Policy based class design
    - The Template Method pattern
    - Default virtual implementation idiom
    - Named Parameter Idiom
    Exerciseand Homework