[Tutor] creating classes while coding

Bill Allen wallenpb at gmail.com
Mon Feb 21 03:36:54 CET 2011


On Sun, Feb 20, 2011 at 19:59, Alan Gauld <alan.gauld at btinternet.com> wrote:

>
> "Bill Allen" <wallenpb at gmail.com> wrote
>
>
>  However, I do wonder a bit about the practice I have seen of some
>> Python programmers to implement relatively short bits of code, that would
>> be
>> quite simple using functions and procedural code, with classes.
>>
>
> OOP is often overkill, but if its the normal way of programming
> - and for many recent students its all they get taught - then using
> classes is the natural approach. "When all you have is a hammer
> everything looks like a nail..." However, there may be good reasons.
> Classes make reuse easier, in general, than functions. So if the
> task may become a building block for a future project, or even
> an extended version of the current one then building a class
> makes sense.
>

Thanks for the feedback.   Particularly when it comes to reuse of code, I
can see it could be worth my time to look into designing classes a bit more.
  I am starting to write enough code now that I am beginning to reuse some
bits of it regularly.  I have not yet taken the reuse of code further than
packaging up some functions into modules.  I'll look into this further.

You mentioned the programming methods being taught programming students
nowadays.   That OOP is a basic programming method being taught sure leaves
me in the dust.   The last formal programming class I took in college was
way back in the early 90s and it was to learn IBM 370 Assembly Language.
OOP was not only not on the radar, it was not even in the same solar
system!    :-D

feeling kinda old, and I am not all that old...

--Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110220/bb9c4a8d/attachment-0001.html>


More information about the Tutor mailing list