itwanger / itwanger/toBeBetterJavaer

《设计模式手册》中装饰器模式(第7章)示例代码有误

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
17.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

  1. 定义了抽象类Food,Food中抽象方法为getDesc()
  2. 定义了两个食物类继承了Food,但两个食物类重写的抽象方法为cook()
    如图所示:
    2024-06-03_10-04
  3. 定义了装饰的抽象类FoodDecoration,继承Food。再定义两个不同的装饰类继承FoodDecoration,但只实现了FoodDecoration中的抽象方法,没有实现Food的抽象方法。如图所示:
    2024-06-03_10-08

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.