Mark M. | has entered the room |
Jul 23 | 8:25 AM |
Mark M. | turned on guest access |
Kai H. | has entered the room |
Mark M. |
hello, Kai!
|
Mark M. |
how can I help you today?
|
Kai H. |
Hi Mark.
|
Kai H. |
I have no proper question atm, but wanted to "be here" for another office hour.
|
Mark M. |
um, OK
|
Mark M. |
if you come up with a question, let me know!
|
Kai H. |
Sure :)
|
Jul 23 | 8:30 AM |
Mark M. |
BTW, I think I just sent you an email
|
Paul | has entered the room |
Mark M. |
hello, Paul!
|
Paul |
Good morning.
|
Mark M. |
Paul: right now, Kai is just lurking, so... how can I help you today?
|
Paul |
So I want to use the debugger to walk though Compose code to get a feel for how it works. Good idea, bad idea?
|
Paul |
Anything to be aware of?
|
Mark M. |
beats me -- I have never tried that directly
|
Paul |
How are you learning Compose?
|
Jul 23 | 8:35 AM |
Mark M. |
slowly
|
Paul |
:-)
|
Mark M. |
but, generally, not using a debugger
|
Mark M. |
so far, I have settled for some amount of logging
|
Paul |
I've been consuming articles and videos -- your talk included.
|
Mark M. |
the only breakpoints I have set in a Compose project have been outside of the Compose code itself
|
Mark M. |
such as inside my periodic attempts to invoke composables via reflection
|
Paul |
Do you have a good feel for what the Compose compiler is all about?
|
Mark M. |
technically, it's a compiler plugin -- not a full replacement for the Kotlin compiler
|
Paul |
Do you "get" the compiler plugins for Kotlin?
|
Paul |
Have you written one? Used one?
|
Mark M. |
written one? no -- used one? only with Compose AFAIK
|
Mark M. |
talked with people about the Compose one? yes
|
Mark M. |
while we normally associate @ThingsWithLeadingAtSigns as annotations for annotation processors, compiler plugins can work with them as well
|
Mark M. |
so the Compose plugin basically rewrites all of our calls to @Composable-annotated functions
|
Mark M. |
adding in a bunch of extra parameters to help Compose keep track of what's going on
|
Mark M. |
it used to rewrite the functions themselves, but they switched to call-site modification a couple of months ago
|
Paul |
I would guess that the plugin generated more byte code. This correct?
|
Jul 23 | 8:40 AM |
Mark M. |
yes, my guess is that if you looked at DEX bytecode, these composable calls will have a few more lines to them
|
Paul |
call-site modification ... can you elaborate?
|
Mark M. |
(though I'm far from a DEXpert)
|
Mark M. |
suppose we have @Composable fun Foo() { TODO() }
|
Mark M. |
and we have @Composable fun Bar() { Foo(); TODO() }
|
Mark M. |
so, Bar() is calling Foo()
|
Mark M. |
the Compose compiler plugin is changing that Foo(); call
|
Mark M. |
and, in truth, also changing the Foo() function signature
|
Mark M. |
a bunch of additional parameters get added
|
Mark M. | |
Leora | has entered the room |
Mark M. |
(BTW, hello Leora -- I will be with you shortly!)
|
Leora |
Hi everyone!
|
Paul |
Is the rewritten code available in Kotlin form?
|
Kai H. |
Hi Leora
|
Mark M. |
not that I am aware of
|
Paul |
Debugging this code must be awful!
|
Mark M. |
AFAIK, the compiler plugin is generating this as part of the actual compilation process
|
Mark M. |
yeah, I can't imagine that it's much fun
|
Mark M. |
now, how much this compiler plugin affects the debugger, I can't say
|
Mark M. |
simply because I haven't experimented with that yet
|
Paul |
Is it easy to read?
|
Mark M. |
is what easy to read?
|
Mark M. |
my books? I like to think so... :-)
|
Paul |
Can you read Compose code and understand what it is actually doing?
|
Paul |
Your books are wonderful! Can't wait for the Compose series. :-)
|
Mark M. |
if you mean @Composable functions, as we write them, they aren't bad... but my guess is that you are referring to something else
|
Jul 23 | 8:45 AM |
Mark M. |
if you mean decompiled @Composable functions, I have not tried that
|
Paul |
I can generally read code and have a very good idea what the computer is doing because of that code. I'm not sure this will be true with Compose code.
|
Mark M. |
in the theater and films and stuff, they talk about "willing suspension of disbelief"
|
Mark M. |
you need an element of that with Compose as well
|
Mark M. |
there will be a bunch of places where we hand-wave around "Compose compiler plugin magic"
|
Mark M. |
such as: why do state() and mutableStateOf() actually work?
|
Mark M. |
in explanations, we can go through many layers of the Compose onion, and then get to "and here is where the Compose compiler plugin performs some magic"
|
Paul |
I do not like the sound of that. I already hate that they butcher conventions like function call names are verbs that start with lower case.
|
Mark M. |
TheyAreAllGoodFunctionNamesPaul() :-)
|
Mark M. |
but, while I hope to write about one more onion layer than most people will -- in the context of reflection and interop concerns -- eventually I too will wave my hands and say "here is where the compiler plugin takes over"
|
Paul |
Uncle Bob is having massive coronaries just thinking about Compose violations of Clean Code principles.
|
Mark M. |
let me take a question from Leora, and I will return to you shortly
|
Mark M. |
Leora: hi! how can I help you today?
|
Paul |
I have a hankering to get grounded in the compiler plugin technology. Got a decent reference?
|
Jul 23 | 8:50 AM |
Paul |
ok
|
Mark M. |
(Paul: I assume there's documentation for Kotlin compiler plugins somewhere, but I haven't gone looking for it)
|
Mark M. |
Leora: do you have a question?
|
Leora |
yes sorry I was distracted
|
Leora |
How do I go about choosing a CDN?
|
Mark M. |
I have never used one, so I cannot really answer that
|
Leora |
I don't have much data
|
Mark M. |
and, to be more clear: I have never signed a deal with a CDN and placed content in one
|
Jul 23 | 8:55 AM |
Mark M. |
so, other than "if you use Cloudflare, you'll go down when half the Internet does", I don't really have much advice :-)
|
Leora |
ok :)
|
Leora |
although I don't get the joke ;)
|
Mark M. |
Cloudflare had an outage on Friday
|
Leora |
ahhhh
|
Mark M. |
that briefly took down vast quantities of the Internet
|
Mark M. |
anyway, I suppose my actual best advice is: know why you are engaging with a CDN
|
Mark M. |
CDN as a DDoS mitigation service might be different than a CDN as a high-traffic site solution
|
Mark M. |
but, on the whole, this is far from my area of expertise
|
Mark M. |
I like small things, which usually do not need a CDN as a result
|
Leora |
Umm, just so users can download language packs (each zip of mp3's is about 3MB)
|
Leora |
and avoid being tied to google
|
Leora |
since I want to release in China as well
|
Mark M. |
whether a CDN operates in China would be another concern that you would need to check out
|
Leora |
yes
|
Mark M. |
ignoring the China part, the rest does not sound like you need a CDN, unless you expect a zillion users
|
Jul 23 | 9:00 AM |
Leora |
than how would i manage the downloads? from where?
|
Mark M. |
for example, I use Amazon S3 for book distribution, but that's mostly because they had a canned solution for short-lived signed URLs
|
Mark M. |
if it weren't for that, I would just have them on my Web site
|
Leora |
there are 23 languages in the app
|
Leora |
Hmmm
|
Mark M. |
23 ~3MB files is not that big
|
Leora |
not it's not
|
Mark M. |
now, if you expect those to be downloaded a million times per day, that's a different matter
|
Leora |
no, they definitely won't be
|
Mark M. |
so, from a bandwidth standpoint, this does not feel like a problem that needs a CDN as a solution
|
Mark M. |
China or other considerations might steer you towards a CDN
|
Leora |
so, the alternaives would be...? Amazon S3, website..
|
Mark M. |
yes, or S3-like services (Rackspace has theirs, for example)
|
Mark M. |
basically, just hosted files
|
Leora |
and the question also is why not a CDN? it's not expensive. is there another consideration?
|
Mark M. |
partly, it's a question of "points of failure"
|
Mark M. |
for example, with my books, subscribers like you get locked out if either my Web site is down or Amazon S3 is down
|
Mark M. |
whereas if I had the books just on my site, you would not care if Amazon is having a bad day
|
Jul 23 | 9:05 AM |
Mark M. |
in your case, if your app is not talking to some server of yours already, then you only have this one point of failure, and a CDN might have better uptime guarantees than other solutions
|
Mark M. |
but, if your app is already dependent on some server of yours, adding a CDN or other file host adds another point of failure
|
Leora |
no server
|
Leora |
better uptime = time uploading the files?
|
Leora |
cause they will be uploaded once or twice a year
|
Mark M. |
no, better uptime = least likelihood that a client will fail to download due to some hosting problem
|
Leora |
ah
|
Kai H. |
Uptime = the time a server/host is up
|
Leora |
ah :)
|
Mark M. |
so, you're looking for uptime assurances in service-level agreements, plus assurances that your files will be reachable by all your clients (e.g., the China concern)
|
Leora |
yes
|
Mark M. |
and for that, a CDN may be better than S3, which may be better than running your own Web site
|
Mark M. |
let me take questions from the others, and I'll try to get back to you before the end of the chat
|
Mark M. |
Kai: do you have a question?
|
Leora |
ok thanks, i'll continue research on the CDN
|
Kai H. |
Yes
|
Kai H. |
I started being a full time Android dev pretty much a year ago (on 01.08.).
|
Jul 23 | 9:10 AM |
Kai H. |
And I don't feel like a... real Android developer. I have touched some topics, some deeper than others, but still feel lacking.
|
Kai H. |
My question is pretty much this: What, in your opinion, are the most important skills I should have to call myself a "real" Android developer? :)
|
Mark M. |
um, you probably already are a real Android developer
|
Mark M. |
bear in mind that Android is vast, and so expecting to know everything about Android is unrealistic
|
Mark M. |
for example, I don't know everything about Android, and I have been working in this space for a while
|
Kai H. |
Thing is that I don't think I could even write a simple Android app, as I lack quite a bit of the fundamentals.
|
Mark M. |
but, if you can assemble a UI and have it load and store data (locally, server, or both), that would qualify as a "real" Android developer IMHO
|
Mark M. |
ah
|
Kai H. |
Hokay :D
|
Mark M. |
basically, if you can do the sorts of things that *Exploring Android* guides you through, you should feel like you are a real Android developer
|
Kai H. |
(Which is part of the reason why I am still planning to go through one of your books. Haven't implemented it yet though...)
|
Kai H. |
That sounds like a good target.
|
Jul 23 | 9:15 AM |
Mark M. |
beyond that, you would need to determine what specifically concerns you about your skill level or areas of expertise
|
Mark M. |
I may be able to provide advice about filling those gaps, but I cannot tell you where your gaps lie
|
Kai H. |
I guess beyond that it goes more into soft skills or overarching skills, like being able to learn something new, being able to implement a feature in a certain amount of time etc.
|
Mark M. |
those concerns are eternal, to a degree
|
Mark M. |
with experience, you will be able to better guess how those things may play out
|
Kai H. |
I guess I'll have to live with the fact that no one can know everything and even the best are either quite specialized or learn very fast.
|
Mark M. |
this is delving into psychology, and I'm far better at providing advice on CDNs than on psychology
|
Mark M. |
(and I'm not expert at either of those things)
|
Kai H. |
I guess that concludes my question for now.
|
Mark M. |
sorry that I didn't have a simple solution for you
|
Mark M. |
Paul: back to you! do you have another question?
|
Jul 23 | 9:20 AM |
Paul |
I have another topic: the sorry state of on-device Android code coverage support from the tools team.
|
Paul |
Why is this?
|
Mark M. |
well, unless Google is going to write its own coverage solution, they are somewhat dependent on what other outside-of-Google teams are doing
|
Paul |
And what do you do for code coverage (on-device only as off device is fairly well supported)
|
Paul |
JetBrains is doing some stuff but not for on-device.
|
Mark M. |
for my current client, I am using Jacoco for both instrumented and unit tests, and living with the fact that some Kotlin stuff gets missed
|
Paul |
Jacoco is a sorry mess for Kotlin. It cannot keep up with Kotlin version changes. lateinit is now broken, much to my chagrin.
|
Mark M. |
yes, ideally, we would have better options here
|
Mark M. |
there are lots and lots and lots of things that I would use that phrase for, though
|
Paul |
at least when used with Compose. It seemed to work last time I used it, about a year ago.
|
Mark M. |
I have never tried running code coverage with Compose, but I would expect that the compiler plugin modifications would increase the likelihood of problems
|
Paul |
If you were going to write your own solution to solve the problem for the Android world of on-device testing (you love pain) where would you start?
|
Mark M. |
I would try to get a better handle on how current solutions like Jacoco do what they do
|
Mark M. |
as frankly that's a black box to me
|
Jul 23 | 9:25 AM |
Paul |
Actually, you really want to solve the problem for KMP.
|
Mark M. |
that then would force me to start with more fundamental concerns, like "how do we write tests with KMP?", as I have not fairly little with it
|
Mark M. |
sorry, that should have been: "I have done fairly little with it"
|
Mark M. |
it's on my roadmap, probably for 2021, assuming space aliens haven't invaded by then
|
Paul |
I just read a paper on source-source transformation. That is where I'm going to start. I've done both JVM and native testing. JVM is good, native is poor but getting better.
|
Mark M. |
are you a member of Kotlinlang Slack?
|
Paul |
btw, the IntelliJ code coverage is pretty decent for Kotlin.
|
Paul |
Absolutely, along with about a hundred or so others. :-)
|
Mark M. |
your questions seem like likely candidates for channels there, such as #multiplatform
|
Paul |
Slack workspaces that is.
|
Mark M. |
(and #compose for Compose internals stuff)
|
Paul |
I created the #code-coverage channel there and have asked many questions about the topic. I am blazing a trail here for sure. I've even interacted with Andry Breslov on the topic. Apparently with little success. :-)
|
Jul 23 | 9:30 AM |
Mark M. |
yeah, you're probably way beyond my level of expertise in the subject at this point
|
Paul |
You still have much to teach me. I'm counting on it.
|
Mark M. |
I'll try to help!
|
Paul |
Collaborating is always preferable over solo endeavors.
|
Mark M. |
but, that's a wrap for today's chat
|
Mark M. |
the next office hours are Saturday in the 4pm US Eastern time slot
|
Paul |
Good enough. Thanks
|
Mark M. |
have a pleasant day!
|
Paul | has left the room |
Kai H. | has left the room |
Leora | has left the room |
Mark M. | turned off guest access |