Skip to content

Template Method page#27

Merged
theartcher merged 1 commit intomainfrom
page/template-method
Dec 10, 2025
Merged

Template Method page#27
theartcher merged 1 commit intomainfrom
page/template-method

Conversation

@theartcher
Copy link
Copy Markdown
Contributor

Implement page

@theartcher theartcher self-assigned this Dec 10, 2025
Copilot AI review requested due to automatic review settings December 10, 2025 10:37
@theartcher theartcher added enhancement New feature or request page Has changes relating to a page's content. labels Dec 10, 2025
@theartcher theartcher merged commit 01a701a into main Dec 10, 2025
5 checks passed
@theartcher theartcher deleted the page/template-method branch December 10, 2025 10:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a comprehensive documentation page for the Template Method design pattern, following the established structure and conventions used across other behavioral pattern pages in the repository.

Key Changes:

  • Adds complete Template Method pattern documentation with problem statement, solutions, metaphors, and real-world examples
  • Includes TypeScript and Python code samples demonstrating the pattern with a data processing example
  • Provides an interactive playground component for users to experiment with the pattern


def transform(self, data):
print("🔄 Transforming JSON to normalized format")
import json
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The json module is imported again here, but should be imported only once at the top of the file (after line 199). Remove this duplicate import statement.

Copilot uses AI. Check for mistakes.
class JSONProcessor(DataProcessor):
def validate(self, data):
print("✅ Validating JSON format")
import json
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The json module should be imported at the top of the file (after line 199, with the other imports) rather than inside the method. Import statements inside methods are considered poor practice in Python as they can impact readability and performance. The same applies to the duplicate import on line 251.

Move import json to line 200 (after from abc import ABC, abstractmethod) and remove the imports from lines 242 and 251.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request page Has changes relating to a page's content.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants