Skip to content

Move behavior close to data. #8

@vagosdim

Description

@vagosdim

In both examples, we have moved the business logic from the client(s) to the data class, which starts to acquire responsibilities. =>

  • we have much simpler clients, /*understanbale, evolvable */
  • we do not have dupicate code,
  • we are reducing the essential coupling of classes (clients use only a small part of the public API of the service provider)
    =>
    we can evolve with more ease and we can test better

CAUTION: When you move methods from the client classes to the Data Container, you will need to introduce parameters to make the moved method to work

Data is plain old data (output of a parser, data from a database, ...)
See also
https://blogs.oracle.com/javamagazine/records-come-to-java
https://projectlombok.org/features/Data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions