Sep 1 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Sep 1 | 7:35 PM |
Shobhit P. | has entered the room |
Mark M. |
hello, Shobhit!
|
Shobhit P. | |
Mark M. |
how can I help you today?
|
Shobhit P. |
Thanks for holing the session. I have a question regarding implementing MVP architecture for my android application.
|
Sep 1 | 7:40 PM |
Mark M. |
I have very little experience with the Model-View-Presenter pattern
|
Mark M. |
that being said, I can try to answer your questions
|
Shobhit P. |
View paste
|
Mark M. |
using an event bus should be fine between your REST access layer and your UI layer
|
Mark M. |
I cannot comment on the relevance for presenters, as I have not attempted to use them on Android, other than cases where some library tries to use that pattern (such as leanback-v17)
|
Shobhit P. |
okay cool. Thanks. This was just one of the things I was considering. According to you what's the best way of architecting a huge application? Is there a section in your book or any other book or an article that you would recommend for learning that?
|
Mark M. |
by definition, a "huge application" could have any number of possible architectures
|
Sep 1 | 7:45 PM |
Mark M. |
a huge game would be written differently than a huge video player...
|
Mark M. |
...which would be written differently than a huge accounting system client...
|
Mark M. |
...which would be written differently than a huge scientific analysis app
|
Mark M. |
and so on
|
Shobhit P. |
I will try to be a bit specific in asking the question.
|
Mark M. |
in general, the bigger it is, the less likely I am to be involved with it, and therefore I don't talk about it much
|
Shobhit P. |
Lets say for example it is an app which has listing of houses and its details and people bid on them live. It would have multiple list views, detail views bidding systems, notification, multimedias etc.
|
Shobhit P. |
"Huge" is a relative term so my use might not have been correct. Apologies
|
Sep 1 | 7:50 PM |
Mark M. |
my point wasn't so much the size as that different types of apps are, well, different
|
Sep 1 | 7:50 PM |
Mark M. |
I do not claim to be an architecture guy
|
Mark M. |
but there's little doubt in my mind that games, video players, accounting system clients, and scientific analysis apps will have different architectures, at least to some degree
|
Mark M. |
if you are going to ask "how do I architect this app", for the description that you typed in, I cannot really answer that
|
Shobhit P. |
View paste
|
Mark M. |
well, there's no question that an event bus will be slower than, say, a direct method call
|
Mark M. |
however, that's not usually going to be a problem, as you are hopefully not firing off events very quickly
|
Mark M. |
if you start doing hundreds of events per second, start worrying about it
|
Sep 1 | 7:55 PM |
Mark M. |
but the more typical pace for those sort of layer interactions tends to be measured in seconds-per-event, not events-per-second
|
Mark M. |
in which case, the fact that the event bus adds some number of microseconds isn't going to be a big deal
|
Shobhit P. |
Awesome. Thanks for the detailed explanation. It helps.
|
Sep 1 | 8:00 PM |
Shobhit P. |
I have one more question regarding lint checks. To keep code consistent, is it possible to add lint checks to check for example if the variable names are not starting with lower case letters or the bracket in front of "if conditions" is not in the new line etc. Do you know if that level of granularity can be achieved using lint checks?
|
Mark M. |
I do not know, sorry
|
Mark M. |
however, you also have options within your IDE (e.g., Android Studio/IntelliJ inspections)
|
Mark M. |
or outside (e.g., Checkstyle)
|
Mark M. |
I would assume that there is a recipe for checking coding standards like that, but I suspect that it will not involve the Android-specific Lint stuff
|
Mark M. |
but rather it will be more general Java
|
Sep 1 | 8:05 PM |
Shobhit P. |
oh okay. So maybe I am looking at the wrong place. I'll look into Inspections. Thanks
|
Sep 1 | 8:10 PM |
Shobhit P. |
I was looking to use view Injection libraries like ButterKnife just to reduce the boilerplate code. I read at couple of places that view/dependency injection libraries may make the app slower? Is it true? I read a similar question on stackoverflow (http://stackoverflow.com/questions/28123652/do-...) but with no answers.
|
Mark M. |
compile-time ones should not
|
Mark M. |
and I think ButterKnife is done at compile time
|
Mark M. |
that being said, I haven't played with ButterKnift
|
Mark M. |
er, ButterKnife
|
Mark M. |
also, it's similar to the event bus case, where the performance issue is really only a problem if you are doing a lot of it
|
Mark M. |
so, for example, ListView/RecyclerView adapters would be a bit more sensitive to performance issues
|
Mark M. |
but a compile-time annotation processor should result in code that is roughly as efficient as if you hand-rolled it, which is why I would be surprised if ButterKnife added much in the way of runtime overhead
|
Sep 1 | 8:20 PM |
Shobhit P. |
It makes sense. Thanks again for the wonderful insight. Can I ask something about the Automation testing?
|
Shobhit P. |
*for Android app
|
Mark M. |
go ahead
|
Shobhit P. |
I was trying out MonkeyRunner by Google. However it seems that it works based on the pixel positions. But my concern is that if anything in UI changes, one would have to re-write the test cases, which would be a pain. Also for different devices with different screen sizes, not sure how that would work. Do you recommend any better tool using which I can use the element ID instead?
|
Mark M. |
hold on
|
Mark M. |
sorry, a phone call had come in
|
Sep 1 | 8:25 PM |
Mark M. |
UI Automation is probably more in line with what you're looking for
|
Shobhit P. |
No problem Mark
|
Mark M. |
or, Espresso for instrumentation testing
|
Mark M. |
it's mostly a question of whether you are trying to test interactions between apps or not
|
Shobhit P. |
No its just for testing within the app.
|
Mark M. |
UI Automation is great for integration testing between apps, as you can automate any app, not just yours
|
Shobhit P. |
oh okay.
|
Mark M. |
then I'd be using instrumentation testing, whether directly with JUnit4 stuff or with Espresso layered atop it
|
Mark M. |
(and, yes, I need to get the Espresso chapter in the book... :-)
|
Mark M. |
all of that is part of the Testing Support Library nowadays: http://developer.android.com/tools/testing-supp...
|
Shobhit P. |
Nice! I'll be looking forward to that. That's was a really helpful session Mark. I just want to say that i sincerely admire your work. It was couple of years back when my professor at UoFT introduced me to your book which got me interested into Android and I haven't looked back since then. Thanks for giving the Bible for Android Development.
|
Mark M. |
I am happy to be useful!
|
Sep 1 | 8:30 PM |
Mark M. |
and that's a wrap for today's chat
|
Mark M. |
the transcript will be posted to https://commonsware.com/office-hours/ shortly
|
Mark M. |
the next chat is Tuesday at 9am US Eastern
|
Mark M. |
have a pleasant day!
|
Shobhit P. |
You too Mark.
|
Shobhit P. | has left the room |
Mark M. | turned off guest access |