Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogParametersRatherThanLogMessage - wrong refactoring #472

Open
cal101 opened this issue Mar 1, 2021 · 0 comments
Open

LogParametersRatherThanLogMessage - wrong refactoring #472

cal101 opened this issue Mar 1, 2021 · 0 comments

Comments

@cal101
Copy link
Collaborator

cal101 commented Mar 1, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant