Massimiliano Mantione - Object Oriented Programming, and Rust - Rust Linz

Learn how Rust's unique approach to object-oriented programming differs from traditional OOP, and discover the benefits of place-oriented programming, encapsulation, and immutable systems in reducing complexity and preventing mutable state.

Key takeaways
  • Object-oriented programming (OOP) was initially intended for weaker computers, but modern computers can manage complexity through encapsulation and abstraction.
  • In OOP, inheritance mixes implementation inheritance with interface inheritance, causing problems.
  • Proper OOP requires totally decoupled using, which is often not seen in mainstream languages.
  • Rust, as a language, is doing the opposite of what OOP was originally intended to do.
  • Object references in Rust seal you out of mutable state, making encapsulation easier.
  • In Rust, you need to model state with plain data structures, without defining classes.
  • Object-oriented programming in Rust is more about place-oriented programming, which is strange to understand.
  • Dynamic traits in Rust are different because they have a vtable, making it harder to model mutable state.
  • References in Rust make it hard to put them somewhere, as they can be mutable.
  • Good practices in programming languages encourage bad practices.
  • It’s crucial to think about software design and technology, rather than just following technical features.
  • Object-oriented code shields complexity, but good design can reduce it.
  • Modular programming makes code understandable by encapsulating and minimizing moving parts.
  • Encapsulation helps in simplifying code.
  • Dynamic systems can’t compete with immutable systems in terms of performance.
  • We often use object-oriented programming for complexity, but it’s just a software design problem.
  • Borrow checker in Rust helps in preventing mutable state, making it easier to write correct code.
  • Moving parts can reduce the complexity of code.
  • Object-oriented programming was meant to be used in theory, but we often get it wrong in practice.
  • Clone in Rust creates a new instance of an object, which is useful when you want to model state.
  • Rust is not a good language for mutable state.
  • In Rust, you can’t inherit from a type, only from a trait.
  • Rust’s error handling mechanism helps in simplifying code.