You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should objects and methods be included in basics? #46
@bjmorgan raised the idea that the concept of objects having methods should be introduced immediately after functions, without necessarily explaining classes.
Pros: It would make the optimisation section more readable as it would explain solution.x and solution.fun. , as well as, most likely, some of the good practice chapter. It is probably a nice thing just to mention. Build with exposure from examples in the good practise and data work sections and then property introduce it in the advanced chapter.
Cons: Thinking of chemistry examples that do not introduce classes may be tricky. It may be too much, too fast for students and confuse them.
This is an interesting discussion. When I learned programming I followed C++ How to Program, where the authors introduce classes, objects, and member functions even before control statements and functions (see C++ How to Program - TOC). That was quite extreme (and I struggled with most concepts at first), but since most libraries are based on OOP, a short introduction inBasics might be beneficial. This will help to better understand simple things like mystring.upper() (already used in 1.1 Types) and myarray.shape (that will probably appear in 1.3 Numpy Arrays).
I think there is definitely utility to introducing class methods, perhaps as "object methods" later in the Basics section.
However, I think that introducing everything to do with classes is a bit over the top (and very C++ esc). Remember that the aim of the book is to give chemists the tool of programming for chemistry tasks, you don't need to be able to do OOP to fit a straight line to Arrhenius data and make a nice plot of it.
Activity
j-m-dean commentedon Apr 2, 2020
Pros: It would make the optimisation section more readable as it would explain solution.x and solution.fun. , as well as, most likely, some of the good practice chapter. It is probably a nice thing just to mention. Build with exposure from examples in the good practise and data work sections and then property introduce it in the advanced chapter.
Cons: Thinking of chemistry examples that do not introduce classes may be tricky. It may be too much, too fast for students and confuse them.
arm61 commentedon Apr 2, 2020
A potential way round the first con would be to make a custom class that is like
In the book the student would
import elementsthen do likeRMeli commentedon May 1, 2020
This is an interesting discussion. When I learned programming I followed C++ How to Program, where the authors introduce classes, objects, and member functions even before control statements and functions (see C++ How to Program - TOC). That was quite extreme (and I struggled with most concepts at first), but since most libraries are based on OOP, a short introduction in
Basicsmight be beneficial. This will help to better understand simple things likemystring.upper()(already used in1.1 Types) andmyarray.shape(that will probably appear in1.3 Numpy Arrays).arm61 commentedon May 2, 2020
I think there is definitely utility to introducing class methods, perhaps as "object methods" later in the
Basicssection.However, I think that introducing everything to do with classes is a bit over the top (and very C++ esc). Remember that the aim of the book is to give chemists the tool of programming for chemistry tasks, you don't need to be able to do OOP to fit a straight line to Arrhenius data and make a nice plot of it.