Re: [Tutor] FUNCTIONS vs. CLASSES (early beginner questions)

2017-03-28 Thread Alan Gauld via Tutor
On 28/03/17 17:45, Rafael Knuth wrote: > Question: When should I use functions? > When should I use classes? Thee is no definitive answer but here are some guidelines: 1) Many instances -> class 2) Many methods sharing the same data -> class 3) An algorithm that has no side effects -> a function

[Tutor] FUNCTIONS vs. CLASSES (early beginner questions)

2017-03-28 Thread Rafael Knuth
Question: When should I use functions? When should I use classes? I wrote my program twice: as a function and as a class (I did so for educational purposes, to better understand both concepts). Both programs do exactly the same, and the work neatly. Can you advise when I should use functions and