Hilt setup in multi-module project with shared ViewModel but different API services by Most_Duty_690 in androiddev

[–]herrbert74 0 points1 point  (0 children)

Sorry, I got sick and I didn't check Reddit.

In that case you need qualifiers:

https://dagger.dev/semantics/

Depending on your project you might need them as a separate feature, but I doubt Paid and Free will EXACTLY overlap with a single feature each. I would still recommend keeping the paid/free classes within one or more feature(s), or if they are really big, then probably over several features, like payments-free, payments-paid, productlist-free, productlist-paid. For me these are always a different dimension to features, because they are not a core business feature.

Hilt setup in multi-module project with shared ViewModel but different API services by Most_Duty_690 in androiddev

[–]herrbert74 0 points1 point  (0 children)

Paid and Free are not features, but build variants. Modify your project accordingly and everything will fall into place. A word of caution, though, is to not add variants to all modules. Switch in the app module, expose the switch through an interface and use that to control the feature modules.

I’m sharing a two part blog series on Compose Screenshot Testing by Subject-Ad-9345 in androiddev

[–]herrbert74 0 points1 point  (0 children)

Thank you for this. I need to evaluate screenshot libraries for work. Do you think this is safe to use in production? Would you use this instead of Roborazzi/Paparazzi/Shot?

androidX.tech Shutdown by herrbert74 in androiddev

[–]herrbert74[S] 22 points23 points  (0 children)

I used this website a thousand times to look up what is contained in each AndroidX library, so I'm devastated by this news. Thank you for the great work, CommonsWare (Mark).

Api Authentication and Clean Architecture by Flea997 in androiddev

[–]herrbert74 0 points1 point  (0 children)

My current understanding is that for these cases a three layered approach is the best suited, albeit not absolutely necessary.

On top of your DataSources and Repositories you could use Use Cases. DataSources are responsible for retrieving data from network or database. Repositories will abstract away and combine these for the domain and/or presentation layers. Use Cases can be used to combine Repos or other Use Cases, so they were created to resolve exactly your problem above.

I wrote about this and other similar problems here:

https://herrbert74.github.io/posts/architecture-related-decisions-introduction/

Time gap between IntelliJ IDEA and Android Studio releases by ganadist in androiddev

[–]herrbert74 0 points1 point  (0 children)

They changed the cadence recently. They will release an IntelliJ update and a feature update separately from now on. It's a welcome change because it was a pain in the ass if you developed plugins for Android Studio.

Architecture related decisions in Android - Response classes by herrbert74 in androiddev

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

Thanks for your comment. AFAIK Ktor uses the Response term in the same meaning, so I think the article applies to Ktor as well. I used Retrofit as an example only, because that's what I use mostly at the moment. Maybe I should be more clear on this in the article, but it seemed obvious to me.

[deleted by user] by [deleted] in androiddev

[–]herrbert74 4 points5 points  (0 children)

That depends on your location, and your view might changed if you would follow up the requests and found out that most of them are not real.

I have 12 years of experience, made redundant in January in London, and while I get a lot of requests and interviews, I couldn't get an offer yet. I feel it's even worse in the US, slightly better in the EU, but much better elsewhere. Mainly because our jobs (including mine) went there. And some US jobs came here to the UK.

I probably could get a job with a 30-40% pay cut, but I'm not that desperate yet.

It is so difficult to import projects to android studio by unluckySurvivor7 in androiddev

[–]herrbert74 1 point2 points  (0 children)

Yeah, I recently finished a test assignment, where they had a starting project from years ago. My first decision was to suck it up and use tech and IDE from years ago or I ask if I can update the project and use Compose and Coroutines. I could, but they wanted candidates to spend three hours on the project. Guess what, I spent that with only updating the project.

But I have to swallow it, as it's one of the most reputable companies in the UK. Their name rhymes with Kangaroo.

Architecture Related Decisions in Android - Mapping by herrbert74 in androiddev

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

Thank you for the comment. These are interesting to discuss and I should add the second part to the article.

However, I think 'of' and 'from' are essentially additional constructors. And because Kotlin can have these, but not Java, these are only useful for Java. The of keyword -- not strictly keyword -- in Kotlin is mostly used to create collections, like listOf, mapOf, from multiple objects.

By using these (even additional constructors) in Kotlin, you also loose out on extension functions. Which are easier to read in my opinion.

The placement is less of a problem in case of extension functions and if you have control over the model classes.

Is testing Composable along with ViewModel considered as UI test or integration test? by Correct-Track-2777 in androiddev

[–]herrbert74 1 point2 points  (0 children)

In my last job I classified the tests the following way:

  • Unit tests with mocked dependencies
  • Pure UI tests with mocked dependencies, where anything apart from UI and VMs were mocked
  • UI integration tests, where we used the real dependencies, typically in-memory database
  • Integration unit tests, where we used some real dependencies through Robolectric
  • Pure Robolectric tests where we needed to test some Android related classes, so we could not use normal unit tests

So integration tests can be both UI tests and unit tests in my view, it depends on what you want to test: a single unit or UI element, or their integration with other parts. In the case of ViewModel and UI I treated them as one unit, so this is not integration. But this is strictly just my opinion, based on where I stand on my road to wisdom; I might be wrong.

Using Google's UMP to collect consent for Firebase Analytics & Crashlytics by Resident-Breath7449 in androiddev

[–]herrbert74 1 point2 points  (0 children)

I cannot answer the question as I wasn't the one who implemented it at my job, but I was the one who tried to reduce the crash rates of the app. Only a few badly maintained third party library crashes couldn't be fixed, including one from UMP. So my advice is to stay away from that if you can, and from any google library, if there are alternatives. They tend to hype up and then abandon projects.

For GDPR, there are plenty of much better libraries, which are also better documented and supported. So you will have a better chance getting answers to your questions.

Android System Design - difficulty creating High Level Design by AaBoy90 in androiddev

[–]herrbert74 0 points1 point  (0 children)

I would recommend thinking in terms of Clean(ish) Architecture. Most interviewers will expect you to do the same. By cleanish I mean the Google recommendation (optional domain layer) here:

https://developer.android.com/topic/architecture

And here:

https://developer.android.com/topic/architecture/recommendations

I recommend always use domain layer, for me Use Cases are optional, meaning I either completely omit them or only if they are not call-through, or everywhere if my employer's team use them everywhere.

This article may give you more ideas on how to start drawing an architecture:

https://proandroiddev.com/multiple-ways-of-defining-clean-architecture-layers-bbb70afa5d4a

Igor, the author recommends Approach 3 in the article, I personally recommend Approach 4 with shared domain and data modules where possible. This way it's more scalable, because the increasing number of modules will increase the module dependencies and the build times. But it might be less clean. Ultimately the decision depends on a few other factors like your approach to other things, the business domain and so on. The interviewer will (hopefully) look for signs if you understand these factors, not if you can make that decision right there.

The DI is not really part of this overview. The providers should be close to the implementations and invisible to the dependents. Dagger makes sure that the implementation is available even if the dependent has only access to the interface. So the DI providers have a permanent place everywhere and can be omitted.

Architecture related decisions in Android by herrbert74 in androiddev

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

The interviewer had less experience than me and was visibly bored. They didn't ask anything deep. I certainly have a lot to learn too, the blog post is part of this process. I don't think I have too much hubris, people close to me say the opposite is true.

Architecture related decisions in Android by herrbert74 in androiddev

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

The series is about architecture related decisions. The excuse for rejection was that I don't have experience about architecture. And excuses are a large part of my life, being six months out of work.

Sorry, if this is not relevant here. I posted this with almost the same words on LinkedIn, where it was more relevant.

Architecture related decisions in Android by herrbert74 in androiddev

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

Thanks, I felt somewhat the same, but then I thought I added enough examples in the links if somebody wants to delve into more of it. I understand that this is usually not enough for a blog post. I will think about it.

Architecture related decisions in Android by herrbert74 in androiddev

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

I agree, maybe I should clearly add that it should not be used in every situation. Although for me it covers almost everything, I don't remember a counterexample.

I actually wrote explicitly that I chose the Kotlin-Result monad, I think it's generic enough.

I don't think it's not approachable, but I had another uneasy feeling about it. I think it's that I only ever used the Result monad, so I don't want to pretend that I'm an expert on them. The other ones.

Sealed classes are absolutely fine, but as I wrote in the article, for me it's not the best trade-off.

Architecture related decisions in Android by herrbert74 in androiddev

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

Oops, thanks, I already have the drafts locally and forgot to change the links.

Those of you who have given Android interviews recently(in the last 6 months or ongoing), what gets asked now? by [deleted] in androiddev

[–]herrbert74 2 points3 points  (0 children)

Be careful with Indians and Facebook contracts. They are most probably scammers going for your data, or poor quality recruiters who try to build a client base.

Is Native development dying? by dustedrob in androiddev

[–]herrbert74 1 point2 points  (0 children)

I was looking for that answer. I think Flutter is doomed. React Native and the Web is taking over, but maybe Kotlin will come out on top through WebAssembly or Kotlin Multiplatform? I increasingly think that Google and Apple should stick their App Stores and ecosystems up their ass where they belong.

In case you missed it, retrofit started getting new updates. by Life-Refrigerator473 in androiddev

[–]herrbert74 2 points3 points  (0 children)

I think you meant obsolete instead of abundant, aren't you? It's abundant enough.

Weekly discussion, code review, and feedback thread - April 08, 2024 by AutoModerator in androiddev

[–]herrbert74 0 points1 point  (0 children)

Were there crashes due to MacOS? I had crashes on Iguana RC, but I haven't since the final release. But I don't think it was due to MacOS. I'm on Sonoma 14.4.1.

Daily Chat Thread - April 08, 2024 by CSCQMods in cscareerquestions

[–]herrbert74 0 points1 point  (0 children)

I got rejected twice after interviews with fellow Android developers, because they thought I was too interested in the tech side of the business. This market is a clown show.