Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
C0D44666912dYou lost me at "thematic helpers" and "whole app" , there's something not quite right about calling a helper function / method from a global layer.
Lyniven446212dI guess you can have a Helpers namespace for a framework, such as Laravel that have its Str and Arr classes.
For an app, and all of it? Why is my question
netikras1767612dA tiny change and make it a factory pattern. Less of a mess
Leonid612dBad idea) you wouldn't be able to reuse your code in future and it's look messy, just get best from OOP and SOLID it will help you in future projects
devapsarl28112dI may have not expressed my self properly.
Lets say you create a class ServerRequest, that encapsulate the android AsyncHttpRequest from loopj.
In the constructure u create the client et configure it.
In the private fields u have the host url and all api endpoint as statis constants.
And some public methods for post and get request.
And an empty public overridable method called "processresponse".
So far this is the normal oop i use.
But my idea in " thematic helpers" is that, since that class manage connection between my app and the backend why cant i make it manage more of the things related to that app-backend connexion ? ?
Like for example adding a static method that takes Context in arg and check internet connectivity and redirect user to android setting page ?
This helper may be used outside of the only purpose of the class itself,
Dunno if i am bit more clearer
Leonid611d@devapsarl Having all stuff in single class may break single responsibility principle, but since it's an Android app I'm not think it's so critical when you don't have large enterprise solution with bunch of devs and testers who will work and test your code. Otherwise, it is better to build right practice as habit, it will help in future