Hello Tim, 2017-06-12 16:15 GMT-03:00 Tim Mackinnon <tim@testit.works>:
Hi - Iâm after some ideas or maybe previous examples that might guide me in the best approach of wrapping a low level library (essentially the Jira connector that Phil demoâd at Pharo days this year).
There are some low level commands that will fetch json arrays for you given a âliraâ instance- e.g:
board := JiraBoard fromJira: jira named: âProject'. sprints := board sprintsFrom: jira.
My question is related to building on top of this - and its a style question.
I want model objects that wrap the json arrays and let me navigate things a bit more simply, and query details more naturally - however I canât decide whether my model objects should âcontainâ a jira when you instantiate them - which can be re-used for subsequent queries - OR - whether I should view jira as a from of context, and keep passing it to methods when I need to retrieve more details, or child objects?
e.g. myBoard := ModelBoard fromJira: jira named: âProjectâ. mySprints := myBoard sprints. âNo need to pass the jira againâ.
vs.
mySprints :- myBoard sprintsIn: jira.
Iâm wondering if anything might guide me one way or the other? Is one more tasteful/elegant than the other?
I'd go for the first option. It is, every JIRA object knows the "jira" it belongs to. Although the second option is better for decoupling, not having to pass objects around to obtain properties allows you to better integrate with the tools (think GTInspector with specific inspector for cards). I don't understand what the "jira" is exactly, if a whole JSON object (a Dictionary) containing everything, a connection to JIRA API, or just the JSON object/Dictionary branch containing the attributes specific of the "wraping" object (the board, in this case). Regards! Esteban A. Maringolo