Can a low-level programmer learn OOP?

samwyse samwyse at gmail.com
Fri Jul 13 16:20:35 EDT 2007


On Jul 13, 1:05 pm, Chris Carlen <crcarleRemoveT... at BOGUSsandia.gov>
wrote:
> John Nagle wrote:
> > Chris Carlen wrote:[edit]
> >> 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.
>
> >     Why?
>
> When pointers were first explined to me, I went "Ok."  And rather
> quickly ideas lit up in my head about what I could do with them.
>
> When I read what OOP is, that doesn't happen.  All I think is "what's
> the point of this?"  "What can this do for me that I can do already with
> the procedural way of thinking?"  And if it can't do anything new, then
> why rearrange my thinking to a new terminology?  It's results that
> matter, not the paradigm.

What can this do for me that I can do already with the procedural way
of thinking?  Absolutely nothing; it's all Turing machines under the
hood.

Why rearrange my thinking to a new terminology?  Because new
terminologies matter a lot.  There's nothing that you can do with
pointers that can't be done with arrays; I know because I wrote a lot
of FORTRAN 77 code back in the day, and withouy pointers I had to
write my own memory allocation routines that worked off of a really
big array.

Likewise, there's nothing that you can do in C that can't be done with
C++ (especially since C++ was originally a preprocessor for C);
however C++ will keep track of a lot of low-level detail for you so
you don't have to think about it.  Let's say that you have an embedded
single-board computer with a serial and a parallel port.  You probably
have two different routines that you use to talk to them, and you have
to always keep track which you are using at any given time.

It's a lot easier to have a single CommPort virtual class that you use
in all of your code, and then have two sub-classes, one for serial
ports and one for parallel.  You'll be especially happy for this when
someone decides that as well as logging trace information to a
printer, it would be nice to also log it to a technician's handhelp
diagnostic device.




More information about the Python-list mailing list