iluwatar / iluwatar/java-design-patterns
Two Step View pattern
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 94.7k
- Forks
- 27.4k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 10
Description
Description:
The Two Step View design pattern is used to separate the process of generating dynamic web content into two distinct phases: data preparation and data presentation. This separation allows for more modular, maintainable, and testable code. The pattern is particularly useful for web applications with complex presentation logic, where it can help to simplify the development and maintenance of views.
Main Elements of the Pattern:
- Data Preparation Phase: In this phase, the raw data is collected and processed into a form that is suitable for rendering. This usually involves gathering data from various sources, performing necessary computations, and organizing it into a structured format.
- Presentation Phase: This phase takes the prepared data and applies a template to generate the final HTML or other output formats. The template defines how the data should be displayed, separating the concerns of data structure and visual presentation.
References:
- Martin Fowler's Catalog on Two Step View
- Patterns of Enterprise Application Architecture by Martin Fowler (Page 303)
- Ranjitha Balaraman's Blog on Two Step View
- Thierry Roussel's Notes on HTML Renderer
Acceptance Criteria:
- Implement the Two Step View pattern by creating a distinct data preparation phase and a presentation phase in the web application.
- Ensure that the data preparation logic is separated from the presentation logic to promote modularity and maintainability.
- Provide unit tests to verify the correctness of both the data preparation and presentation phases, ensuring that they work correctly independently and together.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are identified in the issue. Start by reviewing the referenced Two Step View materials and the repository structure to locate the web application and its presentation code. Done means separate data preparation and presentation phases exist, with unit tests covering each phase independently and their integration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100