DON'T HAVE These UseCases in your Android Code!

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024
  • 💻 Grab my Refactoring Legacy Code course here: bit.ly/47dzTLT
    In this video, we will explore the incorrect use of the use case pattern in your Android app. We will discuss why this approach is suboptimal and how to make room for much better implementations of this pattern.
    =========================
    📩 Sign up for my new newsletter 👇
    bit.ly/YCNewsl...
    =========================
    Join my Community on Discord 👇
    / discord
    👨🏽‍🏭 Who I am:
    I'm Younes Charfaoui, a Software Engineer and an Android Developer. I make videos about Android development, Technology, and productivity for software engineers.
    😋 Be My Friend:
    💻 GitHub - github.com/You...
    🐦 Twitter - / charfaouiyounes
    📑 Medium - / mxcsyounes
    📷 Instagram - / charfaoui.younes
    🌍 My website - www.charfaouiy...

Комментарии • 12

  • @SaminAliMondal
    @SaminAliMondal 3 месяца назад +6

    Learn something new. ❤
    But isn't this will create inconsistency, like some viewmodels have repository some has useCases? 🤔🤔

    • @CharfaouiYounes
      @CharfaouiYounes  3 месяца назад

      It shouldn't be, you're favoring small inconsistency over huge overhead

    • @AlexanderStark-e7b
      @AlexanderStark-e7b 2 месяца назад

      @@CharfaouiYounes I would also say, that it adds inconsistencies. How would you explain to new team members when to use usecases and when not? If you would use usecases all the time it's a clear guideline and easy to understand. Another argument pro usecases would be the reusable of code. If you add access to a repo directly in the view model and maybe some little business logic it will be hidden for other view models/developers which/who might want to use exactly the same access and the same simple logic. It end up in redundant code.

  • @CodingMeet26
    @CodingMeet26 3 месяца назад +1

    Excellent Work. i also same thing

  • @unknownyouf5579
    @unknownyouf5579 3 месяца назад

    Une Excellente explication et simple pour apprendre ... Bon continuation frère

  • @bbeniful
    @bbeniful 3 месяца назад

    I like that approach and the video and I align with it, but how would you manage that scenario when you want to call just a simple method from repository without modification (no business)? in terms of CA, the viewmodel can't have access to the repository. Would you create a "new layer" for that data or, even it breaks the rule of "Use Case" would you still use it to keep the separation of concerns? Thanks

    • @CharfaouiYounes
      @CharfaouiYounes  3 месяца назад

      If there is a clear separation in your case with boundaries set by your team, then you have no choice, but I wanted to clarify that even such boundy shouldn't be there if most of our call to repository are simple forwarding!

  • @MudassirZulfiqar
    @MudassirZulfiqar 3 месяца назад

    What is this plugin you have? It says simple?

    • @RookSoto
      @RookSoto 3 месяца назад +1

      "Code Complexity," I think. Someone I worked with used a similar one.

    • @CharfaouiYounes
      @CharfaouiYounes  3 месяца назад +2

      Code Complexity

  • @khanra17
    @khanra17 3 месяца назад

    For audio please use some ai voice that has a better & (listenable) accent