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: slides_sources/source/session07.rst
+22-19Lines changed: 22 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
.. include:: include.rst
2
2
3
3
***************************
4
-
Object Oriented programming
4
+
Object Oriented Programming
5
5
***************************
6
6
7
7
================
@@ -27,8 +27,6 @@ Lightning Talks today
27
27
|
28
28
|Charles E Robison
29
29
|
30
-
|Paul S Briant
31
-
|
32
30
|Paul Vosper
33
31
|
34
32
@@ -110,7 +108,8 @@ Python is a Dynamic Language
110
108
That clashes with "pure" OO
111
109
112
110
Think in terms of what makes sense for your project
113
-
-- not any one paradigm of software design.
111
+
112
+
-- not any one paradigm of software design.
114
113
115
114
116
115
.. nextslide::
@@ -309,8 +308,10 @@ Does this look familiar from C-style procedural programming?
309
308
310
309
.. nextslide::
311
310
312
-
Anything assigned to a ``self.`` attribute is kept in the instance
313
-
name space -- ``self`` *is* the instance.
311
+
Anything assigned to a ``self`` attribute is kept in the instance
312
+
name space
313
+
314
+
-- ``self`` *is* the instance.
314
315
315
316
That's where all the instance-specific data is.
316
317
@@ -390,6 +391,9 @@ Huh???? I only gave 2
390
391
391
392
LAB
392
393
----
394
+
.. rst-class:: medium
395
+
396
+
We now know enough to do something useful.
393
397
394
398
Let's say you need to render some html...
395
399
@@ -414,9 +418,7 @@ Lightning Talks
414
418
.. rst-class:: medium
415
419
416
420
|
417
-
|Charles E Robison
418
-
|
419
-
|Paul S Briant
421
+
|Charles E Robisons
420
422
|
421
423
|Paul Vosper
422
424
|
@@ -506,7 +508,7 @@ Here's a program design suggestion:
506
508
507
509
"""
508
510
509
-
Whenever you override a method, the interface of the new method should be the same as the old. It should takethe same parameters, return the same type, and obey the same preconditions and postconditions.
511
+
Whenever you override a method, the interface of the new method should be the same as the old. It should take the same parameters, return the same type, and obey the same preconditions and postconditions.
510
512
511
513
If you obey this rule, you will find that any function designed to work with an instance of a superclass, like a Deck, will also work with instances of subclasses like a Hand or PokerHand. If you violate this rule, your code will collapse like (sorry) a house of cards.
512
514
@@ -574,7 +576,7 @@ When to Subclass
574
576
575
577
.. nextslide::
576
578
577
-
"Is a" vs "Has a"
579
+
"**Is** a" vs "**Has** a"**
578
580
579
581
You may have a class that needs to accumulate an arbitrary number of objects.
580
582
@@ -705,16 +707,17 @@ LAB
705
707
706
708
* html renderer: let's see how much more we can do!
0 commit comments