[Tutor] Iterating through tokens from a split command
sigurd at 12move.de
Sat Mar 20 15:27:14 EST 2004
On 20 Mar 2004, Alan Gauld <- alan.gauld at blueyonder.co.uk wrote:
>> > if __name__ == "__main__":
>> > ConvertFile()
>> Why a class?
> This is considered good OOP style by many teachers.
Forgive me but this is just brain dead (regarding the teachers).
> The application is a class and so, to run the application,
> instantiate it. Thus "everything is an object". It does
A long time ago I took a quick look at Java, saw that to get a simple
Hello World programm I had to create a class and decided that Java and I
were not compatible :-)
Something which is clearly a function, used only once in a programm and
performs only some side effects (IO) needn't be a class. If it's a
function call it a function.
> have the benefit of making the application as a whole
> potentially reusable and extendable.
Without being a prophet or having a crystal ball: that will here never
happen; there are millions of small programms which are written for one
special task (like the one in our example). If you make the failure of
many programmers to write programms too generally (implement a lot of
options which are never used; solve all cases where you only have to
write a programm for a special case) you get bloated software which is
furthermore unnecessarily complicated.
Some days ago I read http://www.strauss.za.com/sla/code_std.html (`How
to write unmaintainable code'). It's funny to read but describes also
real existing problems. Everyone who tries to create for every action a
class should read it. Also Richard Gabriel (a Lisp hacker) has some
good writings software in general (and also especially Lisp); look at
http://www.dreamsongs.com/ if you're interested. Those with a bit time
can read "Objects Have Failed"; these are articles with pro and con OOP;
the authors are Richard Gabriel, Brian Foote on the one side and Guy
Steele and James Noble on the other side.
Please do *not* send copies of replies to me.
I read the list
More information about the Tutor