OOP & Abstract Classes

Adam Gaskins agaskins_ng at kelleramerica.com
Mon May 11 16:53:38 CEST 2009

Hi all,

-- Non critical info--
I am a fairly seasoned PHP developer (don't shoot, I'm changing teams!:) who 
is admittedly behind the curve with OOP. Like most who learned PHP, I 
started doing web app backend stuff, but I have moved to full blown windows 
apps in the last 6 months using Winbinder. As you may know Winbinder is 
essentially abandoned, and programming windows apps with Winbinder or even 
GTK-PHP is less than ideal. I also deal heavily in serial/rs-232 
communications which is a pain in PHP. Long story short, I'm tired of doing 
things in such a hackish manner and want to write applications that are 
cross platform (I'd like to get our production dept on linux eventually) and 
truely object oriented.
-- END non critical stuff--

So I was beginning to learn OOP for PHP, and it seemed to me that abstract 
classes were just right for my application. In my application I must 
communicate with several peices of test equipment that communicate via 
RS-232. Most use SCPI instructions, some do not and require low level 

The way I understand abstract classes is that I could have a class that has 
all my abstract methods such as 'init', 'getMeasurement', 'setPressure', 
etc... then I could use this common interface to to control my different 
pieces of hardware (after I write a library for each of them).

Is this a valid application for abstract classes? Or am I making life more 
complicated than it need be?

Now, I have read that Pythons OOP implimentation is so much better and more 
complete then PHP's, but I cant find anything about abstract classes except 

...which says it doesn't exist in Python and you can only do this hack to 
make it work (and I don't particularly understand how to impliment it from 
this article).

This makes me suspect I am making things more comlicated than they need to 
be. Could someone help me understand the proper way to impliment a set 
classes/methods to deal with several peices of similar and not so similar 
hardware? Not looking for anyone to write code for me, just help 
understanding some of these OOP concepts and how they would apply to my 


More information about the Python-list mailing list