DEV Community

Luis Felipe Ciochetta
Luis Felipe Ciochetta

Posted on

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.

Top comments (0)