Can a low-level programmer learn OOP?
Alex Martelli
aleax at mac.com
Sat Jul 14 00:43:43 EDT 2007
Chris Carlen <crcarleRemoveThis at BOGUSsandia.gov> wrote:
> From what I've read of OOP, I don't get it. I have also found some
> articles profoundly critical of OOP. I tend to relate to these articles.
OOP can be abused (particularly with deep or intricate inheritance
structures). But the base concept is simple and clear: you can bundle
state and behavior into a stateful "black box" (of which you may make as
many instances, with independent state but equal behavior, as you need).
> Hence, being a hardware designer rather than a computer scientist, I am
> conditioned to think like a machine. I think this is the main reason
> why OOP has always repelled me.
I'm an MS in EE (minoring in computer engineering) by training (over a
quarter century ago:-); I "slid" into programming kind of inexhorably
(fate obviously wanted me to:-) but paradigms such as OOP (and
functional programming, but that's another subject) always made sense to
me *in direct analogy to my main discipline*. A JK flip-flop and a D
flip-flop are objects with 1-bit states and different behavior; I may
put in my circuit as many (e.g.) J-K flip-flops as I need, and each will
have separate state, even though each will have identical behavior (how
it responds to signals on the J and K lines). I don't need to think
about how a J-K flip-flop is *made*, inside; I use it as a basic
component in designing richer circuits (well, I did back when I DID
design circuits, but I haven't _totally_ forgotten:-). I do know how to
make one in terms of transistors, should I ever need to (well, maybe I'd
have to look it up, but I _used_ to know:-), but such a need is unlikely
to arise, because it's likely to be there as a basic component in
whatever design library I'm supposed to use for this IC.
Components much richer than J-K flip-flops are obviously more common
nowadays, but remember my real-world experience designing chips is from
the early '80s;-). Nevertheless the concept of a "bundle of state and
behavior" is still there -- and a direct, immediate analogy to OOP.
(Functional programming, OTOH, is analogous to stateless input-output
transformation circuits, an even more basic concept in HW design:-). If
anything, it's the concept of "procedural programming" that has no
direct equivalent in HW design (unless you consider microcode "HW", and,
personally, I don't;-). [[Fortunately as a part of the CE minor I did
learn Fortran, Lisp and Pascal, and a few machine-languages too, so I
wasn't totally blown away when I found myself earning a living by
programming rather than by designing chips, but that's another
story:-)]]
Alex
More information about the Python-list
mailing list