Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Override Kotlin Property Getters and Setters

Love
June 17, 2024

Override Kotlin Property Getters and Setters

You will learn how to override property getters and setters to add customized behavior to how your properties are used and modified.

Love

June 17, 2024
Tweet

More Decks by Love

Other Decks in Technology

Transcript

  1. What We Will Cover Properties in Kotlin 01 Custom Property

    Getters & Setters 02 Overriding Property Getters & Setters 0 3 @LoveOtudor
  2. What We Will Cover Properties in Kotlin 01 Custom Property

    Getters & Setters 02 Overriding Property Getters & Setters 0 3 Property Delegation 0 4 @LoveOtudor
  3. What We Will Cover Properties in Kotlin 01 Custom Property

    Getters & Setters 02 Overriding Property Getters & Setters 0 3 Property Delegation 0 4 Tips and Best Practices 05 @LoveOtudor
  4. Our company These are semi-autonomous cars equipped with IoT that,

    in addition to making decisions, control a part of the vehicle's operation to prevent accidents @LoveOtudor
  5. Kotlin allows you to override the default getters and setters

    for properties using the get and set keywords, respectively. @LoveOtudor
  6. Property delegation allows you to delegate the implementation of getter

    and setter methods for properties to a separate object, known as a delegate. @LoveOtudor
  7. Tips and Best Practices ▪ Keep It Simple. ▪ Follow

    Naming Conventions. ▪ Use Property Delegation Sparingly. @LoveOtudor
  8. Tips and Best Practices ▪ Keep It Simple. ▪ Follow

    Naming Conventions. ▪ Use Property Delegation Sparingly. ▪ Document your getters and setters clearly. @LoveOtudor
  9. Tips and Best Practices ▪ Keep It Simple. ▪ Follow

    Naming Conventions. ▪ Use Property Delegation Sparingly. ▪ Document your getters and setters clearly. ▪ Test Your Code. @LoveOtudor
  10. Tips and Best Practices ▪ Keep It Simple. ▪ Follow

    Naming Conventions. ▪ Use Property Delegation Sparingly. ▪ Document your getters and setters clearly. ▪ Test Your Code. ▪ Maintain Consistency. @LoveOtudor
  11. Tips and Best Practices ▪ Keep It Simple. ▪ Follow

    Naming Conventions. ▪ Use Property Delegation Sparingly. ▪ Document your getters and setters clearly. ▪ Test Your Code. ▪ Maintain Consistency. ▪ Only override property getters and setters when necessary. @LoveOtudor