Skip to content

Conversation

@sharara6
Copy link

@sharara6 sharara6 commented Dec 3, 2024

created a two-step view design pattern for more details check the read-me file

close issue #1323

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2024

@sharara6
Copy link
Author

sharara6 commented Dec 8, 2024

@iluwatar may you review this PR ?

@sharara6
Copy link
Author

Dear @iluwatar may you check my PR?

@sharara6
Copy link
Author

This is a gentle follow up.

@sharara6
Copy link
Author

Thank you for your review. I am in the midst of final exams right now. May I work on it next week?

@iluwatar
Copy link
Owner

Thank you for your review. I am in the midst of final exams right now. May I work on it next week?

Sure, no problem. Good luck with the exams 😄

@github-actions
Copy link

github-actions bot commented Jan 22, 2025

PR Summary

This PR implements the Two-Step View pattern, separating data preparation from presentation. It includes a new module (two-step-view) demonstrating this pattern with a Book and BookStore example, and updates to existing test files for improved test coverage.

Changes

File Summary
microservices-idempotent-consumer/src/test/java/com/iluwatar/idempotentconsumer/AppTest.java Updated the file header to include the MIT license information and added a description of the project.
microservices-idempotent-consumer/src/test/java/com/iluwatar/idempotentconsumer/RequestStateMachineTests.java Updated the file header to include the MIT license information and added a description of the project.
pom.xml Added the two-step-view module to the project.
two-step-view/README.md This file provides a comprehensive explanation of the Two-Step View pattern, including its intent, real-world examples, a programmatic example in Java, when to use it, tutorials, real-world applications, benefits, trade-offs, related design patterns, and references.
two-step-view/pom.xml This is the pom.xml file for the two-step-view module. It defines the project dependencies and build configurations.
two-step-view/src/main/java/com/iluwatar/App.java This is the main application class that demonstrates the Two-Step View pattern using Book and BookStore objects.
two-step-view/src/main/java/com/iluwatar/Book.java Represents a Book object with properties like name, price, discount, and stock. Includes input validation.
two-step-view/src/main/java/com/iluwatar/BookStore.java Represents processed book data for presentation, including discounted price and stock status.
two-step-view/src/main/java/com/iluwatar/DataPreparation.java Prepares book data by calculating discount prices and checking stock availability.
two-step-view/src/main/java/com/iluwatar/Presentation.java Generates an HTML representation of the book details.
two-step-view/src/test/java/com/iluwatar/BookStoreTest.java This file contains unit tests for the DataPreparation and Presentation classes, covering various scenarios including discount, stock status, and edge cases.
update-header.sh Updated the script to include the MIT license information in the header of all files.

autogenerated by presubmit.ai

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (3)
  • a3fe274: Resolved Reviews
  • 53afd1f: Fixed tet coverage and fixed some edge cases
  • f833ad3: Resolved issue #1323 Two-Step View pattern
Files Processed (12)
  • microservices-idempotent-consumer/src/test/java/com/iluwatar/idempotentconsumer/AppTest.java (1 hunk)
  • microservices-idempotent-consumer/src/test/java/com/iluwatar/idempotentconsumer/RequestStateMachineTests.java (1 hunk)
  • pom.xml (1 hunk)
  • two-step-view/README.md (1 hunk)
  • two-step-view/pom.xml (1 hunk)
  • two-step-view/src/main/java/com/iluwatar/App.java (1 hunk)
  • two-step-view/src/main/java/com/iluwatar/Book.java (1 hunk)
  • two-step-view/src/main/java/com/iluwatar/BookStore.java (1 hunk)
  • two-step-view/src/main/java/com/iluwatar/DataPreparation.java (1 hunk)
  • two-step-view/src/main/java/com/iluwatar/Presentation.java (1 hunk)
  • two-step-view/src/test/java/com/iluwatar/BookStoreTest.java (1 hunk)
  • update-header.sh (1 hunk)
Actionable Comments (0)
Skipped Comments (8)
  • microservices-idempotent-consumer/src/test/java/com/iluwatar/idempotentconsumer/AppTest.java [1-24]

    best practice: "License header too verbose."

  • microservices-idempotent-consumer/src/test/java/com/iluwatar/idempotentconsumer/RequestStateMachineTests.java [1-24]

    best practice: "License header too verbose."

  • two-step-view/src/main/java/com/iluwatar/App.java [1-27]

    best practice: "License header too verbose."

  • two-step-view/src/main/java/com/iluwatar/Book.java [1-24]

    best practice: "License header too verbose."

  • two-step-view/src/main/java/com/iluwatar/BookStore.java [1-24]

    best practice: "License header too verbose."

  • two-step-view/src/main/java/com/iluwatar/DataPreparation.java [1-24]

    best practice: "License header too verbose."

  • two-step-view/src/main/java/com/iluwatar/Presentation.java [1-24]

    best practice: "License header too verbose."

  • two-step-view/src/test/java/com/iluwatar/BookStoreTest.java [1-24]

    best practice: "License header too verbose."

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Owner

@iluwatar iluwatar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, please resolve the conflicts.

@@ -0,0 +1,156 @@
# Two-Step View
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

---

## Programmatic Example of Two-Step View Pattern in Java

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add short programmatic example here. See the other patterns for examples of how to do this.

@iluwatar
Copy link
Owner

Closed due to inactivity. Thank you for the contribution.

@iluwatar iluwatar closed this Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants