]> ocean-lang.org Git - ocean-D/blob - harmful
updates
[ocean-D] / harmful
1
2       Inheritance considered harmful.
3
4 Definition of "inheritance" which I am using.
5  
6   Defining one class of objects as an extension of another class of objects.
7
8 Why it is harmful
9   Inheritance is harmful because it focuses on subtype polymorphism in
10   preference to parametric polymorphism.
11
12   List of open issues from that workshop:
13     point/colour point
14     link list/doubly linked list
15     ..
16
17 Why it isn't necessary
18   Inheritance is not necessary as it an implementation convenience.
19   subtype polymorphism can be expressed without it
20
21
22 Conclusion?
23
24
25
26 TAKE TWO
27
28  
29
30 1/ Inheritance is an implementation technique, not an abstraction technique
31
32 1a/ Inheritance is used to effect several different abstractions.
33     These should be available in their own right.
34
35   i) subtype polymorphism
36
37   ii) code reuse
38
39   iii) providing default behaviour
40
41      Benefits of defaults;
42         code brevity
43         code resiliance to extending type, if defaults are provided
44
45 2/ Inheritance focuses on subtype polymorphism to the detrement on 
46    parametric polymorphism.
47
48   i) Binary operators
49
50   ii) linked lists
51
52   iii) "selftype"
53
54 Recomendations:
55   provide pure subtype and parametric polymorphism
56   provide explicit method of assigning default values/behaviours
57