<div dir="ltr"><div class="gmail_default" style="font-family:monospace;font-size:large">Hi Cuisers,<br clear="all"></div><div class="gmail_default" style="font-family:monospace;font-size:large">I hope you are well.</div><div class="gmail_default" style="font-family:monospace;font-size:large">I'm taking a course on quantitative finances and as it is custom nowadays, it is Python-centric. Of course, I understand that the libraries matplotlib, pandas, numpy, etc., etc. are what do the work. </div><div class="gmail_default" style="font-family:monospace;font-size:large">But I want to force myself into at least trying to do some of the work in Cuis-Smalltalk.</div><div class="gmail_default" style="font-family:monospace;font-size:large"><br></div><div class="gmail_default" style="font-family:monospace;font-size:large">It is a pleasant challenge; I am confident in Smalltalk but inferior at OO design.</div><div class="gmail_default" style="font-family:monospace;font-size:large"><br></div><div class="gmail_default" style="font-family:monospace;font-size:large">For instance, to find the Present Value, I wrote "procedural" code in a Workspace and wanted to go beyond and do the right Smalltalk thing.</div><div class="gmail_default" style="font-family:monospace;font-size:large"><br></div><div class="gmail_default" style="font-family:monospace;font-size:large">This is my attempt at calculating the present value of a series of cash flows, given a discount rate:</div><div class="gmail_default" style="font-family:monospace;font-size:large"><br></div><div class="gmail_default" style="font-family:monospace"><font size="1">|pv cashFlow discountFactors discountRate sum|<br>cashFlow := OrderedCollection new.<br>discountFactors := OrderedCollection new.<br>cashFlow add: 100; add: 200; add: 250.<br>discountRate := 0.05.<br>discountFactors := (Interval from: 0 to: (cashFlow size - 1))<br>                    collect:<br>                       [:a | 1 / (( 1 + discountRate) ^ a)].<br>pv := cashFlow with: discountFactors collect: [:a :b| a * b].<br>sum := 0.<br>pv collect: [:a | sum := sum + a].<br>Transcript show: sum.</font><br></div><div class="gmail_default" style="font-family:monospace;font-size:large"><br></div><div class="gmail_default" style="font-family:monospace;font-size:large">Now I want to turn all these code into a Class:</div><div class="gmail_default" style="font-family:monospace;font-size:large">1) Identifying the Objects<br>Candidates for objects are:<br>* The Present Value (PV)<br>* The Cash Flows (CF)<br>* The Discount Factors (DF)<br>* The Discount Rate (r)<br></div><div class="gmail_default" style="font-family:monospace;font-size:large"><br></div><div class="gmail_default" style="font-family:monospace;font-size:large">The problem is I'm stuck here; I need help figuring out where to fish to get a proper way to design OO coding.</div><div class="gmail_default" style="font-family:monospace;font-size:large">What resources do you recommend? What path to follow?</div><div class="gmail_default" style="font-family:monospace;font-size:large">Thanks, as always, in advance for all the great help this community provides!</div><div class="gmail_default" style="font-family:monospace;font-size:large">Cheers</div><div class="gmail_default" style="font-family:monospace;font-size:large">Nacho</div><div class="gmail_default" style="font-family:monospace;font-size:large"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><b><font size="2">Ignacio Sniechowski</font></b><b><br></b></div><div><br></div><div><b><br></b></div><div><br></div><div><b></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div><b></b><br></div><b><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><br></b><b><br></b><b><br></b><div><br><br><div style="text-align:left"><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>