in reply to Re: API Design
in thread API Design
well that's it - I am not at all sure with OOP - I have to big questions:
1) With a class for the FX object - you could have many instances of that object - however where would I set a "global" setting that affects all the objects in that class - e.g. 'the separator character, or '/' (e.g. 'EUR/USD', or maybe 'EURUSD', or 'EUR-USD') - do I have to create a parent class or something?2) It strikes me that I could break down the object a bit more and have a "Quote" class which would contain something like (timestamp, open, high, low, close) - that could then be used with many derived classes not just Forex quotes, but Stock Quotes, Bonds quotes, etc.
3) and then I guess you could create one 'pair' object - e.g. 'EUR/USD', and then have many (an array) of quote objects for each pair object. Or would that be better to have a quote object which would be of type 'pair' (e.g. type 'EUR/USD')...
and then I get a head explosion and think of giving up...
Also another principal I have heard is that one should make as much of the code as possible as straight functions (normal module code) so that it could be called by any script, and then have the Class call the straight function - is that a good practice?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: API Design
by BrowserUk (Patriarch) on Mar 09, 2015 at 19:38 UTC |