Office Hours — Today, April 20

Yesterday, April 19

Apr 20
3:50 PM
Mark M.
has entered the room
3:55 PM
Mark M.
turned on guest access
4:15 PM
Lucy
has entered the room
Lucy
Hi Mark!
Mark M.
hello, Lucy!
how can I help you today?
Lucy
I have an app and this app has two personas: people who post (authenticated access) and people who read only (anonymous access). I don't see how to make certain Activities available only for authenticated users. I wonder if it should be split into two apps? Doing so would make the read-only version much smaller in size if I did so.
Mark M.
OK, let's back up a step
by "authenticated users", what do you mean?
authenticated by what, and where?
I'm trying to determine if this is several people using one device with one app installation, or several people each using their own device, each with their own app installation
Lucy
For authenticated users, I mean that these users will log in and the content they contribute will be editable only by them.
Oh.
Mark M.
IOW, is a single app installation serving both personas?
Lucy
It is a single user who will log in on one device and add content.
4:20 PM
Lucy
Oh. No, a single app installation will not serve both personas.
Mark M.
if the two personas have mutually exclusive user bases (you either are contributing content or reading content, and probably not both), having separate apps would be reasonable
Lucy
For users posting content I want to know who they are.
Oh cool. Is it a typical way to design an app?
Mark M.
um, well, usually, the personas change on the fly
social network clients, for example, don't usually have two apps, as they want to encourage posting
Lucy
I think about an app where people post and read reviews of something (my app is not that but its a good example). You can read without logging in. But to post you have to have an account and log in.
Mark M.
in general, to make certain activities only available to authenticated users, only offer navigation options to *get* to those activities to authenticated users
so, remove items from the nav drawer, or hide items in the action bar, or whatever
Lucy
Yes, your social network example is a good one.
I see...
I'm thinking about that for a moment.
Mark M.
if an activity existed in a forest, and nobody could cause a startActivity() call to launch that activity, does the activity really exist? :-)
Lucy
Great question!
The thing that comes to mind is...I once saw a security demo. And in that demo they started the Activity from the device in debug mode (as I recall).
Mark M.
that's a slightly different matter
Lucy
Yeah let's put that security demo aside.
4:25 PM
Mark M.
by controlling the navigation paths, you're aiming to prevent a poor user experience, of people tapping on things and being told "no"
separately, your protected activities will want to double-check the authentication status before proceeding, redirecting the user to a login activity if needed
Lucy
I see. Yes, this is what I want. However, splitting the app into two will make the read-only app much, much smaller.
Ah. I see.
The number of users who are read-only will be much great than the number posting. This supports making the read-only app being small everywhere.
Mark M.
if this authentication is done on a server, you may have reason to block the user or something, independent of anything else
Lucy
So far I'm using Parse and their authentication. Maybe Twitter too.
Mark M.
there are two downsides to the separate-app approach that I can think of off the top of my head
Lucy
OK
Mark M.
1. it will make development a bit more clunky, as you are either using a library module or product flavors to minimize code duplication between the apps
Lucy
I'm all ears.
Mark M.
2. it adds a barrier to adoption for read-only users to switch to becoming read-write users, as they have to download and install a separate app
now, depending on your situation, that barrier to adoption may not be a big deal
for example, if you also have to pay money to be a read-write user, that will be a bigger barrier, swamping the have-to-install-another-app effect
Lucy
Yes, I see.
Another good point.
Mark M.
in many ways, the separate-apps approach is as much as strategic decision as a technical one
because it ties into marketing and everything else for your ecosystem of users
4:30 PM
Lucy
OK. And there are apps that take this approach, to split into two different apps?
4:30 PM
Mark M.
that doesn't make the separate-apps approach wrong
probably
I can't name any off the top of my head
Lucy
I'll download some of the popular apps for reading and posting reviews of things.
Mark M.
but, for example, I could see Automattic perhaps going with separate apps for blog readers versus blog authors
Lucy
I'll also compare the size of the apps.
Yes, that's a good example of what I'm doing. I may also include the reader-only portion of the app in the one that writes.
Mark M.
sure, you could consider those to be "base" versus "pro" editions or something
Lucy
Probably my two main concerns are: 1. Size of app may be bigger if both are included. 2. Being sure read-only users cannot reach the portions of that app that can write content.
Good point!
At the backend, the MongoDB will protect someone from overwriting someone else's content.
But I don't want anyone to get that far.
Size of app may determine how I go.
At least its not unheard of to split into two. I think if you are a person who can use my posting content then downloading an app to do so won't be a barrier (I claim).
4:35 PM
Lucy
This was a very helpful discussion for me, thank you!
Mark M.
you are very welcome
Lucy
Here is another question relating to Adapters...
If I have several lists that could share the same Adapter (single row content is the same) but when you click on a list item each list needs to do something different...is there a way to share the Adapter class and check inside getView() to say "If ListA do X, if ListB do Y"
My guess is "No" since getView() would have too much work to do for every click of a list.
Mark M.
well, you get passed the ListView in getView() as the third parameter
personally, I'd use inheritance, with a base adapter class handling the common work and subclasses handling the per-list event handling
Lucy
Oh cool. Yes, that's what I should do. I'm simply trying to make the app smaller.
Mark M.
or, possibly, composition with some listener being delegated the per-list work
4:40 PM
Mark M.
while Java code certainly contributes to size, these sorts of changes will not impact the APK size all that much
Lucy
Yeah, the APK size is what I'm aiming to decrease.
I haven't measured it but it seemed I should be trying to share code. Right now I have 4 or 5 adapters that are very alike.
Mark M.
and I'm not saying that cleaning that up is bad
just it's not going to change the APK size much
it may help you with code maintenance
Lucy
Yeah, I'll definitely try more cleanup.
I'm still using ArrayAdapters and haven't converted to Recycler views.
Mark M.
I suspect that you are far from alone on that front
Lucy
I'll take comfort in that. :-)
OK those were my questions for today. Thank you again!
Mark M.
you are very welcome again!
Lucy
has left the room
5:00 PM
Mark M.
turned off guest access

Yesterday, April 19

 

Office Hours

People in this transcript

  • Lucy
  • Mark Murphy