Skip to content

Commit 00f13a9

Browse files
committed
Address PR comments
1 parent 7d93d90 commit 00f13a9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ch05construction/09patterns.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,18 @@
4545
"- If we find a bug in the functionality, this can be fixed in one place\n",
4646
" - This is good because one change can be cascaded\n",
4747
" - 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",
4949
"\n",
5050
"\n",
5151
"**Composition** *(has-a)*:\n",
5252
"\n",
5353
"- Create separate classes (component) which carry out the shared functionality.\n",
5454
"- Instead of inheriting a method, instantiate the class with the components as class variables,\n",
5555
" 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",
5758
"- 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",
5960
"\n",
6061
"We've linked to an article which carries out a deep dive on this topic in the [other resources section](#Other-resources)"
6162
]
@@ -420,6 +421,8 @@
420421
" self.end = self.data[-1, 0]\n",
421422
" self.range = self.end - self.start\n",
422423
" 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",
423426
" self.times = self.data[:, 0].copy()\n",
424427
" self.values = self.data[:, 1].copy()\n",
425428
" self.plot_data = [self.times, self.values]\n",

0 commit comments

Comments
 (0)