Skip to content

Commit 11f098b

Browse files
committed
Markdown linting
1 parent 2580c87 commit 11f098b

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,41 @@
44

55
I am aiming for a literal translation without trying to make the code pythonic beyond, e.g. using python conventions for `ClassNames` and `method_names` and putting all of the code in a single file where it makes sense to do so.
66

7-
### Sample Code : Java
7+
## Sample Code : Java
88

99
From the book 📖:
1010

1111
```java
1212
package headfirst.designpatterns.strategy;
1313

1414
public abstract class Duck {
15-
FlyBehavior flyBehavior;
16-
QuackBehavior quackBehavior;
15+
FlyBehavior flyBehavior;
16+
QuackBehavior quackBehavior;
1717

18-
public Duck() {
19-
}
18+
public Duck() {
19+
}
2020

21-
public void setFlyBehavior(FlyBehavior fb) {
22-
flyBehavior = fb;
23-
}
21+
public void setFlyBehavior(FlyBehavior fb) {
22+
flyBehavior = fb;
23+
}
2424

25-
public void setQuackBehavior(QuackBehavior qb) {
26-
quackBehavior = qb;
27-
}
25+
public void setQuackBehavior(QuackBehavior qb) {
26+
quackBehavior = qb;
27+
}
2828

29-
abstract void display();
29+
abstract void display();
3030

31-
public void performFly() {
32-
flyBehavior.fly();
33-
}
31+
public void performFly() {
32+
flyBehavior.fly();
33+
}
3434

35-
public void performQuack() {
36-
quackBehavior.quack();
37-
}
35+
public void performQuack() {
36+
quackBehavior.quack();
37+
}
3838

39-
public void swim() {
40-
System.out.println("All ducks float, even decoys!");
41-
}
39+
public void swim() {
40+
System.out.println("All ducks float, even decoys!");
41+
}
4242
}
4343
```
4444

@@ -68,4 +68,4 @@ class Duck():
6868

6969
def swim():
7070
print("All ducks float, even decoys! 〰🦆〰")
71-
```
71+
```

chapter01_strategy/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Chapter 1: Strategy design pattern
22

3-
> **Strategy**: defines a family of algorithms, encapsulates each one and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
3+
**Strategy**: defines a family of algorithms, encapsulates each one and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
44

5-
I think the more pythonic approach would be to define methods rather than classes, and this would not violate the above definition. The class-based approach is needed in Java and has the advantage of explicitly setting out the required method in an abstract base class.
5+
I think the more pythonic approach would be to define methods rather than classes, and this would not violate the above definition. The class-based approach is needed in Java and has the advantage of explicitly setting out the required method in an abstract base class.

chapter02_observer/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
> **Observer**: defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.
44
5-
Very useful design pattern, often used in user interfaces and as part of the popular Model-View-Controller design pattern used, for instance, in Django.
5+
Very useful design pattern, often used in user interfaces and as part of the popular Model-View-Controller design pattern used, for instance, in Django.
66

7-
I find the name contradictory: shouldn't it be called the 'Subject' design pattern as the subject is the key actor ?
7+
I find the name contradictory: shouldn't it be called the 'Subject' design pattern as the subject is the key actor ?

chapter03_decorator/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Chapter 3: Decorator design pattern
22

3-
> **Decorator**: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
3+
**Decorator**: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
44

55
Not quite the same as python decorator syntax as in python you call the _decorated function_ and the decorating function is called first whereas the _decorating function_ must be called here.
66

7-
I subclass `ABC` and used the `@abstractmethod` decorator from the `abc` module here but do not use any of this functionality - it just serves as documentation.
7+
I subclass `ABC` and used the `@abstractmethod` decorator from the `abc` module here but do not use any of this functionality - it just serves as documentation.

0 commit comments

Comments
 (0)