Skip to content

LogParametersRatherThanLogMessage - wrong refactoring #472

@cal101

Description

@cal101

A funny one.

App.java:

      ...
      private static final String ALL_CUSTOMERS = "customerDao.getAllCustomers(): ";
      ...
      customerDao.add(customer);
-     log.info(ALL_CUSTOMERS + customerDao.getAll());
+     log.info();

With CustomerDao:

  ...
  /**
   * Get all customers.
   *
   * @return all the customers as a stream. The stream may be lazily or eagerly evaluated based on
   *     the implementation. The stream must be closed after use.
   * @throws Exception if any error occurs.
   */
  Stream<Customer> getAll() throws Exception;
  ...

Full source code:
https://github.com/iluwatar/java-design-patterns/tree/master/dao/src/main/java/com/iluwatar/dao

Note that source code is using Java 11 it that matters.

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