3 ms·
Sure. I've recently finished writing 18,000 programming language statements in Visual Basic .NET on 80,000 lines of typing, including comments and blank lines
by graycat 11y ago
Sure. I've recently
finished writing 18,000 programming
language statements in Visual Basic
.NET
on 80,000 lines
of typing, including comments and
blank lines, and so far I have never
even once used inheritance, either
single or multiple. I don't even know
how they would handle naming conflicts
with multiple inheritance. Maybe
Microsoft's many classes in .NET
are making heavy use of inheritance,
but I don't.
So, inheritance is okay, but I don't
use it directly. It just isn't a tool
I use; it stays in the bottom of my
toolbox.
I use classes much like structs in
C or structures in PL/I. Yes, classes
are a little more general, and I do
make use of some of that generality.
But, PL/I structures are quite a bit
more general than structs in C
and, really, nearly as useful as
classes. And, for "addressing" as
in the OP, the array addressing
in PL/I structures is much more
efficient than addressing in
classes.
The OP is correct: I don't think
of classes and inheritance as
representing a is-a relationship.
Sorry, I just don't do that. Don't
need it. Or, I'm big on collection
classes (hopefully based on AVL or
red-black trees) and did write my
own key-value store for session
state storage for my Web site,
and that usage can be regarded
as using is-a, but, again, I don't
get is-a from class inheritance --
just don't need that.
And the OP is correct: A lot that is
in my code has its meaning clear
only in the comments. The code is
like the displayed equations in a
calculus or physics book,
and the text between
the displayed equations is like
the comments. Both the text
in those books and the comments
in the code
are crucial.
Yes, the meaning of the code is
crucial, but for meaning I want
to use a natural language, e.g.,
English, in the comments.
- rumcajz 11y agoBut why not use assembly with a lot of comments then? Higher level languages aspire to take at least some of the "meaning" stuff that would otherwise be in comments and represent it using in-language constructs.
- graycat 11y agoGood observation. Likely the answer is, again, similar to what is done in a calculus or physics book: E.g., in a calculus book, there's a lot behind the Riemann integral, and in physics, behind the electric field, so in those books we don't express everything as just simple arithmetic with comments. And, yes, in my code, when I write a function or subroutine, I give it a mnemonic name and have it do some work that has meaning that is described in the comments. But here is for me a telling point: In grad school, my best math prof just stated that math is written in complete sentences. So, the mathematical symbols do not replace the natural language, e.g., English in the sentences, paragraphs, sections, chapters, etc. Usually good mathematical notation has some mnemonic hints of the meaning, but, still, the meaning is in the text, not the symbols. So, net, there is limited utility and future in trying to have programming language syntax replace the English language for communicating the meaning.