Object-oriented Programming in Rust 2021
Object-oriented Programming is a powerful and successful programming paradigm that helps create programs of all sizes and complexity. This course will teach you in a practical way how to implement OOP concepts using Rust.
What you'll learn
Modern computer programs can be very complex beasts, and to fight and conquer such complexity the Object-oriented Programming paradigm was introduced. In this course, Object-oriented Programming in Rust, you’ll learn how to implement OOP concepts using the Rust programming language. First, you’ll explore how to define your own objects in Rust using structs and function implementation blocks. Then, you'll discover how to implement OOP concepts like encapsulation and information hiding in Rust. Next, you’ll hear another important OOP concept, which is polymorphism, and you’ll learn how to define objects that implement polymorphic behavior using traits and other features of the Rust programming language. Finally, you’ll see a complete practical example of how to implement a common and important OOP design pattern in Rust: the Observer design pattern. When you’re finished with this course, you’ll have the skills and knowledge of how to structure and write Rust programs using Object-oriented Programming techniques
Table of contents
- Introduction 2m
- What Is an Object? 4m
- A Note on OOP Terminology: Class vs. Object 2m
- Defining Custom Objects with struct 1m
- Implementing Methods for Your Custom Objects 3m
- Creating Custom Objects and Invoking Methods 1m
- Demo: Creating a Simple Object in Rust 2m
- Demo: Implementing Methods that Modify an Object’s State 4m
- A Quick Intro to Modules in Rust 1m
- Demo: Visibility of Objects and Their Parts Inside Modules 3m
- Default Visibility and the Information Hiding Principle 3m
- The Information Hiding Principle in Action with Accessor Methods 4m
- Creating Objects with the new Method 4m
- Demo: The new Method in Action 1m
- Quick Recap: Objects in Rust 2m
- Summary 1m
- Introduction 1m
- A Brief Refresher on Inheritance 3m
- The Rust Way to Implement Polymorphism 1m
- Defining a Trait to Specify a Common Behavior 1m
- Creating Types that Implement a Given Trait 2m
- Storing Values of Different Types Using Trait Objects 2m
- Using the Box Smart Pointer with Trait Objects 3m
- Invoking Methods on Trait Objects 2m
- Demo: Polymorphism Using Trait Objects in Action 4m
- Summary 1m
- Introduction 1m
- A Practical Introduction to the Observer Design Pattern 3m
- Implementing the Observer Pattern in Rust: Starting with the Observers 2m
- Designing a Trait for the Subject 5m
- Avoiding Dangling References with Lifetime Annotations 4m
- The PartialEq Trait and Its Automatic Implementation 3m
- Demo: The Observer Object-oriented Design Pattern in Rust in Action 5m
- Summary 1m