[Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

Alan Gauld alan.gauld at btinternet.com
Thu Jan 28 17:14:10 EST 2016


On 28/01/16 20:03, Danny Yoo wrote:
> (Aside: this is somewhat why I think the topic of inheritance and
> inheritance
> hierarchies are entirely the wrong things to focus on when we're
> teaching OOP. 

Absolutely.
I always try to focus on the objects passing, and responding to, *messages*
as the key feature. Inheritance is a convenience, often abused to do code
reuse. The thing to focus on is polymorphism which just happens to be
implemented by inheritance heirarchies in most languages (although
not in python!)

One of the things I like about Objective C is the fact that it has a
separate
notation for sending messages to objects compared to calling a function(*).
It really emphasises the different concepts at work - sending a message
is not the same as simply calling a function, there is a layer of magic in
between!

>  What I think OOP's heart is beating is in the ability to parameterize
behavior.)

That's a by-product of encapsulation and polymorphism which are the
beating heart of pure OOP (sorry Steve ;-).

(*) In ObjectiveC:
result = [anObject  aMessage:aParameter];  // send a message to an object

result2 = aFunction(anObject, aParameter);  // call a function

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list