"i feel like directly access is wrong" -- without knowing, it wouldn't even be possible to know what answer you want. And even if you could explain yourself, your question would be primarily opinion based, and likely still too broad (due to the large number of possible alternatives). Your question might be more on-topic at codereview.stackexchange.com or softwareengineering.stackexchange.com, but if you want to post at either of those sites, take care to read their introductory help, to make sure you fix your question to be well-presented and on-topic on those sites. —
Peter Duniho 49 secs ago