DON'T Make This Clean Architecture Packaging Mistake

Поділитися
Вставка
  • Опубліковано 28 вер 2024
  • In this video I'll show you why you should not do this clean architecture packaging mistake!
    💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
    pl-coding.com/...
    ⭐ Courses with real-life practices
    ⭐ Save countless hours of time
    ⭐ 100% money back guarantee for 30 days
    ⭐ Become a professional Android developer now:
    pl-coding.com/...
    Get my FREE PDF about 20 things you should never do in Jetpack Compose:
    pl-coding.com/...
    Regular programming advice on my Instagram page: / _philipplackner_
    Join my Discord server:
    / discord

КОМЕНТАРІ • 35

  • @germenwong
    @germenwong 6 місяців тому +31

    The clean architecture videos you created are still as good as ever. If you could categorize them into playlists, that would be even better! Can you also create a video about Composite and AdMob? I believe it will be very practical!

  • @manuelito3000plus
    @manuelito3000plus 6 місяців тому +7

    A video of clean architecture in a modular application would be great

  •  6 місяців тому +1

    I like the idea of "specialising" utilities by layers. I've myself created a 'transverse' layer of modules that regroups that kind of stuff (even with a more diverse 'utils' module in it) that are injected from several layers, BUT I tend to treat domain layer differently, in the sense that I do not want to have any logic in it, only classes definition and interfaces. Therefore, there's no tests in it, and a util package (or module) does not seem useful to me. I've recently removed a utility package from the domain layer to my transverse one just for that purpose.
    Nice thought and video, I will reflect on this a bit. Thanks!

  • @RahulKumar-un6ur
    @RahulKumar-un6ur 6 місяців тому +1

    Awesome explanation as always, Philipp. One question for clarity, please. If we keep this layered features packages, where should we put the classes or packages that will be needing in all features or more than one features such as networking library and/or db setup, the ui package itself and so on? Should we create a "core" package and then create related packages in that (presentation, domain, data)?

  • @kaushiksaha4397
    @kaushiksaha4397 5 місяців тому

    The problem is when those files used by multiple section of apps. Like if there is files that supplies the text for different data errors. It should obviously go to 'presentation'. But as it is used by all of Presentation of different section, how to place it?

  • @AmirRaza1
    @AmirRaza1 6 місяців тому +4

    But util is meant to be for global access, and should be declare under main package, isn't it right?

    • @chips056
      @chips056 6 місяців тому +1

      I would suggest inside a core module actually and you inject this module wherever it is needed

    • @PhilippLackner
      @PhilippLackner  6 місяців тому +6

      That's my point here to not do that. Using util packages is no problem, but if you have the type of layered architecture I show in the video, each util class can be attributed to one specific layer

    • @vigneshe3466
      @vigneshe3466 6 місяців тому +5

      Hey, what if I have to use the same function in more than a layer? Should I have duplicate code??

  • @QuantuMGriD
    @QuantuMGriD 6 місяців тому +1

    Hey philipp, Can you make a video on how to use data classes properly with jetpack compose. If we were to have a lot of properties for a composable in a single data class, changing a single value later on seems to make recompositions everywhere. So what is the the best way to do this would be a useful video! Thanks!

    • @PhilippLackner
      @PhilippLackner  6 місяців тому +1

      Compose can detect which field changed and skip all unaffected composables

    • @hariomsharma1202
      @hariomsharma1202 6 місяців тому +1

      ​@@PhilippLackner I created a few TextFields and created a state data class to hold all their values, whenever i type in any of the TextField, it recomposes all the other fields as well.

  • @phoenixshell3772
    @phoenixshell3772 5 місяців тому

    To be honest, IMO Util packages are a bit of an anti pattern, in good OOP programs it's better to implement them as Objects, so your response code utils should be in an object HttpResponse and those handler functions as methods. Clean architecture has some good points, but in my mind theres a lot of questionable OO code floating around and people are focusing on the wrong things. I have seen clean code projects that have really bad OO code

  • @Lovepreet-xs5qi
    @Lovepreet-xs5qi 5 місяців тому

    Thanks buddy

  • @adrianikeaba
    @adrianikeaba 6 місяців тому +1

    what is an inline function 🙂

  • @sabbib007madness
    @sabbib007madness 6 місяців тому +2

    i hate these util packages regardless of where it sits, its more than breaking clean architecture, its easy to break abstraction or Solid or worse engineering principles. it should be a layer/class specific logic sitting in the class. if more than one class need it, make an instantiatable class, inject it and structure it like a usecase or interactor. making an object class or an entire file of top level function doesnt make sense
    if less than 3(or relative) classes need this logic, just duplicate the logic. you never know when the requirements change only 1 place in the app and now will you create a new function implementing this logic?

  • @khaled_hawwas
    @khaled_hawwas 6 місяців тому

    🔥🔥🔥🔥🔥🔥

  • @yossimaskin1393
    @yossimaskin1393 6 місяців тому +6

    What if you have a shared logic which you want to use in more than one layer or in a few features data layer for example? If you go this way you'll have code duplications

    • @PhilippLackner
      @PhilippLackner  6 місяців тому +7

      That's what you have a core package for which has its own layer packages

  • @McMouse88
    @McMouse88 6 місяців тому +4

    utils package also creates problems when you have multi module structure. For instance you have a common or core module that incorporates utils package. This utils are using by features modules. Any modification or additional to the utils package will triggered a rebuild of all modules. Thus negating the advantages of a multi module structure.

  • @Alchemist10241
    @Alchemist10241 6 місяців тому +3

    what if a class or function is being used in more than one layer what should we do then?

  • @kentsolgule5362
    @kentsolgule5362 5 місяців тому +1

    I find it confusing how you name packages as domain, data and presentation (or ui). It seems that in your architecture videos the domain package is used for everything that isn't dependent of android, external data or presentation. I have learned that a domain model is supposed to be a model of real world concepts that you get from the domain experts, free from implementation details. Concurrency is a typical implementation detail, for example, so classes using Kotlin coroutines probably isn't part of the domain model. If the implementation is in android lib or in kotlin lib isn't what determine if it belong in domain or application model. The data package is also strangly named since data classes belong in domain if they are concepts used by the domain experts. Of course if data classes use some specific database lib then it's probably a good implementation design to duplicate those classes both in a database layer and domain model as you do, but maybe call the package something else than data in that case?

  • @Varun_Sethi
    @Varun_Sethi 6 місяців тому +4

    Hello Sir I wanted to know what are the prerequisites for the live mentoring class and also for the bundle course at your website. How much knowledge should one have before getting this course and how do we know that we have passed the beginner stage. I have done the basic jetpack compose from your playlist and built the pokedex app is this much enough for getting the bundle course and of not then what should I do more.

  • @IvanVasheka
    @IvanVasheka 5 місяців тому +1

    Don’t use !!

  • @pauloCosteira
    @pauloCosteira 6 місяців тому +1

    I would change the names, to make it easier to understand, something like FormatDataUtil, ErrorDataUtil, NameDomainUtil ....

  • @Alchemist10241
    @Alchemist10241 6 місяців тому +1

    please consider making a video about Cancellation Exception in coroutines according to this medium article: The Silent Killer That’s Crashing Your Coroutines

  • @ahmedhappa289
    @ahmedhappa289 6 місяців тому +1

    Are you not using a Loading Type in your Resource or DataResult Sealed class any more ?

  • @cristicode4301
    @cristicode4301 5 місяців тому

    what color scheme is that?

  • @sergeykharuk5614
    @sergeykharuk5614 5 місяців тому

    According to tips described in this video where Network things should be created? For ex. Retrofit singleton instance. Should we create a separate Network module (if talking about a multimodule project) and inside it write and provide Retrofit instance?

  • @andrermn
    @andrermn 6 місяців тому

    except package structure != architecture

    • @PhilippLackner
      @PhilippLackner  6 місяців тому +3

      If you stick to a layered architecture, the package structure often reveals a lot about the actual architecture though :)