You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: adapter/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ In this concept source code, there are two classes, `ClassA` and `ClassB`, with
37
37
38
38
I can create objects of both classes in the client and it works. But before using each objects method, I need to do a conditional check to see which type of class it is that I am calling since the method signatures are different.
39
39
40
-
It means that the client is doing extra work. Instead, I can create an Adapter interface for the incompatible `ClassB`, which reduces the need for the extra conditional logic.
40
+
It means that the client is doing extra work. Instead, I can create an Adapter interface for the incompatible `ClassB`, that reduces the need for the extra conditional logic.
41
41
42
42
## Output
43
43
@@ -136,7 +136,7 @@ You can use it in logical statements as I do in [/adapter/adapter_concept.py](/a
136
136
137
137
The time module provides time related functions, most notably in my case, the current epoch (ticks) since `January 1, 1970, 00:00:00 (UTC)` .
138
138
139
-
The `time` module provides many options which are outlined in more detail at [https://docs.python.org/3/library/time.html](https://docs.python.org/3/library/time.html)
139
+
The `time` module provides many options that are outlined in more detail at [https://docs.python.org/3/library/time.html](https://docs.python.org/3/library/time.html)
140
140
141
141
In [/adapter/cube_a.py](/adapter/cube_a.py), I check the `time.time()` at various intervals to compare how long a task took.
Copy file name to clipboardexpand all lines: bridge/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The **Bridge pattern** is similar to the [Adapter](/adapter) pattern except in t
6
6
7
7
The Bridge is an approach to refactor already existing code, whereas the Adapter creates an interface on top of existing code through existing available means without refactoring any existing code or interfaces.
8
8
9
-
The motivation for converting your code to the Bridge pattern is that it may be tightly coupled. There is logic and abstraction close together which is limiting your choices in how you can extend your solution in the way that you need.
9
+
The motivation for converting your code to the Bridge pattern is that it may be tightly coupled. There is logic and abstraction close together that is limiting your choices in how you can extend your solution in the way that you need.
10
10
11
11
E.g., you may have one Car class, that produces a very nice car. But you would like the option of varying the design a little, or outsourcing responsibility of creating the different components.
12
12
@@ -152,5 +152,5 @@ PS> python
152
152
153
153
* Use when you want to separate a solution where the abstraction and implementation may be tightly coupled and you want to break it up into smaller conceptual parts.
154
154
* Once you have added the bridge abstraction, you should be able to extend each side of it separately without breaking the other.
155
-
* Also, once the bridge abstraction exists, you can more easily create extra concrete implementations for other similar products which may also happen to be split across similar conceptual lines.
155
+
* Also, once the bridge abstraction exists, you can more easily create extra concrete implementations for other similar products that may also happen to be split across similar conceptual lines.
156
156
* The Bridge pattern is similar to the adapter pattern except in the intent that you developed it. The bridge is an approach to refactor already existing code, whereas the adapter adapts to the existing code through its existing interfaces and methods without changing the internals.
Copy file name to clipboardexpand all lines: builder/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ The Builder Pattern tries to solve,
9
9
* How can a class create different representations of a complex object?
10
10
* How can a class that includes creating a complex object be simplified?
11
11
12
-
The Builder and Factory patterns are very similar in the fact they both instantiate new objects at runtime. The difference is when the process of creating the object is more complex, so rather than the Factory returning a new instance of `ObjectA`, it calls the builders director constructor method `ObjectA.construct()`which goes through a more complex construction process involving several steps. Both return an Object/Product.
12
+
The Builder and Factory patterns are very similar in the fact they both instantiate new objects at runtime. The difference is when the process of creating the object is more complex, so rather than the Factory returning a new instance of `ObjectA`, it calls the builders director constructor method `ObjectA.construct()`that goes through a more complex construction process involving several steps. Both return an Object/Product.
13
13
14
14
## Terminology
15
15
@@ -25,7 +25,7 @@ The Builder and Factory patterns are very similar in the fact they both instanti
25
25
## Source Code
26
26
27
27
1. Client creates the **Director**.
28
-
2. The Client calls the Directors `construct()` method which manages each step of the build process.
28
+
2. The Client calls the Directors `construct()` method that manages each step of the build process.
29
29
3. The Director returns the product to the client or alternatively could also provide a method for the client to retrieve it later.
Copy file name to clipboardexpand all lines: chain_of_responsibility/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -111,9 +111,9 @@ See PEP-3111 : [https://www.python.org/dev/peps/pep-3111/](https://www.python.or
111
111
## Summary
112
112
113
113
* The object will propagate through the chain until fully processed.
114
-
* The object does not know which successor or how many will process it.
114
+
* The object does not know that successor or how many will process it.
115
115
* The next successor in the chain is chosen dynamically at runtime depending on logic from the current successor.
116
-
* Successors implement a common interface which makes them work independently of each other, so that they can be used recursively or possibly in a different order.
116
+
* Successors implement a common interface that makes them work independently of each other, so that they can be used recursively or possibly in a different order.
117
117
* A user wizard, or dynamic questionnaire are other common use cases for the chain of responsibility pattern.
118
118
* The chain of responsibility and [Composite](/composite) patterns are often used together because of their similar approach to hierarchy and possible re-ordering. The Composites parent/child relationship is set in an object's property by a process outside of the class and can be changed at runtime. While with the Chain of Responsibility, each successor runs a dynamic algorithm internally, to decide which successor is next in line.
119
119
* The chain can be fully dynamically created, or it can be set as a default with the possibility of changing at runtime.
Copy file name to clipboardexpand all lines: command/README.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
The **Command** pattern is a behavioral design pattern, in which an abstraction exists between an object that invokes a command, and the object that performs it.
6
6
7
-
E.g., a button will call the **Invoker**, which will call a pre-registered **Command**, which the **Receiver** will perform.
7
+
E.g., a button will call the **Invoker**, that will call a pre-registered **Command**, that the **Receiver** will perform.
8
8
9
9
A Concrete Class will delegate a request to a command object, instead of implementing the request directly.
10
10
@@ -28,18 +28,18 @@ Uses:
28
28
29
29
***Receiver**: The object that will receive and execute the command.
30
30
***Invoker**: The object that sends the command to the receiver. E.g., A button.
31
-
***Command Object**: Itself, an object, which implements an execute, or action method, and contains all required information to execute it.
32
-
***Client**: The application or component which is aware of the Receiver, Invoker and Commands.
31
+
***Command Object**: Itself, an object, that implements an execute, or action method, and contains all required information to execute it.
32
+
***Client**: The application or component that is aware of the Receiver, Invoker and Commands.
Copy file name to clipboardexpand all lines: facade/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -165,5 +165,5 @@ Found 2 errors in 2 files (checked 1 source file)
165
165
* You want to layer your subsystems into an abstraction that is easier to understand.
166
166
*[Abstract Factory](/abstract_factory) and Facade can be considered very similar. An Abstract Factory is about creating in interface over several creational classes of similar objects, whereas the Facade is more like an API layer over many creational, structural and/or behavioral patterns.
167
167
* The [Mediator](/mediator) is similar to the Facade in the way that it abstracts existing classes. The Facade is not intended to modify, load balance or apply any extra logic. A subsystem does not need to consider that existence of the facade, it would still work without it.
168
-
* A Facade is a minimal interface which could also be implemented as a [Singleton](/singleton).
168
+
* A Facade is a minimal interface that could also be implemented as a [Singleton](/singleton).
169
169
* A Facade is an optional layer that does not alter the subsystem. The subsystem does not need to know about the Facade, and could even be used by many other facades created for different audiences.
Copy file name to clipboardexpand all lines: factory/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ ABCMeta refers to **A**bstract **B**ase **C**lasses.
77
77
78
78
The benefits of using ABCMeta classes to create abstract classes is that your IDE and Pylint will indicate to you at development time whether your inheriting classes conform to the class definition that you've asked them to.
79
79
80
-
Abstract classes are not instantiated directly in your scripts, but instead inherited by subclasses that will provide the implementation code for the abstract methods. E.g., you don't create `IChair`, but you create `SmallChair`which implemented the methods described in the `IChair` interface.
80
+
Abstract classes are not instantiated directly in your scripts, but instead inherited by subclasses that will provide the implementation code for the abstract methods. E.g., you don't create `IChair`, but you create `SmallChair`that implemented the methods described in the `IChair` interface.
81
81
82
82
An abstract method is a method that is declared, but contains no implementation. The implementation happens at the class that inherits the abstract class.
Copy file name to clipboardexpand all lines: flyweight/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ In this example, I create a dynamic table with 3 rows and 3 columns each. The co
57
57
58
58
The letters are the flyweights and only a code indicating the letter is stored. The letters and numbers are shared many times.
59
59
60
-
The columns are the contexts and they pass the extrinsic vales describing the combination of letters, the justification left, right or center, and the width of the table column which is then used for the space padding.
60
+
The columns are the contexts and they pass the extrinsic vales describing the combination of letters, the justification left, right or center, and the width of the table column that is then used for the space padding.
Copy file name to clipboardexpand all lines: interpreter/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ I then construct the AST manually, by adding a
55
55
3. Non-Terminal `Add` row containing the previous Non-Terminal row and the `7`
56
56
4. Non-Terminal `Subtract` row containing the previous Non-Terminal row and the `2`
57
57
58
-
The AST root becomes the final row that was added, and then I can run the `interpret()` method on that which will interpret the full AST recursively because each AST row references the row above it.
58
+
The AST root becomes the final row that was added, and then I can run the `interpret()` method on that, which will interpret the full AST recursively because each AST row references the row above it.
0 commit comments