Skip to content

Objects and Data Structures - The Law of Demeter #30

@jnguyen095

Description

@jnguyen095
  • The method should not invoke methods on objects that are returned by any of the allowed functions. In other words, talk to friends, not to strangers
final String outputDir = ctxt.getOptions().getScratchDir().getAbsolutePath();
  • It is usually best to split them up as follows:
Options opts = ctxt.getOptions();
File scratchDir = opts.getScratchDir();
final String outputDir = scratchDir.getAbsolutePath();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions