Тёмный

"Cruddy by Design" - Adam Wathan - Laracon US 2017 

Adam Wathan
Подписаться 37 тыс.
Просмотров 81 тыс.
50% 1

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

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 106   
@SimonDaviesOfCourse
@SimonDaviesOfCourse 7 лет назад
I have seen this being mentioned and that in several tuts, Jeffery Way talks about it on Laracasts, but I Must say. This is the best explanation and demo of this in action, with the comprehensive demo, it makes it easier to understand. Hat off to you Adam, another great explination :-)
@SebastianAndreiIordache94
@SebastianAndreiIordache94 5 лет назад
I dont even do Laravel, but this is so important
@Egadirov
@Egadirov 4 года назад
16:35 "it doesn't matter, because we're not gonna run this code" - 😂
@TheKennyWorld
@TheKennyWorld 11 месяцев назад
This talk is legendary, I come back once in a while to experience it again
@j.erlandsson
@j.erlandsson 5 месяцев назад
Literally went to the comments to say the exact same thing.
@DAlbertsson
@DAlbertsson 7 лет назад
Amazing talk man! You totally inspired me to instantly get out of bed and go refactor! :)
@tamrat_assefa
@tamrat_assefa 5 лет назад
Amazing presentation. api.php, here I come. Some housekeeping is in order.
@whyisthereahandlenow
@whyisthereahandlenow 4 года назад
2:51 "Building Interfaces with Utility-First CSS" Quite the foreshadowing here
@NoodlesDream
@NoodlesDream 2 года назад
1. Nested Resource? 00:00 - 12:53 2. Edited Independently? 12:54 - 17:10 3. Touches Pivot Record? Eg.: "What do I have now that I didn’t have before?" 17:11 - 24:49 4. Transitions State? 24:50 - 36:21
@free2idol1
@free2idol1 2 года назад
thanks much. Your comment should be pinned on top so that people can easily navigate through the video.
@DanilDogadkin
@DanilDogadkin 4 года назад
What is the cruddy way to store / update / destroy multiple records at once?
@oliversmith7097
@oliversmith7097 Год назад
I was wondering the same thing
@joejohn.
@joejohn. 6 лет назад
Man, I need to either switch to Sublime or step up my shortcut game.
@jackiemulsons
@jackiemulsons 5 лет назад
and as a Vim user, watching this makes me so glad I don't use Sublime. It's hard to watch somebody stumbling around so inefficiently...
@wouterkrooshof2527
@wouterkrooshof2527 5 лет назад
@@jackiemulsons What
@snelinternet4654
@snelinternet4654 4 года назад
@@jackiemulsons ja precies. 😂
@Virtualmix
@Virtualmix 5 лет назад
Funny how there's a manhole in the middle of the stage
@Nscape-dl2js
@Nscape-dl2js 5 лет назад
what if for example i want a function that downloads a pdf ? that's not exactly a create function, i would just create a FilesController and create a download function to be honest.
@kwabenaberko5317
@kwabenaberko5317 7 лет назад
FInally! Was waiting patiently for this. Thanks Adam
@JavierDiazGomez
@JavierDiazGomez 7 лет назад
Awesome talk, as always! Love your job and is really inspirational. Greetings from Chile, Adam!
@thahawahid6200
@thahawahid6200 Год назад
Among all other things, I learned that you can use spotlight search as a calculator directly. 😀. Great talk. Going to try this.
@pisyek
@pisyek 3 года назад
Nice and simple approach! Will use "cruddy by design" in future projects.
@esirei
@esirei 3 года назад
Yooo... that mutator trick in the pivot model is pure gold! 😳😃
@TrondHus
@TrondHus 2 года назад
A very interesting talk and it also opens up so many possibilities as well. Like for instance - currently the subscription controller only has two methods - store and destroy. What if you want to see a list of podcasts you subscribe to. Then you can create a list in the subscription controller as well (maybe). And - so - much - more ...
@AhmadAhmad-po4nl
@AhmadAhmad-po4nl 2 месяца назад
Looks great, but I'm wondering if this is still valid in 2024?
@WalkaboutLifeVideos
@WalkaboutLifeVideos 7 лет назад
Is there a Laravel/PHP equivalent to the rails stats that DHH uses to grab the Controller count? I was trying to find something to run on my code.
@Badya122
@Badya122 7 лет назад
twitter.com/adamwathan/status/917082844001964039
@poloxxx
@poloxxx 4 года назад
The idea of refactoring to a specialized class, model and controller for the pivot is pure gold. Everything kind of makes more sense like this.
@EduardoWeidmanBarijan
@EduardoWeidmanBarijan 7 лет назад
Thank you very much to make this talk available here. When I read about REST and about endpoints and all about that API driven design stuff I always end up banging my head thinking about how nested resources will work, what methods do I need, exactly like you pointed out. This way of thinking that everything is CRUD really makes sense to me and I will try to apply this in a project I have and yes it is a nightmare right now. The way you explain and show how it is done seems very easy to apply and I like the concept of changing the pivot table's name too. That I already do as it makes a lot more sense but I never thought about creating a separate Eloquent model, so thanks for that.
@TristanBailey
@TristanBailey 5 лет назад
Adam, just come back and watched this again, sometimes when you are live coding I find you get way too detailed, but this was really educational and gave me things to work on. I have been trying to do resource controllers for a little while but someof your refactoring was good incite and way to revisit things too, thank you.
@Souljacker7
@Souljacker7 Год назад
I actually downloaded and stored this because I'm afraid it's gonna be taken out of internet one day and I won't be able to go back to it and re watch
@LaurentPerrier
@LaurentPerrier 7 лет назад
Great talk, I like that you're showing a lot of common scenarios. 1. How would you model a restore method for soft deletes as CRUD? 2. Let's say you're building a proposal software, how would you model sending a proposal as CRUD? (considering you can send it more than once, unlike publishing)
@WalkaboutLifeVideos
@WalkaboutLifeVideos 7 лет назад
My guesses / what I would do after watching the talk: 1. DeletedPostsController with an update = restore, delete = permaDelete 2. Probably something like a ProposalDeliveryController with a create. The nice thing about this is that you could easily make a model associated and store records in the db of send times and destinations if you wanted to as well.
@EdmondKachale
@EdmondKachale 7 лет назад
1. Soft deleting a record means that you have _updated_ a certain flag to hide the record from a particular scope. So use _update_ for soft deletes and _delete_ for permanent deletes. 2. If every time you send a proposal out, you _create a new record,_ it means that you will have to call a _create()_ on your controller. You can have _SendProposalController_ (or even _EmailProposalController_ which makes more sense if you are emailing them out).
@Shortly8908
@Shortly8908 4 года назад
Hi, Thank you for this video. I just want to ask how are you going to group these controllers? is it by modules?
@augustsbautra
@augustsbautra 4 месяца назад
This! No more 10-20 action controllers!
@饶泽海
@饶泽海 3 года назад
any suggestions on what the 'pseudo' resource and request urls could be for bulk actions?
@bennershull
@bennershull Год назад
Perhaps it would be: Post: /pseudo-resource => PsuedoResourceBulkController Now you’ve set the scene for create update and delete pertaining to multiple records.
@rationalityfirst
@rationalityfirst 7 лет назад
Adam, do you think that the trick where you set an object as attribute should be part of Eloquent core? Or would it over complicate things? And nice presentation, as usually.
@truyenhot
@truyenhot 2 года назад
but what if we submit the cover with the form data when we create a podcast, hmm how do we separate it to update route, when podcast hasn't been created yet, still so vague and u didn't mention it
@tehseenullah215
@tehseenullah215 Год назад
you can do that by a separate Ajax call on your front end, uploading the image, returning its path, and then submitting it to the store route of your podcast .
@RicardoVigatti
@RicardoVigatti 5 лет назад
This presentation is amazing!!
@ЮраПрудской
@ЮраПрудской 5 лет назад
What if I need to generate multiple tickets for a concert? Where does it go? Also, what if I need to validate a voucher validity?
@ЮраПрудской
@ЮраПрудской 3 года назад
@TheGkmasta And what is the controller method for voucher validity?
@ahmedslink
@ahmedslink 4 года назад
Great talk. Tip1: Nested Controller? New Controller. Tip2: Edited independently: New Controller => (Updating profile image separately). Tip3: Touches pivot records? New controller and probably a new model => Subscription/Unsubscription Tip4: Transitions state? New Controller => Publish/UnPublish
@RoyShay
@RoyShay 4 года назад
Brilliant work. Thanks for this!
@Chavez3d
@Chavez3d 4 года назад
in my mind this begs the question why not Route::get('/resource/create', CreateResource::class) and let the invoke take care of the create action and just have actions as classes... with one public method and whatever you need for private helpers... Why even have a "resource" controller? I like this talk and the ideas in it... it certainly cleans things up but why not just take it to the extreme and make everything super-specialized...
@marceloAK1
@marceloAK1 2 года назад
Hi Adam. Great Video. I have a question, If you want to have the option to download the cover image of a podcast. Should I add the action in the PodcastCoverImageController? What should it be the name of that action? action "show"? thanks so much.
@bboydarknesz
@bboydarknesz Год назад
before I watch this, I thought this is going to be repeated code and just a man who try the best for SOLID and some hell with the best practice but damn! this is gold, this is a killer design, especially the pivot naming xD
@lakhveersingh1065
@lakhveersingh1065 3 года назад
wow, that was great explaination
@StandingOva
@StandingOva 7 лет назад
Great Talk! Makes so much sense!
@Dipenparmar12
@Dipenparmar12 4 года назад
Valuable .... content..
@roshimon6670
@roshimon6670 7 лет назад
Awesome presentation. Learnt something valuable :)
@ashikmehermobin9926
@ashikmehermobin9926 Год назад
That is the one technical knowledge sharing session about design patterns that worth priceless value.
@davidhernandeze
@davidhernandeze 4 года назад
Thank you Adam, you are always teaching me new lessons
@Paltibenlaish
@Paltibenlaish 4 года назад
if you have the logic for an action button like clear cache, where, if not the controller, do you put it?
@gustavovasquezveliz7046
@gustavovasquezveliz7046 5 лет назад
Amazing, i've learnt a lot
@JamesAutoDude
@JamesAutoDude Год назад
As someone on stackoverflow once told me... "Don't forget the single responsibility principle. Each function needs a single responsibility, the same can be extended to views, routes etc. For example, you have a controller responsible for submissions and a function responsible for editing said submissions." en.wikipedia.org/wiki/Single-responsibility_principle
@1973superpippo
@1973superpippo 6 лет назад
thanks a lot, give me a different world
@shahsawoodshinwari
@shahsawoodshinwari Год назад
The ever best inspiration to create more controllers as it costs nothing.
@Ribby00
@Ribby00 5 лет назад
I needed to see this! Awesome
@franzuaandrez5591
@franzuaandrez5591 4 года назад
Eres un genio! ;)
@fernandezjasper
@fernandezjasper 8 месяцев назад
I learned a lot!
@zkabadu
@zkabadu Год назад
Nice talk, even so I would disagree with the subscriptions and published podcasts resources. For me it would be /podcasts/{id}/subscription and /podcasts/{id}/publication and I don't have to pass the podcast id via the request body. I moves related stuff a lot more together.
@h0ph1p13
@h0ph1p13 4 года назад
Excellent talk! Thank you!
@johanneseriksson1929
@johanneseriksson1929 4 года назад
Such a great presentation!
@gojamoja6719
@gojamoja6719 3 года назад
Great work Adam
@webspaceadam
@webspaceadam 10 месяцев назад
Great talk!
@davendranaraine3263
@davendranaraine3263 2 года назад
I always come back to this talk. I've built my apps using this technique and it works perfectly. Thank you for this. @adam if you ever read this, do you still use this technique?
@AdamWathan
@AdamWathan 2 года назад
That's awesome, glad to hear that! I definitely do, it's really nice to have a system for thinking about routes and controllers.
@davendranaraine3263
@davendranaraine3263 2 года назад
Thank you! Keep up the great work. PS. Tailwind is awesome too!
@Aalii6
@Aalii6 9 месяцев назад
👍👍
@sandmanozone1657
@sandmanozone1657 2 года назад
This is a light bulb moment for me 🙏
@matejl92
@matejl92 5 лет назад
Great video. Did a lot of refactoring to my apps using your tips. But I was wondering, where do Single Action Controllers (invokable controllers) come into place?
@gustavovasquezveliz7046
@gustavovasquezveliz7046 5 лет назад
Invokable controllers needs no refactor
@BestHKisDLM
@BestHKisDLM 5 лет назад
Great talk. Thanks.
@bigollie006
@bigollie006 4 года назад
This was worth $1000
@bigollie006
@bigollie006 2 года назад
@@BenGearig once I'm not delivering food, I will. I still deploy all my Laravel apps on Forge and purchased the TailwindUi package to support the man even on my limited budget. Does that count?
@MrFranciscoooooo
@MrFranciscoooooo 2 года назад
6* An controller with 1 action only shouldn't have just __invoke()? @Adam
@Jossnaz
@Jossnaz 2 года назад
why would it? by using invoke, you let nobody know what the intention of said method is. Destroy? store?
@MrFranciscoooooo
@MrFranciscoooooo 2 года назад
@@Jossnaz now I don't remember my use case for this question :/
@FarazSamapoor
@FarazSamapoor Год назад
Simple, clean, and consistent. Excellent talk!
@bedramtamang1439
@bedramtamang1439 3 года назад
Re-watching again in 2021
@franzuaandrez5591
@franzuaandrez5591 3 года назад
Same here.
@arnaudlecat2913
@arnaudlecat2913 5 лет назад
Very interesting ! What if i have a "filter" method in a "PostController" ? Should i extract it to a "FilteredPostController" and rename it "index" in this logic ?
@andonovn17
@andonovn17 5 лет назад
Most of the times, you should be able to add the filters as part of the index action. If it’s mandatory to have a separate endpoint for some reason, then yeah a FilteredPostController with an index method is a good way to go imo
@ManuelBTC21
@ManuelBTC21 4 года назад
Holy line-height batman
@ahmadaziz1800
@ahmadaziz1800 5 лет назад
LEGEND
@joelfunu1480
@joelfunu1480 5 лет назад
great talk. How would you design an endpoint for search a resource though?
@juanpadilla8760
@juanpadilla8760 5 лет назад
passing get parameters on the /index method should be fine, shouldn't it?
@devaes
@devaes 3 года назад
NWA
@brianochieng5904
@brianochieng5904 2 года назад
Just Wow!!
@yinzhang7814
@yinzhang7814 4 года назад
It should be use PATCH instead of PUT method when update cover image.
@rizaldywirawan
@rizaldywirawan 4 года назад
what's the difference between PUT and PATCH?
@饶泽海
@饶泽海 3 года назад
fine line and a little subjective - but - patch is partial update, put is replacing the whole object - so you could argue that since his 'resource' is a PodcastCoverImage, he is replacing the whole object and therefore a PUT should be used
@AdisDurakovic
@AdisDurakovic 3 года назад
@@rizaldywirawan PUT when updating the whole object, PATCH when updating only parts of it, like "upddated_at" or "status", etc..
@harykamaro5986
@harykamaro5986 3 года назад
Great explanation
@elhadrami20
@elhadrami20 4 года назад
Very interesting
@paulselasiekitsi9195
@paulselasiekitsi9195 5 лет назад
This makes so much sense
@free2idol1
@free2idol1 2 года назад
Thanks for awesome talk. What if I want to call an api to check if current name of a user has been taken in the DB. What would be the best naming for that api end point? Is '/user/{name}/has-duplicate-name' ok?
@JulioCesar-hh9wq
@JulioCesar-hh9wq 3 года назад
This guy gives me some Joe Rogan vibes, great presentation
Далее
"Resisting Complexity" - Adam Wathan - Laracon US 2018
36:11
Adam Wathan - Curing the common loop - Laracon EU 2016
45:31
Matt Stauffer - Patterns That Pay Off
46:00
Просмотров 16 тыс.
Chasing "Perfect" - Adam Wathan - Laracon EU 2015
45:52
Being Competent With Coding Is More Fun
11:13
Просмотров 85 тыс.
18: You Need Tinker Time with Adam Wathan
1:31:07
Просмотров 1,6 тыс.
Adam Wathan - Tailwind CSS Best Practice Patterns
30:54
"Test-Driven Laravel" - Adam Wathan - Laracon US 2016
1:20:14