Тёмный

6 Design Patterns Every Android Developer Must Know 

Подписаться
Просмотров 82 тыс.
% 3 137

Design patterns are nice solutions to common problems in programming. As Android developer there are a few you must know. You'll learn about them in this video.
⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/premium-courses?
💻 Let me personally review your code and provide individual feedback, so it won't backfire and cost you a fortune in future:
elopage.com/s/philipplackner/code-review/payment?locale=en
Regular programming advice on my Instagram page: _philipplackner_
Checkout my GitHub: github.com/philipplackner
You like my free content? Here you can buy me a coffee:
www.buymeacoffee.com/philipplackner

Опубликовано:

 

1 авг 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 123   
@LinggarMaretvaCendani
@LinggarMaretvaCendani 3 года назад
0:49 Singleton 2:46 Factory 5:04 Builder 8:31 Facade 9:44 Dependency Injection 12:30 Adapter
@shalatan
@shalatan 3 года назад
Can you create a video for something like 'Best practices for big apps or advanced apps' to keep them easily readable and updatable with time ?? 🤔🤔
@PhilippLackner
@PhilippLackner 3 года назад
cool idea, will think about it
@bboydarknesz
@bboydarknesz 3 года назад
@@PhilippLackner clean architecture. wow, cant wait! Hope it also support for REST API, login, token, handle expired token
@chatgpt-undetected
@chatgpt-undetected 2 года назад
I'm looking exactly for the same thing. Still can't find a good video/series for advanced practices for developing big and scalable apps
@andyli619
@andyli619 Год назад
good idea
@SebastianHasch
@SebastianHasch 28 дней назад
The two most important things are to 1. Have a plan on what you want to do beforehand so you can 2. Organise your code in a way that makes sense and is easily extendible.
@newbiegameplayy
@newbiegameplayy 3 года назад
Very useful information... If you have a time please make a series for cracking clean Architecture for Android Development. It will be great series for all of us 🙏🏻
@vengateshm2122
@vengateshm2122 3 года назад
Excellent. Interview prep material. Decorator - Modifying an object during runtime. Eg: Recycler view item decorator
@vengateshm2122
@vengateshm2122 3 года назад
Feeling overwhelmed when getting a love for my comment from the creator who is 1000s of miles apart. Thanks to the technology.
@lifeOfCharlesMaina
@lifeOfCharlesMaina 3 года назад
You are the best Android and Kotlin teacher I have encountered!! Thank you Phillip...you are literally saving careers out here💯💯💯
@mustaqode_6617
@mustaqode_6617 3 года назад
Might look like just another topic. But this is really one of those topics which most developers have no idea about even though they use all these all the time. From my personal experience, this video will save u from embarrassment while attending android interviews. Thanks phlip.
@matt-g-recovers
@matt-g-recovers 3 года назад
Excellent video, I learned quite a bit about both the patterns in kotlin and gained insight into better ways. Thanks Phillipp! I learned these all in Java many years ago... it's so refreshing to see the idiomatic Kotlin versions as well as gain some further insight into each.
@PhilippLackner
@PhilippLackner 3 года назад
Glad you enjoyed it
@voidpointer398
@voidpointer398 3 года назад
As always, unique content. Thanks man ❤
@PhilippLackner
@PhilippLackner 3 года назад
My pleasure!
@DARKcarlos1
@DARKcarlos1 3 года назад
Dammnnnn phillip, right now I’m doing a test app because I’m applying for an android developer job… and that builder pattern just saved me the day. You don’t know how many hours I was trying to do something in an adapter and this builder pattern was the perfect way to do that. Thank you very much for this video, It came in divine timing
@new_kind_of
@new_kind_of Год назад
Simplied and to the point. Good work Philipp 👏
@akeeaggarwal8087
@akeeaggarwal8087 3 года назад
You have made them super easy for us to understand. Thanks man.👍
@jaygitonga2026
@jaygitonga2026 3 года назад
As always great videos Phillip! Do a tutorial on clean architecture or mvi
@mare10rooney
@mare10rooney 3 года назад
Another great video Philipp! Thanks for handling some of the advanced topics...
@PhilippLackner
@PhilippLackner 3 года назад
thanks!
@FaroukSonic
@FaroukSonic 3 года назад
Thank you so much bro! I recently discovered your channel and it's super helpful! Great content!
@ibrahimkhalilshakir2414
@ibrahimkhalilshakir2414 3 года назад
Great job. Please make an e-commerce or Video calling app tutorial 😊
@Coldalecs
@Coldalecs 2 года назад
Loved it! I like how easy is to understand from what you explain.
@InaAgapito
@InaAgapito 3 года назад
It was really helpful! I'm learning to develop for android but this topic isn't so talked in many courses or even when happen is to much superficial, so could you say when should a beginner student as me start to study it?
@mkc0321
@mkc0321 Год назад
the best time i spend on youtube is seeing your videos
@josephmolina5477
@josephmolina5477 3 года назад
Please continue to make more videos on these topics !
@righteouscoder
@righteouscoder 2 года назад
So a note about the Kotlin way of doing builder, it isn't actually the builder pattern, b/c it doesn't hide the concrete implementation details from the end user. A proper builder pattern can have constructor parameters of the built class change name/order/etc. and not be visible to the end user. However, in the kotlin methodology, you are directly exposing the constructor to the end user. Even with parameter naming, you have an easier chance of making compile breaking changes if you do this vs hiding the details inside the builder.
@vibovitold
@vibovitold 10 месяцев назад
Builder pattern doesn't necessarily have to hide, alias, abstract or simplify the object's API. It sure CAN, and it may be pretty useful... but that' becomes more of a Builder + Factory / Facade combo. The main point of a Builder is just that it allows to construct an object step by step (which includes the possibility of passing a Builder elswhere, so that some other code can finish what we started). Just because some Builder does "naively" reflect the constructor signature 1-to-1 doesn't mean it's not a "proper Builder patten".
@ghasemshirdel6933
@ghasemshirdel6933 3 года назад
Thanks Philipp , I think some other patterns like Object Pool, Flyweight, Decorator, Observer, Strategy and Proxy has useful in a project
@SurajKumar-vi3ll
@SurajKumar-vi3ll 2 года назад
can you create a video for "keyboard productive hacks in android sudio"? i know few of them I like: 1. ctrl + Alt + Shift + up/down to go the edited location in the same page 2. double shift to search anything.
@iliass1
@iliass1 3 года назад
I like the way you teach, so cool. I learnt a lot from you. thanks bro
@PhilippLackner
@PhilippLackner 3 года назад
you're welcome
@Sc2MooDy
@Sc2MooDy 3 года назад
Thank you for this video, please keep making those kind of videos :D. I suggest one about gradle
@saumilpatel2480
@saumilpatel2480 3 года назад
Very useful Phillip. Great content as always 👏👏👏
@asifmehmood9307
@asifmehmood9307 2 года назад
great information it's help full for me great effort bro
@theophilus494
@theophilus494 3 года назад
Great and lovely video... Kindly make tutorials on dagger. Thank you boss..
@jam4l
@jam4l 2 года назад
A great video as always, Ty.
@JavierMartinez-kc2ps
@JavierMartinez-kc2ps 3 года назад
Great video!! Can you create a video about how we can organize a Gradle in a big app o maybe how use tasks. For example a Jacoco task to use in sonar
@techmarinar
@techmarinar 3 года назад
Thanx man this was very very helpful 😊
@ronyaburaihan
@ronyaburaihan 3 года назад
Can you create a video for webrtc for Android?
@unaisulhadi9102
@unaisulhadi9102 3 года назад
Excellent video Phil!!
@PhilippLackner
@PhilippLackner 3 года назад
Glad you enjoyed it
@devgabriel6898
@devgabriel6898 2 года назад
Is Observer one of them and very used in Android too? Or im wrong?
@skillz7
@skillz7 3 года назад
Hello sir , your doing great 🔥 , I will start android dev , from next week , can tell start android with XML or jetpack compose , I am good with flutter nd been doing from last 8 months
@samdroid37
@samdroid37 2 года назад
please make a video over page object model pattern for testing with kotlin!
@alirohmansyah7914
@alirohmansyah7914 3 года назад
thanks philipp. btw have you ever made a video about rxjava ?
@FatLlama31882
@FatLlama31882 2 года назад
I'd like to express to some of the less experienced viewers why one of your comments on builder patterns in Kotlin is a bit inaccurate. Not wrong though. I'm referring to using named args to simulate a builder pattern. While this can be very useful and is likely a good idea in some builders. The builder pattern is used to create complex objects. The point of it is that you don't always have everything you need at the time you call a constructor. With your way the developer has to make sure all required dependencies are before calling the constructor as the object is meant to be immutable (or very close to it) once created. This is why a builder object is made. The values can change and be set after the builder objects creation. This builder can be passed around to configuration classes. That or the creation of a dependency can happen, then the builder set function is called, then you create the next dependency and so on. One other benefit to the builder object is that it can throw an error for objects that aren't configured correctly. Usually the Builder constructor has the minimum requirements for the .build() function to work but this isn't always true. The androidx biometric library has a good example of the builder throwing an exception for improperly configured builders. If you try to set the prompt cancellation button text while also trying to set device credential as an option for the prompt then these two states can't exist at the same time as they occupy the same space on the biometric prompt. So an error is thrown. In my eyes this is poor design so that leads into my next paragraph. Where I agree with your approach is that the builder to me (purely opinion at this point) is a bit of an anti pattern. It lets you get away with bad design. If you can't create the dependencies before calling the constructor then maybe you need to refactor some stuff or maybe the object is a bit too complex and doing too much. As with everything in programming it is knowing your requirements and which tool (pattern in this case) to get a job done. There is no one solution and that is why I am not saying you are wrong for your Kotlin approach to builders. Just wanted newer devs to understand the use of the Builder object.
@vibovitold
@vibovitold 10 месяцев назад
"One other benefit to the builder object is that it can throw an error for objects that aren't configured correctly." The same can be done by the object's constructor (or its factory function). Your other points are valid, but this one feels unconvincing to me.
@FatLlama31882
@FatLlama31882 10 месяцев назад
Yeah just re read my comment and I may have missed some context or something out as I agree that didn't really make much sense.
@shreyashchoudhary2637
@shreyashchoudhary2637 3 года назад
Yeah! 2 of 6 I don't even heard before ❤️
@alix3665
@alix3665 5 месяцев назад
GOD I Needed this video... FUCKIN LOVE YOU PHILIP❤❤
@sat_talk
@sat_talk 3 года назад
Great video.. Pl. make a project on Forum App or Polling App
@sunildhakar078
@sunildhakar078 3 года назад
Hi, Philipp Great job. can you create a video on app performance for big apps?
@ErikBongers
@ErikBongers 2 месяца назад
Having a constructor with default values isn't the best example of a Builder pattern. A typical Builder should force you to, for example, provide arguments or dependencies in a specific order or a user defined order, or perhaps dissallow a dependency if a previously specified dependency was of a restrictive kind or allow an argument to be given more than once. In other words, a Builder allows you to restrict argument requirements or give more flexible arguments or a combination of both. The Modifier is the best example of this. Don't be fooled by it not having this final build() call.
@krhijaerhtuirthsirthu164
@krhijaerhtuirthsirthu164 Год назад
Podrias explicarme mas detalladamente como implementar el patron Factory en mi proyecto porfavor ?
@rba6486
@rba6486 2 года назад
Hey Philipp, i've got a question regarding the patterns introduced by you. You start with singletons. For what I know, they are considered being an anti-pattern, which shouldn't be used due to tight coupling, etc. So, why using them at all?
@vibovitold
@vibovitold 10 месяцев назад
I don't know what Philipp thinks about it, but here's my take on it. Singletons aren't always bad, that's a generalization. The main problems with singletons are: 1. Singletons tend to obfuscate dependencies. If a class Frobnicator is a singleton, it can be accessed from everywhere, which leads to poor code design, and you can't dictate by code design which classes are legitimate and intended users of Frobnicator. You don't have to worry about propagating it, which makes things easy in the short run, but may lead to sloppy and lazy code design. (Case in point: event buses, which were a popular Android anti-pattern for quite a while). 2. Singletons can be used to hold global state, and global state is usually a bad idea, for reasons related to #1. It also gets in the way of testability, since it's hard to replace a singleton for the sake of unit testing. You either have to resort to tricks such as mocking statics, or your tests have to reset the state of the singleton... and every time you forget about resetting, there goes the isolation (because the tests are no longer independent - one test can contaminate the state of the singleton, with an impact on subsequent tests). However: a) Singletons can be stateless, and this resolves the problem of global state. Sometimes stateless singletons are just redundant in Kotiln (no need for a CollectionUtils singleton, just define extension functions, since Kotlin supports standalone functiions). But eg. android.util.Log is a singleton, and it's generally not a big deal. b) It's preferable to define a singleton via your DI framework. They typically support singletons (@Singleton annotation in Dagger 2, singleton in Koin etc.). So you can have the framework guarantee that some class will be functionally a singleton - there will only ever be one instance of it - but you don't define it as an object, you just define it as a class. This makes it easy to subtitute it in tests, and to keep the dependencies transparent, mitigating the main problems associated with the use of singletons. So the problems have solutions, and while caution is advised, there is still proper use for singletons. The default mindset, however, should be "why yes?" instead of "why not?", whenever you are tempted to define something as a singleton.
@pradeep9222
@pradeep9222 3 года назад
it's awesome, thank you so much
@Alchemist10241
@Alchemist10241 3 года назад
If singleton pattern is just an object in kotlin, why we create room database class singleton like java singletons (using @syncronized and private Instance)?
@Akira-sh7ts
@Akira-sh7ts 2 года назад
stupid question In frontend web dev why we need to learn design patterns because I am learning react and never saw this things....
@shoaibkhalid6156
@shoaibkhalid6156 3 года назад
Amazing. Do you have any discord channels?
@abhishekauti164
@abhishekauti164 3 года назад
Hey man it was really helpful
@nihal999in
@nihal999in 2 года назад
U are awesome bro.. please grow your beard.. you look damn handsome in that look. Apart from this, your biggest fan. You teach and explain things in different level. Love it bro . 😊
@karentechnologies3990
@karentechnologies3990 3 года назад
Thanks Phillip for this useful video. please make a complete series for design patterns and best practices for Android developer, one more please make a series for memory management in Android. Thanks
@yelamanmyrzahanov9883
@yelamanmyrzahanov9883 3 года назад
As always, unique content and easy to watch Can you please make video about anti pattens in Android?
@PhilippLackner
@PhilippLackner 3 года назад
Cool idea 👍
@darksoul2474
@darksoul2474 2 месяца назад
Make video for Android Google interviews
@alextl97
@alextl97 3 года назад
Hey Philipp can you make a video about data structures you use the most in Kotlin and in what cases, like for example Hashmaps. Great video like always btw.
@zafar_codes
@zafar_codes 3 года назад
Thanks for good video, we would more videos about Jetpack compose, especially architecture of these apps
@matt-g-recovers
@matt-g-recovers 3 года назад
He's already done 3 playlists on compose, some advanced dev stuff is welcomed.
@subindsuresh4897
@subindsuresh4897 2 года назад
Thank you bro.
@Scamparelli
@Scamparelli 3 года назад
Hey Philipp, thank you for the excellent video - your explanations are really nice to watch and I like that small errors are left in (such as in the return statement in the 'factory' example), however I really, really, REALLY struggle with dependency injection. I just can't understand how I would implement it or how I would change my app to use this pattern.. I hope I am not alone! I would therefore really appreciate it if you would do a video where you start with a simple existing design that you convert to use dependency injection to show the benefits of this methodology.. thank you!! (you did ask for suggestions!). Oh and I work in Kotlin so I'm happy I can avoid the builder pattern!!
@mustaqode_6617
@mustaqode_6617 3 года назад
Perfect as always.
@muhammadmuzammil2575
@muhammadmuzammil2575 2 года назад
Can you please show some examples of adapter pattern other than recycler view adapter. Literally i couldn't adapt the adapter pattern :P
@vibovitold
@vibovitold 10 месяцев назад
Eg. every mapper converting an object from - say - an API response to an object your business logic uses. (Because you don't want your business logic to get updated everywhere every time a json structure changes; that's not good separation of concerns). So you may have a type like UserResponse (which reflects how user data is represented in the json returned by some API endpoint, and is used for deserialization of these responses), but then you've got an Adapter which translates those UserResponse objects into User classes that your app actually deals with. Thanks to this, if a structure of UserResponse ever changes (eg. they've renamed a field, or the "badges" collection is now nested under "attributes" etc., whatever), the impact of that change is contained. You're just updating your Adapter, but all your business logic can remain unchanged. I'm aware that your question is 2 years old, but someone else may be reading it just the same, possibly wondering the same thing.
@ZaidZakir
@ZaidZakir 3 года назад
Great video ☺️
@PhilippLackner
@PhilippLackner 3 года назад
Thank you!! 😊
@bboydarknesz
@bboydarknesz 3 года назад
soo that's how they call Builder pattern and tutorial to make it. Man you best! But I don't know when I will make Builder pattern with Kotlin.
@MegaArti2000
@MegaArti2000 Год назад
I think it got too abstract at some point, maybe some bigger examples would be more useful for understanding each pattern, but thx for the video anyway
@javacore-qk9kd
@javacore-qk9kd 6 месяцев назад
you are the man of God💖💖💖💖
@harshar6897
@harshar6897 3 года назад
Could you explain why or how service locator pattern is called an anti pattern ?
@vibovitold
@vibovitold 10 месяцев назад
It can hide dependencies, plus when it's misconfigured (eg. some dependency is not defined), there's a risk you will only find out by a runtime error instead of a compile-time error. It's about trade-offs though. Koin is a service locator, and it's not bad 0 especially if your project isn't very big; in that case the simplicity of Koin may be worth it.
@chimezieorji-unegbu7110
@chimezieorji-unegbu7110 3 года назад
Excellent video as always
@PhilippLackner
@PhilippLackner 3 года назад
Thanks again!
@ramasubramanian3154
@ramasubramanian3154 3 года назад
Awesome info. Is there a way to use binding in persistant bottom sheet? If we dont use kotlin synthetics.. We could use binding for normal dialogs, acticities, fragments to acess the views easily. But for persisten bottom sheet it doesn't seem to work? Any idea how to use it?
@devendravarma5074
@devendravarma5074 3 года назад
Can we get a video like 'Testings made esay with dagger', which will demonstrate the fake repository pattern that you just explained in this video
@PhilippLackner
@PhilippLackner 3 года назад
I have a whole playlist on testing with dagger hilt and stuff like that
@devendravarma5074
@devendravarma5074 3 года назад
@@PhilippLackner thanks a lot, I have gone through that playlist and it was really helpful!
@devendravarma5074
@devendravarma5074 3 года назад
@@PhilippLackner How about a video for: "The best to secure keys for production apps"
@awais2980
@awais2980 3 года назад
Thanks Philipp for the video ❣️
@PhilippLackner
@PhilippLackner 3 года назад
My pleasure!
@LaDaDee
@LaDaDee Год назад
Are you copying Ahmad Kazimi's article or is he copying from you?
@PhilippLackner
@PhilippLackner Год назад
Looking at the publish date of each, that should be clear 😂
@devgabriel6898
@devgabriel6898 5 месяцев назад
Saw this video (AMAZING) 2 years ago and now Android has also lift us of that horrible recycler views adapters thanks to Compose xD
@mosesaltruism518
@mosesaltruism518 3 года назад
Nice Video. Could you find time and do a tutorial on app modularization?? Would really appreciate.
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 2 года назад
Developers may know, but Google Android managers have no idea that DSF and DFF are audio files too.
@mohammadrezarahmani3731
@mohammadrezarahmani3731 3 года назад
Please make a free tutorial for Ktor
@niranz7745
@niranz7745 3 года назад
More videos!
@ahmednashwan8111
@ahmednashwan8111 3 года назад
❤️❤️❤️👌👌 perfect
@adnanomerovic5487
@adnanomerovic5487 3 года назад
Nice!
@withinloop
@withinloop 3 года назад
Thanks lot Brother
@PhilippLackner
@PhilippLackner 3 года назад
Welcome
@erfansn869
@erfansn869 3 года назад
Good an quastion how to use service and inside it state flow in mvvm?
@TidelxD
@TidelxD 2 года назад
Nice
@DiabloZq
@DiabloZq 3 года назад
Thank you!
@PhilippLackner
@PhilippLackner 3 года назад
You're welcome!
@swaminathbera6407
@swaminathbera6407 3 года назад
How to do Configuration for debug app and for release app. Like how to remove/hide log or classes or default values that you don't need in production app but needed for debug app
@bezelyesevenordek
@bezelyesevenordek Год назад
facade is like mcdonalds i dont want to see how the bigmac is made
@rajushingadiya2860
@rajushingadiya2860 3 года назад
perfact
@MaisUmSomente
@MaisUmSomente 3 года назад
awsome
@calvindeceuster878
@calvindeceuster878 2 года назад
Just give me my freakin hamburgers! Thank you
@fyanahmad9418
@fyanahmad9418 3 года назад
Practice make perfect
@PhilippLackner
@PhilippLackner 3 года назад
true
@shriharshsistla614
@shriharshsistla614 3 года назад
Shit I missed the Live 😭
@arshsethi8596
@arshsethi8596 2 года назад
most of it went over my head but alright
@syedovaiss
@syedovaiss 3 года назад
You missed repository pattern 😛
@PhilippLackner
@PhilippLackner 3 года назад
Sure, there are more, observer would also be a common one. But somewhere I need to draw a line 😁
@ardit9988
@ardit9988 2 года назад
😃
@MikeBurke
@MikeBurke 2 месяца назад
Singleton 🤮
@abuiman5251
@abuiman5251 3 года назад
Hi, Philipp, I've sent you a message in Instagram. Could you please check it! P.s. thanks for the great videos!👍🏻👍🏻👍🏻