Skip to content

Add Null Object and Singleton patterns, enhance Specification#475

Open
abdalwahab-daw wants to merge 4 commits into
faif:masterfrom
abdalwahab-daw:master
Open

Add Null Object and Singleton patterns, enhance Specification#475
abdalwahab-daw wants to merge 4 commits into
faif:masterfrom
abdalwahab-daw:master

Conversation

@abdalwahab-daw

Copy link
Copy Markdown

Summary

This PR adds two new design patterns and enhances an existing one:

New Patterns

  • Null Object (Behavioral): Provides a default do-nothing object to eliminate null checks. Includes a Customer/NullCustomer example with 8 passing doctests.
  • Singleton (Creational): Ensures a class has only one instance. Includes an AppConfig example with 10 passing doctests.

Enhanced Patterns

  • Specification (Behavioral): Added comprehensive docstrings, real-world e-commerce product filtering example with PriceBelow/InCategory/InStock specifications, and expanded doctests from 7 to 17.

All 35 doctests pass successfully.

- Add Null Object behavioral pattern with Customer/NullCustomer example

- Add Singleton creational pattern with AppConfig example

- Enhance Specification with real-world e-commerce product filtering example, full docstrings, and additional doctests
- 34 tests covering all three contributed patterns

- 100% code coverage on all three pattern modules

- Tests include edge cases, composite specifications, and singleton isolation
- Reusable templates: Observer, Singleton, Null Object, Specification

- Real-world examples: Library System, Exam Platform, Inventory Management

- All examples include passing doctests
- Maps each pattern to real-world systems (Library, E-Commerce, ERP, Exam Platform)

- Includes when to use / when NOT to use guidance

- SOLID principles analysis for each pattern

- Pattern selection decision tree and cross-pattern integration example
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

Successfully merging this pull request may close these issues.

1 participant