On 1/11/2016 3:45 PM, Travis Griggs wrote:
On Jan 10, 2016, at 9:48 AM, Bernardo Sulzbach <mafagafogiga...@gmail.com>
wrote:
Essentially, classes (as modules) are used mainly for organizational purposes.
Although you can solve any problem you would solve using classes
without classes, solutions to some big problems may be cheaper and
more feasible using classes.
As a long term OO purist practitioner, I would add to this. Obviously, you can
organize your code any way you want, with or without classes. You could put all
your functions with an odd number of letters in one class, and all of the even
numbered ones in another class.
Having listened to the guy (Alan Kay) who coined the term (Object Oriented
Programming) quite a bit over the years, I believe that the focus of OO (of
which classes are a particular implementation approach) is to bind behavior to
data. In “traditional” programming approaches, one focused on the algorithm
(behavior) first, and then figured out what data needed to flow where to get
the job done. Classes provided a mechanism to turn that equation, generally
speaking, around. One thinks about the data first, and then figures out what
behavior binds best to that data. And how that data will interact (inter-object
behavior, often called messages) to get your job done. For some (many)
problems, this can be a real win. And for some, not so much.
I think, this is often why, for a simple script, OO just kind of gets in the
way. You have a straightforward procedure that you just want to do. The state
(data) is not rich enough to make making it the focal point of your program.
Well said, thanks!
--
https://mail.python.org/mailman/listinfo/python-list