itwanger / itwanger/toBeBetterJavaer
《设计模式手册》中装饰器模式(第7章)示例代码有误
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
- 定义了抽象类Food,Food中抽象方法为getDesc()
- 定义了两个食物类继承了Food,但两个食物类重写的抽象方法为cook()
如图所示:
- 定义了装饰的抽象类FoodDecoration,继承Food。再定义两个不同的装饰类继承FoodDecoration,但只实现了FoodDecoration中的抽象方法,没有实现Food的抽象方法。如图所示:
Contributor guide
No contributing guide indexed for this repository
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
Open the design-pattern handbook's Chapter 7 decorator-pattern example and compare the Food, concrete food, FoodDecoration, and concrete decorator definitions described in the issue. Make the abstract method declarations and implementations consistent, then verify that the example is internally coherent and can compile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100