[Edu-sig] Transition to OOP
David MacQuigg
macquigg at ece.arizona.edu
Tue Feb 9 00:33:43 CET 2010
csev wrote:
> On Feb 5, 2010, at 9:31 PM, kirby urner wrote:
>
>> What I'm not seeing here is any plans to venture into user-defined types
>> i.e. rolling your own classes.
>>
>
> I am indeed tempted into user-defined types. I actually teach OO Python in my App Engine course because it is necessary there. And Think Python has a nice chapter. But my problem is find a use case that drives me there in "exploring data" - I see using objects all over the place - but making your own does not yet feel part of the data narrative.
>
Unless the course is *about* programming, I would delay user-defined
classes until you really feel the need. Then there is no need to
motivate the extra complexity. The benefits will be apparent. I see
that Mathematics for the Digital Age does show an example of a class on
page 88, but I note that this is anecdotal information, not something
the students are expected to learn.
Fast forward six years. I'm helping with a graduate course on
cryptography, and for the first time this semester felt the need for a
class definition. I wrote a function to model an LFSR. Then it became
apparent that I need more that just this one function, so I wrote a
class definition. You can see the two side-by-side at
http://ece.arizona.edu/~edatools/ece596c/LFSR.html.
Even if the class will now do everything the function does and more, it
is still nice to study the function first, understand how the LFSR
works, then look at the more complex class definition.
************************************************************ *
* David MacQuigg, PhD email: macquigg at ece.arizona.edu * *
* Research Associate phone: USA 520-721-4583 * * *
* ECE Department, University of Arizona * * *
* 9320 East Mikelyn Lane * * *
* http://purl.net/macquigg Tucson, Arizona 85710 *
************************************************************ *
More information about the Edu-sig
mailing list