Cademy logoCademy Marketplace

Course Images

Behavioral Design Patterns in C++

Behavioral Design Patterns in C++

  • 30 Day Money Back Guarantee
  • Completion Certificate
  • 24/7 Technical Support

Highlights

  • On-Demand course

  • 12 hours 27 minutes

  • All levels

Description

This Design Patterns course is a unique offering that focuses on modern C++ features and behavioral design patterns. The course content is extensive and carefully curated, with a deep dive into each pattern to ensure a thorough understanding of its implementation. Gain a comprehensive understanding of the pattern's intricacies.

The course takes a structured approach to explain each pattern, starting with an introduction and then diving into its intent, structure, participants, and communication with the client. The UML class diagram is provided to illustrate the pattern's structure and how classes interact with each other. The guide includes a simple example implementation of the pattern, which helps students understand the pattern's implementation and application in real-life scenarios. However, the course also highlights potential design issues in the example and explains how to refactor and apply the pattern effectively to avoid errors. One of the key strengths of this guide is that it goes beyond a single implementation of each pattern. Then it discusses multiple implementations of the same pattern, helping students expand their knowledge of the pattern and how it can be applied in different scenarios. The pros and cons of each pattern are also discussed, providing students with a well-rounded understanding of each pattern's strengths and limitations. The different types of design patterns that you will study include Strategy, Template Method, Command, Memento, CoR (Chain of Responsibility), Observer, Mediator, Visitor, Interpreter, State, and Iterator. In addition to this, you will also learn about the pros and cons of each pattern. By the end of this course, you will be well-versed with behavioral design patterns and will have developed the skills to implement them in modern C++. All the resource files are added to the GitHub repository at: https://github.com/PacktPublishing/Behavioral-Design-Patterns-in-C-

What You Will Learn

Implement behavioral design patterns using modern C++ features
See how behavioral design patterns use compile and runtime polymorphism
Look at the Strategy, Template Method, and Command design patterns
Learn Memento, CoR (Chain of Responsibility), and State design patterns
See Observer, Mediator, Visitor, Interpreter, and Iterator design patterns
Explore the pros and cons of each design pattern

Audience

If you are a student who wants to get a basic understanding of design patterns; a software developer, project manager, or an architect who wants to understand and implement design patterns in their projects; or a C++ developer who wants to implement design patterns in C++, this course is for you. To get started with this course, it is necessary to have basic knowledge of C++ and object-oriented programming concepts.

Approach

The approach comprises intent, implementation, familiarity, more examples, refactoring, alternatives, tweaks, and pros and cons for each design pattern.

With the help of real-world examples written in modern C++, this course gets you acquainted with different types of behavioral design patterns and helps you understand how a pattern can be implemented efficiently using language features.

Key Features

Discover amazing techniques to tweak design patterns for performance and maximum flexibility using C++ * Simulation of code is discussed, and a refactoring approach is used, which is how we apply patterns in software * The practical examples will compile and execute on any platform that supports a C++ compiler

Github Repo

https://github.com/PacktPublishing/Behavioral-Design-Patterns-in-C-

About the Author

Umar Lone

Course Outline

1. Introduction to the Course

1. Why You Should Take This Course

In this video, you will learn about the reasons why taking this course is beneficial and how it can enhance your skills as a developer.


2. Basic Concepts

1. Introduction to Patterns

This video provides an overview of the patterns in programming languages.

2. Overview of Class Diagram

This video provides an overview of the class diagram.

3. Overview of Behavioral Patterns

This video provides an overview of behavioral patterns.


3. Strategy

1. Introduction

This video provides an introduction to strategy.

2. Basic Example

In this video, we will go through one of the basic examples of strategy pattern.

3. Spreadsheet Application - I

In this video, we will be building a spreadsheet application using JavaScript.

4. Spreadsheet Application - II

This video builds upon the first part of our spreadsheet application series; here, we will add new exports formats to the application.

5. Spreadsheet Application - III

In this third video of the series, we will try to replace conditional statements with inheritance and see if it works.

6. Spreadsheet Application - IV

In this video, we will refactor our design to use the strategy pattern step-by-step.

7. Spreadsheet Application - V

In this final video of the series, we will complete the implementation of the strategy pattern.

8. Dynamic Array - I

In this video, we will introduce a dynamic array that may be used in both single-threaded and multi-threaded applications.

9. Dynamic Array - II

In this video, we will make the array class thread safe.

10. Dynamic Array - III

In this video, we will attempt to configure the array class for both single and multi-thread access using a Boolean.

11. Dynamic Array - IV

This video explains how to use the dynamic strategy to decide the thread-safety for the array class.

12. Null Object Pattern

This video explores the null object pattern, a behavioral design pattern that allows for the handling of null values in a program in a more efficient and safe way. It is also an alternative to null check condition.

13. Static Strategy

In this video, we will dive into the static strategy design pattern, which allows us to choose an algorithm at compile-time rather than at runtime. Here, we will see how, in C++, strategy can be implemented more efficiently using templates.

14. Function Strategy - I

In this video, we explore the function strategy design pattern, which allows us to swap out different algorithms at runtime. We will cover the basics of the pattern and how to implement it in JavaScript, as well as some real-world use cases for the function strategy pattern.

15. Function Strategy - II

In this video, we will continue to explore the function strategy design pattern, building on the concepts covered in the previous video. We will dive deeper into the implementation of this pattern.

16. Non-Member Strategy Pointer

In this video, we will see one more alternative to the strategy pattern, where the pointer is passed as an argument into the function, instead of being a member of the class.

17. Pros and Cons

This video talks about the pros and cons of the strategy pattern.


4. Template Method

1. Introduction

This video provides an introduction to the template method pattern.

2. Basic Implementation

This video demonstrates basic implementation of the template method pattern through coding.

3. Document Framework - I

This video explains the example of a document framework and adds the necessary base classes.

4. Document Framework - II

In this video, we will continue adding classes to the document framework.

5. Document Framework - III

In this video, we will add the functionality of versioning.

6. Template Method - I

In this video, we will implement the template method design pattern in the document framework.

7. Template Method - II

In this video, we continue exploring the template method design pattern, building on the concepts covered in the previous video and implement the text document.

8. Template Method - III

In this video, we continue to explore the final details of the template method design pattern, which allows us to define the skeleton of an algorithm in a base class and let subclasses implement specific steps of the algorithm.

9. Pros and Cons

This video talks about the pros and cons of the template method pattern.


5. Command

1. Introduction

This video provides an introduction to command patterns.

2. Intent

In this video, we will be exploring the command design pattern from the perspective of behavioral design patterns. We will delve into the intent of the pattern in detail.

3. Basic Implementation - I

In this video, we will start with the basics of implementing the command design pattern.

4. Basic Implementation - II

In this video, we continue our exploration of the command design pattern by implementing the basic structure of our command objects.

5. FindDialog - I

In this video, you will get to know how a dialog box may handle an event that is generated by a button.

6. FindDialog - II

In this video, you will see how the dialog box handles the event from the button using the command pattern.

7. TextPad - I

This video helps you with the overview of the TextPad application and its menu.

8. TextPad - II

This video starts with the creation of the application class and implementation of its important methods.

9. TextPad - III

In this video, we will implement the input handling functionality in the application class.

10. TextPad - IV

In this video, we will implement the menu class for handling user input.

11. TextPad - V

In this video, we will modify the menu class and break its dependency of the application class. This will make it reusable with any class.

12. TextPad - VI

In this video, we will use the menu class with the application class. You will be able to see how the classes are loosely coupled. This implementation uses a pointer to function as callback and does not use an object-oriented approach.

13. TextPad - VII

This video gives an overview of the implementation so far and also explains an alternative approach through classes.

14. TextPad - VIII

This video demonstrates how to use the command pattern to handle commands/events and also achieve loose coupling between the classes.

15. TextPad - IX

This video builds upon the previous implementation and moves the functionality of many application methods of their own classes. This will be later useful to implement the undo/redo functionality.

16. Undo - I

This video explains the basics of undo and redo through the command pattern.

17. Undo - II

This video explains the concept of undo in more depth.

18. Undo - III

This video will help you implement the undo method of several command classes.

19. Undo - IV

In this video, we will continue implementing the undo method in the remaining command classes.

20. Undo - V

This video helps you store copies of command objects that are executed in a stack and test our implementation.

21. DataList - I

This video starts with another example that will be used to understand how macro commands can be implemented.

22. DataList - II

In this video, we will add the menu and the macro class in this lesson and complete the implementation.

23. Pros and Cons

This video talks about the pros and cons of the command pattern.


6. Memento

1. Introduction

This video is an introduction to the Memento pattern.

2. Basic Implementation

This video helps you with the basic implementation of the Memento pattern.

3. Account Class

This video demonstrates the usage of the Memento pattern in a banking application.

4. Hangman - I

In this video, we will implement the popular Hangman game on the console.

5. Hangman - II

This video will help you test the Hangman game.

6. Hangman - III

This video shows you how to implement checkpoints in the Hangman game.

7. Hangman - IV

In this video, we will take the responsibility of managing checkpoints out of the Hangman class by refactoring it to use the Memento pattern.

8. Hangman - V

This video will help in building upon the previous video and continuing our implementation of the Memento pattern.

9. Hangman - VI

In this video, we will use serialization to implement the Memento pattern.

10. Pros and cons

This video talks about the pros and cons of the Memento pattern.


7. Chain of Responsibility

1. Introduction

This video provides an introduction to the CoR (Chain of Responsibility) pattern.

2. Basic Implementation

This video provides a basic implementation of the CoR pattern.

3. Help System - I

In this video, we will use the example of a help system to understand the CoR pattern. It will also give you an overview of the example.

4. Help System - II

In this video, we will use the CoR pattern to implement the help system of an application.

5. Logging System - I

This video starts with another example in which we will implement a logging system. This example is implemented in three subsequent videos.

6. Logging System - II

In this video, we will try to reduce the coupling between WinApp and the logger classes.

7. Logging System - III

In this video, we will modify the WinApp class and implement the CoR pattern.

8. Logging System - IV

In this video, we will refine our implementation and reduce some boilerplate code.

9. Pros and Cons

This video talks about the pros and cons of the CoR pattern.


8. Observer

1. Introduction

This video provides an introduction to the Observer pattern.

2. Basic Implementation

This video provides a basic implementation of the Observer pattern.

3. Alarm System

This video talks about the alarm system in detail.

4. Slide Deck - I

This video will help you build an app like PowerPoint, which is the Slide Deck application here and present your data like you do in PPT.

5. Slide Deck - II

In this video, we will add the classes that will display the content part.

6. Slide Deck - III

In this video, we will implement the Observer design pattern in the application.

7. Slide Deck - IV

In this video, we will see how only a particular slide should be displayed in the output, which is recently added or modified.

8. Sensor - I

This video explains how the observer acquires the data. Here, the data itself is sent along with the notification and this will be explained with the help of the temperature sensor application.

9. Sensor - II

In the application, for every change in temperature, all the observers get the notifications. In this video, we will see how billboard and simple display do not display the updated temperature if it is just a minor change.

10. Change Manager - I

This video shows the Change Manager, which helps take information from the subject and pass on the right information or notify the observers as intended.

11. Change Manager - II

This video helps implement the concept of Change Manager in the code.

12. Pros and Cons

This video talks about the pros and cons of the Observer pattern.


9. Mediator

1. Introduction

This video is an introduction to the Mediator pattern.

2. Basic Implementation

This video demonstrates the basic implementation of the Mediator pattern.

3. Chat System - I

This video demonstrates the use case of a chat system. Suppose there are more users who want to connect on the chat system. In that case, connection of each and every individual to another directly can make the system design a lot more complex, so we use the central chat server that will eradicate the direct connection of one individual with another in order to make the system less complicated.

4. Chat System - II

This video is a continuation to building a central chat server.

5. DialogBox - I

This video will help you create a DialogBox where you will add some widgets and see how to interact with the widgets through the mediator design pattern.

6. DialogBox - II

This video will help in the implementation of all the widget classes.

7. DialogBox - III

This video demonstrates the implementation of the interaction mechanism of the widgets with each other.

8. DialogBox - IV

This video helps implement the Mediator design pattern to remove dependencies between the widgets' classes.

9. Pros and Cons

This video talks about the pros and cons of the Mediator design pattern.


10. Visitor

1. Introduction

This video provides an introduction to the Visitor pattern.

2. Basic Implementation

This video explains the basic implementation of the Visitor pattern.

3. Shapes Example - I

This video explains the implementation of shape hierarchy with the help of the Visitor pattern. Here, you will implement classes representing the geometry of a line and a circle.

4. Shapes Example - II

This video helps in rendering classes representing the geometry of a line and a circle on the screen.

5. Shapes Example - III

In this video, you will implement the Visitor pattern, through which you will add new operations to the shape hierarchy.

6. Shapes Example - IV

This video explains the single and double dispatch concepts.

7. Shapes Example - V

This video will help you add new operations to the existing class hierarchy with the help of the Visitor pattern.

8. Shapes Example - VI

This video explains the concept of cyclic dependency.

9. Acyclic Visitor

This video explains Acyclic Visitor in detail.

10. Generic Acycle Visitor - I

This video explains generic Acycle Visitor in detail and helps you implement it.

11. Generic Acycle Visitor - II

In this video, you will go ahead and build on the previous video of implementing the generic Acycle Visitor completely.

12. Variant

In this video, we will discuss the C++17 std::variant. This class uses the Visitor pattern for performing operations on its members.

13. Overload Pattern

This video talks about the Overload pattern.

14. Pros and Cons

This video talks about the pros and cons of the Visitor pattern.


11. Interpreter

1. Introduction

This video provides an introduction to the Interpreter pattern.

2. Basic Implementation

This video explains the basic implementation of the Interpreter pattern.

3. Lexing and Parsing

This video explains the Lexing and Parsing analysis.

4. Boolean Evaluator

This video explains the Boolean Evaluator.

5. Boolean Interpreter - I

This video helps in the implementation of the Boolean Interpreter design pattern.

6. Boolean Interpreter - II

This video builds on the previous video and helps design the Interpreter design pattern. Here, the terminal and non-terminal classes are converted into classes.

7. Boolean Interpreter - III

In this video, we will go ahead and add the support for the OR keyword.

8. RPN Evaluator - I

This video demonstrates another example that uses the Interpreter design pattern and builds the RPN evaluator.

9. RPN Evaluator - II

This video explains how to use the parser to parse some expressions.

10. Pros and Cons

This video talks about the pros and cons of the Interpreter pattern.


12. State

1. Introduction

This video provides an introduction to the State design pattern and helps find the state of the object.

2. Basic Example

This video explains a basic example of the State design pattern.

3. Lamp - I (NoState)

This video explains the implementation of the State design pattern. Here, we will use the example of a lamp with two states, that is, ON and OFF.

4. Lamp - II (Enum States)

In this video, we will use the variable to store the current state of the lamp so that one can take the correct action if the lamp is switched OFF or switched ON.

5. Lamp - III (State Pattern)

In this video, we will modify the implementation of the lamp class and use the State pattern instead of managing the state through Enums.

6. Lamp - IV (Yellow State)

In this video, we will be adding one more state to the code, that is, yellow state, and see what we can do with the addition of the new state.

7. Lamp - V (Factory)

This video helps you add the factory method to the existing code.

8. Transition Table - I

This video explains the implementation of the State design pattern through a transition table.

9. Transition Table - II

In this video, you will use the transition table through the lamp class.

10. Methods for States - I

This video demonstrates another approach-methods for state approach that can be implemented in the State design pattern.

11. Methods for States - II

This video demonstrates the implementation of method for states in code.

12. Methods for States - III

This video extends the code and modifies the state class.

13. Methods for States - IV

In this video, we will add a yellow state to the lamp.

14. Pros and Cons

This video talks about the pros and cons of the State design pattern.


13. Iterator

1. Introduction

This video provides an introduction to the Iterator design pattern.

2. Basic Implementation

This video explains a basic implementation of the Iterator design pattern.

3. Organization - I

This video shows another example that explains the Iterator design pattern. We will create a class that represents an organization, and the organization class contains the employees.

4. Organization - II (Cursor)

In this video, we will demonstrate another variation of the Iterator pattern in which the Iterator is called a cursor.

5. Organization - III (Iterator)

This video explains one more variation of the Iterator design pattern; here, you will move the traversal algorithm out of the class and put it inside the iterator.

6. Containers - I (Array)

In this video, you will implement an array class as a dynamic array.

7. Containers - II (List)

In this video, you will implement another class called linked list.

8. Containers - III (Issues)

This video explains the issue where the elements inside the container are accessed.

9. Containers - IV (ArrayIterator)

This video demonstrates the support for the iterator for both array and list operators.

10. Containers - V (ListIterator)

This video explains how to add iterator to the link class.

11. C++ Iterators - I

In this video, we will add another layer of complexity, that is, adding a smart pointer that can be used to access instead of the iterator directly.

12. C++ Iterators - II

In this video, we will implement the iterator for the list class.

13. C++ Iterators - III (More Iterators)

In this video, we will add more iterators to use the container more efficiently.

14. Pros and Cons

This video talks about the pros and cons of the Iterator design pattern.

Course Content

  1. Behavioral Design Patterns in C++

About The Provider

Packt
Packt
Birmingham
Founded in 2004 in Birmingham, UK, Packt’s mission is to help the world put software to work in new ways, through the delivery of effective learning and i...
Read more about Packt

Tags

Reviews