code is emotional
Junilu Lacar wrote:Well, one thing I can say is that this code is very opaque, i.e. difficult to understand. Even after looking up OkHttpClient and Retrofit, the intent of the code is still unclear to me.
One thing that keeps giving off a smell is your passing around of an OkHttpClient.Builder instead of just a fully built OkHttpClient. Why do that? Seems to me there's no need for it.
Another smell is the package private fields bodyBezinning and view. Why give these package private (default) access, why not private? And fact that you're setting the value of bodyBezinning in an anonymous inner Callback<Bezinnings> class (line 32) is even more smelly to me.
The way you declare those fields and the way they are set and used just makes we wonder what kind of concurrency issues you might run into with this.
code is emotional
Giovanni Montano wrote:
1) OkHttpClient.Builder
This is they way Retrofit is made, is complex library made on top of OKHttp. I am not sure there is another way
A quick look at the Android API documentation for onCreateView says this method is optional. It also states, however, "If you return a View from here, you will later be called in onDestroyView() when the view is being released." So, my first question is: Why are you not implementing onDestroyView()? What are the consequences of not doing so? Mind you, I ask this because I'm not very familiar with Android development (although my goal for the next few months is to change that).
The comment "TODO apply butterknife"
code is emotional
Prefer to use names that reveal intent, not implementation.
code is emotional
code is emotional
code is emotional
Junilu Lacar wrote:Glad the refactoring actually turned out to be truly a refactoring. Just remember, refactoring changes the design of your code without changing its functionality. The intent is to make the design better in terms of simplicity, clarity, testability, and a whole other qual-"ities". Excluded from refactoring is making it more performant. Many people mistakenly think that "efficiency and performance" is a goal of refactoring. It's not.
new Callback<Bezinnings>(){ all the callbacks here, please notice I am not using lambda, functional paradigm just to understand}
code is emotional
Don't get me started about those stupid light bulbs. |