Book notes: Clean Code - Chapter 6

ciochetta

Luis Felipe Ciochetta

Posted on March 8, 2021

Book notes: Clean Code - Chapter 6

Chapter 6 - Objects and Data Structures

  • Keeping implementation of functions private is a matter of abstraction. The user of a class does not need to know the details on how the command issued will be taken care of.
  • The worst option is to just create getters and setters, we should think about the best way to expose the data and how it will be used.

Objects hide their data behind abstractions and expose functions that operate on that data. Data structure expose their data and have no meaningful functions.

  • Hybrids between objects and data structures are bad. they make adding new data and new functions hard. In order to avoid creating such hybrids, we can create data structures and then encapsulate these data structures within objects that have functions.
  • We can add commands to objects that call commands on their internal properties to avoid making chain calls.
๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
ciochetta
Luis Felipe Ciochetta

Posted on March 8, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

PureScript for Scala developers
scala PureScript for Scala developers

November 30, 2024

What is Generative AI?
whatisgenerativeai What is Generative AI?

November 29, 2024

ยฉ TheLazy.dev

About