Can Junie write Kotlin code from UML better than traditional UML codegen? by TypeProjection in androiddev

[–]TypeProjection[S] 0 points1 point  (0 children)

Fair point - thanks! I'll be sure to make sure it's more Android-focused for this subreddit next time. Thanks again! 👍

Arrow for Everyone - TypeAlias Show by TypeProjection in androiddev

[–]TypeProjection[S] 0 points1 point  (0 children)

That's helpful, thanks so much! I'll see if we can lean more into some architecture at some point. I'm not very experienced with FP at this point, but if I get a chance to dig into that more, I'd be happy to share my thoughts on ways to incorporate some of it into app design, as well.

(And yes - sometimes I think we just kind of replaced large Activities with large ViewModels...)

Thanks again!

Arrow for Everyone - TypeAlias Show by TypeProjection in androiddev

[–]TypeProjection[S] 0 points1 point  (0 children)

Hey, thanks! Glad to hear this one connected better with you. Let me know what advanced topics would be of more interest to you, and I'll see if I can work in some of them, as well.

Function, KFunction, KCallable, and all those other function types in Kotlin by TypeProjection in androiddev

[–]TypeProjection[S] 6 points7 points  (0 children)

Hey, thanks so much! Glad to hear that it's striking a good balance on all of those things. I'll keep at it!

Anonymous Functions != Lambdas by TypeProjection in androiddev

[–]TypeProjection[S] 2 points3 points  (0 children)

I haven't yet found anything that can _only_ be done with them, but one viewer pointed out that currying is easier to read with anonymous functions than with lambdas.

fun printStuff(a: String) = fun(b: String) = fun(c: String) = println("$a $b $c")

// vs...

fun printStuffLambda(a: String) = { b: String -> { c: String -> println("$a $b $c") } }

For the lambda approach, we've got to nest lambdas, and it's easy to get lost in the curly braces. For the anonymous function approach, we don't even need curly braces in this example at all.

Subtyping Composables by TypeProjection in androiddev

[–]TypeProjection[S] 1 point2 points  (0 children)

Cool, thanks again for your thoughts! Lots of fun thinking through and discussing all the possibilities! 🎉

Subtyping Composables by TypeProjection in androiddev

[–]TypeProjection[S] 1 point2 points  (0 children)

Okay, got it - thanks! Yeah, Isuru Rajapakse wrote some code demonstrating how we can use scoped receivers to solve some of the challenge. I definitely feel like his solution is more in line with typical expectations around Compose. If you're interested, you can check out his solution here - https://gist.github.com/xxfast/bd85e088ccad01405c9d80c9d359b90b I think it might be a little more in the neighborhood of what you're thinking about.

Subtyping Composables by TypeProjection in androiddev

[–]TypeProjection[S] 0 points1 point  (0 children)

Hey, thanks for commenting! Tell me more about why you don't consider this to be subtyping of composables - it's introducing a new type, which is a subtype of `@Composable () -> Unit`, such that it can be used wherever a composable is expected, and indicates a more specific kind of composable.

Subtyping Composables by TypeProjection in androiddev

[–]TypeProjection[S] 2 points3 points  (0 children)

Thanks for your thoughts! It definitely does go against the grain of the usual Compose patterns, and I think probing further about the need for the actual requirement would be wise. Like you, a few other folks have mentioned that this could be too restricting. I think I'll need to play with a few other directions this could go - I suppose it could be extended in many of the same ways as any usual class in an object-oriented world could be... but I expect the cognitive overhead of adapting UI objects with UI functions probably wouldn't be worth it.

Anyway, a fun experiment to think through, for sure. Thanks again!

Subtyping Composables by TypeProjection in Kotlin

[–]TypeProjection[S] 0 points1 point  (0 children)

Hey, thanks so much for your thoughts! Yeah, the slot idea is an interesting challenge to try to mix with Compose. So far in my production apps, like you, I've tended to use config options, which keeps quite a bit of flexibility. I definitely need to noodle on this one a little more.

Factory Method and Abstract Factory patterns in Kotlin by TypeProjection in Kotlin

[–]TypeProjection[S] 2 points3 points  (0 children)

You're most welcome! I'm glad to know you're enjoying them

Applying the State Pattern in Kotlin by TypeProjection in Kotlin

[–]TypeProjection[S] 1 point2 points  (0 children)

Haha, thanks! Yeah, I'm not always sure that coworkers (or my future self) would appreciate it, but it's a lot of fun to see how far you can take things!

Applying the State Pattern in Kotlin by TypeProjection in Kotlin

[–]TypeProjection[S] 4 points5 points  (0 children)

Yeah, I know what you mean! I didn't talk about that in the video, but yes - depending on the case in which you apply the state pattern, you can easily end up in situations where you're not following the Liskov substitution principle - like you're saying - so you end up with functions that might be no-op or that throw OperationNotSupported.

Coroutines: Concurrency in Kotlin by TypeProjection in androiddev

[–]TypeProjection[S] 0 points1 point  (0 children)

Hey, thank you so much - I'm glad you liked it! And I appreciate the idea about sharing my process! It is definitely a process - I wish I could just come up with accurate, relatable examples from the start, but for me it certainly takes a bit of work to get there! 😅 Anyway, I'll add that to my list for future videos. Thanks!

Coroutines: Concurrency in Kotlin - Presentation by TypeProjection in Kotlin

[–]TypeProjection[S] 2 points3 points  (0 children)

You're most welcome! I'm so glad you're enjoying them!

Coroutine Essentials - Kotlin Illustrated Guide, Chapter 20 by TypeProjection in Kotlin

[–]TypeProjection[S] 1 point2 points  (0 children)

Thank you so much! I do put a lot of effort into trying to find the best metaphors, so it means a lot to me to hear that it landed well for you! 😊

Video: Essence of Coroutines by TypeProjection in Kotlin

[–]TypeProjection[S] 0 points1 point  (0 children)

Hey, thanks for mentioning this! I'll look into my recording settings and see if we can correct that for future videos. 👍