You get much better code reuse out of functions, especially with generic programming. (D being the number one generic language with its templates and CTFE.) The more loosely coupled the data becomes from the business logic, the higher application quality appears to be and the more breakage decreases. Presenting an interface for a library whereby the types can automatically be overridden is a good way to lead people into writing code that's going to break later and may burden the library's implementer with supporting something he didn't know he'd need to support. (e.g. in Nowak's ZIP library.)
I used to believe that virtual was a better default, but these
days I think the opposite. My reasoning is that inheritance is a
very poor tool for code reuse. The way I see it now, inheritance
is a tool for modelling "is a" relationships and variations on
objects, but it's bad to use it in an API as a "to implement your
business logic inherit here" thing.
- Re: Broken? Paulo Pinto
- Re: Broken? Kapps
- Re: Broken? Andrei Alexandrescu
- Re: Broken? monarch_dodra
- Re: Broken? Andrei Alexandrescu
- Re: Broken? Sean Kelly
- Re: Broken? Sean Kelly
- Re: Broken? Jacob Carlborg
- Re: Broken? Dmitry Olshansky
- Re: Broken? Kapps
- Re: Broken? w0rp
- Re: Broken? Manu
- Re: Broken? Michel Fortin
- Re: Broken? Steven Schveighoffer
- Re: Broken? Andrej Mitrovic
- Re: Broken? Michel Fortin
- Re: Broken? Steven Schveighoffer
- Re: Broken? monarch_dodra
- Re: Broken? Steven Schveighoffer
- Re: Broken? Andrej Mitrovic
- Re: Broken? Szymon Gatner
