|
45 | 45 | "- If we find a bug in the functionality, this can be fixed in one place\n",
|
46 | 46 | " - This is good because one change can be cascaded\n",
|
47 | 47 | " - This can be bad because every subclass relies on its parent and changing one may need us to change the other\n",
|
48 |
| - " (known tight coupling)\n", |
| 48 | + " (known as tight coupling)\n", |
49 | 49 | "\n",
|
50 | 50 | "\n",
|
51 | 51 | "**Composition** *(has-a)*:\n",
|
52 | 52 | "\n",
|
53 | 53 | "- Create separate classes (component) which carry out the shared functionality.\n",
|
54 | 54 | "- Instead of inheriting a method, instantiate the class with the components as class variables,\n",
|
55 | 55 | " when that functionality is required then we call that method on from the component.\n",
|
56 |
| - "- Unlike inheritance, you can design each component's interface so that it knows how to interact with other parts of your code\n", |
| 56 | + "- Unlike inheritance, you can design each component's interface independently\n", |
| 57 | + " so that it knows how to interact with other parts of your code\n", |
57 | 58 | "- Potential to have some code duplication\n",
|
58 |
| - " - Doesn't have the problem of side effects cascading when you change alter one component.\n", |
| 59 | + " - Doesn't have the problem of side effects cascading when you alter one component.\n", |
59 | 60 | "\n",
|
60 | 61 | "We've linked to an article which carries out a deep dive on this topic in the [other resources section](#Other-resources)"
|
61 | 62 | ]
|
|
420 | 421 | " self.end = self.data[-1, 0]\n",
|
421 | 422 | " self.range = self.end - self.start\n",
|
422 | 423 | " self.step = self.range / self.count\n",
|
| 424 | + " # create separate arrays as some algorithms require an array as an argument\n", |
| 425 | + " # and will throw an exception a view of an array is passed as an argument\n", |
423 | 426 | " self.times = self.data[:, 0].copy()\n",
|
424 | 427 | " self.values = self.data[:, 1].copy()\n",
|
425 | 428 | " self.plot_data = [self.times, self.values]\n",
|
|
0 commit comments