Things Laravel Made Me Believe - Jeffrey Way - Laracon EU 2015

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

It was a great talk. Ive always enjoyed his talks.

👍︎︎ 2 👤︎︎ u/rocketpastsix 📅︎︎ Sep 02 2015 🗫︎ replies
Captions
the title of my talk is things I've come to believe and just to make it super dramatic I said the battle for simpler code that doesn't necessarily mean anything but it sounds good um let me sell you on my site real quick it takes 30 seconds just deal with it I run a business called Larrick ass it's specifically for basically every single person in this room so you know there's lots of these sites these days when I was learning this stuff there was nothing right it was crap it was so hard to figure this stuff out now there's tons of resources but a lot of it is tailored for like learn how to make a website learn how to write CSS so Larrick asses specifically for people who already have a job but as we all know there's so much to learn you don't stop learning we're going to talk about that a lot so yeah if you have time check it out I'm just going to put this slide up here real quick do me a favor look up from your phones look up from your computers read this over and over and over now the website says it takes 60 seconds so just keep looking at that and reading it and reading it and then if you go home and you feel compelled to like sign up for a site that would be awesome I'm not going to judge you just go ahead and do it it does take 60 seconds so this is awkward hey okay I think that's growth hacking I'm not sure you're going to see some recurring themes in this presentation uh three things one care easily when we talk about laravel the thing that most attracted to me attracted me to it is this idea that an immense amount of care was put into it and I think most people would agree to simplicity simplicity is a metric that we just don't talk about enough we're very interested in design patterns and principles in architecture and that's great these are wonderful things but simplicity is a very important thing that we just don't seem to give much way to that's incredibly important and then finally distrust I distrust is actually a healthy thing for us if you're on Twitter and if you're like me you're just inundated with people telling you this is the way forward you need to use this acronym or this architecture style or this tool or this new framework it's overwhelming right and it's like the reality is you can't learn all of it so we have to have like a healthy level of distrust when somebody tells you you need to learn this tool take it in consider it but don't necessarily immediately adopt it I sometimes compare it to sand if you were to take a scoop of sand on the beach most that sand would come through your fingers right but some of it would say and I think that's that's kind of a good way to think of code so yeah like when somebody tells you this is the way forward just have some distrust take it in but have some distrust okay things I believe what's unimportant is paramount I have this hanging in my office this is one of my favorite quotes what exactly does that mean it just means it's very simple the things we think don't matter may be matter the most it's very interesting we'll talk about that a little bit next a simpler always wins and I say simpler because the reality is what would be considered the simple solution very much depends upon what you're building and the context and Constantine did a very good job of talking about that so we'll kind of talk about what that means generally it means the tool that's easiest to consume and the easiest to kind of figure out is usually the one that becomes more popular so I think when I'm building my own open-source projects what are some of these qualities that I can kind of steal from the projects I like whether it's like the fakir library or some of the laravel components how can I kind of steal these things and work them into my own projects next going in line with that this very much goes in line with that this idea that we should favor the API over purity if you're anything like me like you're trying to figure out how to use a tool you go to github you go to the readme and it's like you can't figure it out I've been doing this for 10 years and I still like you're reading the readme and it's like I don't even show me the HelloWorld I can't figure this out you're telling me to like new up six different objects and it's complicated and hard it's very frustrating so in these situations I feel like they're favoring maybe like architecture or or purity like we would sometimes say over the user and I feel like the user should come first every single time next be honest about Scoob this is a great one it's important like we always end up battling on Twitter you know so if you're on Twitter you see these battles take place and once again Constantine kind of pointed out that sometimes we're battling but we're coming from vastly different perspectives I'm working on this small thing you're working on this large thing the requirements are they're completely different yet we act like they're the same and the worst thing is when we say this way that I'm doing it is the way that this junior developer this guy working on his first blog should write his project and that's when it gets kind of tricky next focus on the fundamentals a story time so actually I've only been coding since I was like 19 that's when I got started into it I wish I was the twelve-year-old you know a lot of 12 year olds or will follow me on Twitter and I'm just so impressed by them because they will be so far beyond me by the time they're 30 so that's great um but no when I was 12 years old the plan was to be a guitar player I was gonna be the rock star right I went to a music school I played five hours a day I went to college on a music scholarship by all accounts that was the plan right and then I decided I'd like to make money so I switched to programming right but when I was when I was um I'm studying guitar and I did this seriously I wasn't just some kid in a garage I did this seriously right well I left Rock so I play along with like ac/dc on ac/dc I think is one of the best fans ever by the way we'll talk about that more in a second and I would play along but I wasn't quite good enough to play like Angus does but that's okay because you just turned the distortion a little bit higher and it muddies up the notes so you can't hear how off you actually are but yeah I would do that for years and I got better and better and better and then at one point and I wasn't calculating when I did this but at one point I went back and I started focusing on the fundamentals of guitar and music because most of us don't you learn the basics and then you immediately move on and you want to do the flashy stuff right but I went back and I focused on even something as simple as playing a scale but just playing it perfectly playing out where there's not an ounce of noise between every single note this is actually very difficult and most beginners never actually learn how to do that they just learn the notes and then they move on to the next thing and what I found was when I went back to these fundamentals it made me a significantly better guitar player and I found the exact same thing is true with code where sometimes like we want to learn all of these fancy things it is cool right everyone in this room we're here because we love this industry and we love learning new things and new ideas and new concepts but from my experiences sometimes it's better to not learn that new cool thing and go back and focus on the fundamentals of writing clear simple code the fundamentals of writing database design right these are things we sometimes learn but never fully learn so I think there's a lot of value on that and then finally things I believe let's just build things so often we are we are I'm going to say we but I assume you feel this way we're terrified to release code because some jerk on reddit is going to make you feel like crap because he's decided well in this book on page 122 it says you shouldn't do this thing and you did that thing so I'm going to call you out on it right and so you're kind of terrified to release your code this whole concept of imposter syndrome which Jessica was an amazing talk which he talked about it all kind of relates to this so yeah and here's a picture of a Miss young this is how cool he is in front of a hundred thousand people I'm just going to let you look at that he lives in the Netherlands sucking up or anything but anyways okay um you know writing software has become really hard I think we've learned that in the last couple days because many speakers have referenced it really hard and I don't say this to like complain I don't say this to whine it's just a reality it is overwhelming when you think about how many things we have to learn I'm going to show you but um excluding this conference which was very nice in general we just don't talk about it very much you know we talk about ideas we talk about culture but we don't just talk about the fact that it's so much to learn and maybe I'm exposed to this a little more because I run lower caste and I'm always talking to people who are just now breaking in to the industry and I'm seeing what they and you know we had the the tendency to forget just how hard it really was and when I think about it for myself like if I knew how deep the rabbit-hole actually goes in terms of what you have to learn I'm not sure I would do it again because I've been doing it for 10 years right now every single day and I still am very aware of how much I just don't know anything about it is a ridiculously tough industry so I think we're all just kind of quietly overwhelmed right we all feel like the dog who has no idea what he's doing and what's funny as you laugh this has been around for years right you laugh because it's completely true we all just kind of feel that and we we represent that we know everything right but we really just have no idea what we're doing if you work in one area of a business and this is your area of focus you can probably tackle that but especially for those of us who are just doing everything ourselves or you're trying to go out on your own you have to know how to do everything at this point and that's really tough and the tough part is as much as we feel this way and everyone laughs everyone laughing feels this way right we have it in our heads that everyone else just knows everything they're doing right they're doing perfect TDD or BDD they're taking it slow they're doing it right it's just perfect right and know from what I've heard and from what I've taught from the people I've talked to know these people whether they admit it or not at some point just feel exactly like this because it's impossible to know it all it's just impossible and the worst part is we can be honest with our friends and with our team members but especially when you go to a conference and you're talking to people you don't know you sometimes have this I don't know we shouldn't do it but sometimes you feel like you need to blend in and whenever when everyone is talking about this general concept well you can't be the only one who doesn't know what it is right so what you have to say is why of course I'm familiar with temporal databases I only use it every day right yes I'm totally with you guys on this conversation right it reminds me of Homer now we're going to run a few tests this is a simple lie detector I'll ask you a few yes-or-no questions and you just answer truthfully do you understand yeah all right I feel that way way too much I hate it but if you think about it I'm not sure it was always this way I don't leave wasn't all this way in the web world at one point HTML and CSS were learner Bowl you couldn't do much it didn't have any behavior but you could figure it out right it was kind of a crappy site but we all did it you could do it but now it's a little bit different I've prepared for this so get ready we have a few slides to cover yes we have to learn HTML and CSS right it's the bedrock okay we can do that but you know what CSS is actually frustrating and when you just want a grid that works in every single browser it might be nice to use a framework so let's figure out bootstrap and foundation you'll probably toy around with both okay but wouldn't it be nice if we could have includes and and variables in our CSS it doesn't support that natively or at least not in a way that we can use right now so let's figure out sass less or stylus or something else that's coming up soon cool but you know what it would be cool if we could have a little bit behavior right so we need to figure out JavaScript JavaScript kind of sucks it's way better now than it was back in the day but back in the day it was just frustrating right so we're going to do that okay cool but now I'd like to be able to change things and have them reflected on my server but we don't even really know what a server is just yet we'll get to that in a minute so we need to learn Ajax but you know which is Ajax vanilla Ajax especially 2008 Ajax whoo hard stuff so you know what why don't we want a framework like the UJS or ember or backbone or react but you know what I heard a new frameworks coming out next week so scratch this off the list and learn that one instead cool so we've submitted something to the server but what is the server we need to learn a language like PHP or Python or Ruby which one you'll probably end up using all of them those are going to take you years and years to learn great go ahead and do that okay so now we want to persist this data right so we'll probably use SQL but there's lots of options so we need to learn that language and that will take it to take some time to learn as well cool but now at this point we still just you know right above the doctype in your HTML we're just doing all of our database queries with PHP right we can't do that we need something that provides a little bit more structure so let's learn a framework like laravel or symphony or CodeIgniter or whatever comes out next year that will take years okay so we don't want to reinvent the wheel right so we're going to use composer we're going to go and use packages so we're going to go to github and try to figure out how to use those packages okay that's good next we're starting to feel good but you know what I'm going to bring you down a notch do you really understand object-oriented programming most of us learn how to create a person class but it takes a long time to really understand what it means in this idea of messaging okay so do you understand inheritance and composition and polymorphism and encapsulation and interfaces great job let's move on to something else what about the command line right Jessica was talking about she doesn't really like to show others cuz she doesn't feel that comfortable with it totally understandable but you got to learn it a little bit okay we'll do that well you know what it would be nice if we had some version control right because right now when we finish a project we just kind of create a backup and we call it project complete and then we realize it's not complete so we copy it and paste it and rename it to project complete for real this time we don't want to do that right so we need to learn git and as we learn today git can actually be pretty complex and next we want to share our code so we need to use github and figure out all the jargon associated with that let's learn that next BAM we're working on our production server at the very least you need to understand some basic commands and you need to understand that there's different modes when you come when it comes to them excuse me this is hard but also you may decide that you want that to be your main editor right I used them for many years you will get a huge benefit from using it nonetheless you need under and the basics okay next wall Apache nginx what's the difference you're probably going to end up using both so make sure you figure that out and then what about when it comes to building up servers right that's kind of confusing we want a virtual machine this is hard I don't know what I'm doing why don't we figure out vagrants okay but you know what vagrants kind of hard so it would be nice if we had a wraparound vagrant like homestead to make this easier cool could we do the same thing for production sure let's use Forge all right we're figuring all this out give me just a minute to catch my breath we have a lot to cover we got more to do okay two more slides MVC now do you understand MVC or do you understand kind of the web version of MVC which actually is an MVC but does it matter who knows or what about NB star and every iteration of them V star you need to figure those out or you're not a professional developer okay namespacing okay it's kind of new to PHP do you totally understand it you understand how that works with psr-4 autoloading if not take a minute and learn that what about regular expressions that's a whole language in itself do you understand the difference between a star and a plus and a question mark you need to understand this so that'll take many many months go figure that out what about testing move you're not a professional developer unless you're testing right so you need understand well which framework to you use right PHP unit or PHP spec or code section or behat or some other tool I'm not thinking of right now make sure you at least at the very least try out some of them and the reality is you'll end up using a few of them and we haven't even talked about the jargon that's associated with it which is completely overwhelming in the worst part is nobody actually agrees on what these terms mean okay five years easy design patterns right these are great these are common solutions to common problems the issue is when people try to apply them way too early the reality is you want to refactor this you you want to use design patterns to refactor and if you decide you know what this actually isn't better than you refactor away from them that's how it works but people try to apply them too early and then they try to enforce them on others okay well at the very least you need to learn this stuff okay what about security surely you're not storing passwords in clear-text right I know a business that actually did that I worked for that business we'll talk about that later okay what about architecture right I wasn't responsible for it so it's okay what about architecture everyone talks about architecture we don't really know what it means we just kind of have this basic idea take some time to learn that that's going to take your whole career okay what about command bus and CQRS and then storming an emergent design this is all great stuff but it takes a long time to learn and then you know if you're kind of go out on your own you need to have a basic understanding of the UI you don't have to be a designer but you need to know what you're doing right so UX user Psychology chrome dev tools you need to optimize performance okay that will take quite a bit of work now what about the acronym avalanche like PSRs and crud and rest and active record versus data mapper and ADR and TDD in BDD and DDD and DDD again and solid and then before you know it the reality is everything I covered on that list doesn't amount to half of it and we all know like that stuff is we kind of need to learn it to some extent right and if you haven't gotten to some of those items then you will in the next few years and after you do your best and you've been working at this for years upon years you release some code and of course these kind of reddit comments come up yeah that's great but does it scale scale I know you said you know solid but I'm looking through your code and your code does not follow solid so what are you doing why are you even a coder all right this is hard and people will just knock you down right this is a real quote stop building things your code doesn't follow SRP that's a real quote on reddit screw that guy right this is hard stuff and when you release code it's kind of a vulnerable thing right at least it is for me I don't know how it is for you but it feels like this right it feels that way to me we're all completely vulnerable and open to influence because you can't possibly learn everything so you're doing your best and we think to ourselves if only I can somehow conform to this doctrine and structure my code in that specific shape finally I'll have achieved maintainable and proper code because that's all we want there's this notion that some people are just contractors and don't give a to be frank and then there are these other people that want to do everything right and that's not true at the end of the day all of us want to write good code and we're just trying to do it as best as we can and so much of this comes down to personality I've really begun to learn that but still we want to know the true way we think if I can figure this out maybe finally I won't feel so out of my league and posture syndrome will go out of the window and I will know exactly what I'm doing that would be the one true way and I will be a professional developer and that will be great and I've done this for 10 years and everything just tells me that that idea of the right way to do it is complete BS because it all depends upon context and here's the worst part the worst part by far even if you follow all these rules your future shelf is going to crunch it would you've written today it's never not been the case how have you ever looked at code you wrote five years ago and thought wow he nailed it no it's never happened because the industry moves so fast you can't keep up the code I wrote and ten years ago I can't even fathom what it looked like right or here's here's another example consider this CSS most CSS best practices of your ten points to Gryffindor for using your in a slide are now complete anti patterns think about that you learn this in 2007 great job but it was all wrong right because we decided well you know what some of those best practices may not be best practices I'll give you an example IDs right back then 2005 or so back then apply ID to your HTML and that way you can target it and it doesn't affect the styling of anything else on your page and use an ID that very much refers to the site that you're building right and what it refers to people don't say that anymore now people are saying well you know what that's not reusable it's it's it's very much connected to the thing that it that it wraps instead you should use classes more in fact you should use IDs very rarely another example would be the cascading nature of CSS everyone said that's the the beautiful thing about CSS is its glorious cascading nature and then after years and years people start to think well you know what maybe not maybe that's not so great so best practices change so when people kind of reference best practices all the time it's like what are you talking about it keeps changing best practices are constantly evolving so I think about this a lot and I've decided if there's like some secret sauce what would it be like if is there one see because that's all we want is everyone just wants to know what is the secret sauce to make a million dollars right or in our example what's the secret sauce to be a good respectable developer it's got to come down to simplicity when I think about it just everything in life that is perfect usually boils down to something that's very simple everything from finance to your relationships to something as simple quote/unquote as a perfect circle and that's the interesting thing don't confuse simple with basic or easy this is what a lot of people like to do is I go that's great for tiny stuff but for anything of size well you're going to fall apart no that's not true writing simple or simpler code is incredibly complex and again I say simpler because it entirely depends upon the context of what you're building and sometimes the simpler option actually does involve a good bit of complexity and that will pay off in the end but in other times that's not the case okay so writing code we decide is like extremely difficult when I think about this it's what I've been working on my entire career just trying to write clear code that I will respect in a few years it takes hard work and sometimes I fail right sometimes I totally feel like Tom Hanks and you've got me on write worried you're like why can't I get this you ever like work on projects and you're having trouble with a thing and you're really mad at yourself because you should understand this but you don't and you get really frustrated with yourself because you're way too much of a senior developer to be screwing up on this area right nobody says anything so it's just me but sometimes I get so frustrated where I want to do that right and that just means take a day off you'll get it tomorrow okay let's connect to these themes okay it's frustrating but we need to figure out just what we should strive for or at least what I would strive for we're going to talk about things I've learned from unrelated industries I think this is very interesting Taylor talked about this yesterday where you take different industries and you figure out what can I learn from them and apply to this completely unrelated thing I code I'll show you a few examples of that next I've learned so much from the laravel user base specifically people who get excited and write books and write articles and it's interesting when when you're attracted to a tool and a different person's attracted to a tool it's good to learn from each other right so certainly I've learned from them the developer evangelist there's so much to learn people who naturally do this for free a lot of times they move in to it being a paying gig but so many people will just naturally promote something for free and I love to learn like what is it specifically that attracted to you to this and once again how can I apply it to my own projects and definitely yeah there's so much to learn from the haters this always surprises me right I always think to myself like why do you hate this tool it's a tool right it may not be your cup of tea great but why do you hate it why and I remember one time on a podcast it must have been the laravel podcast I said something along the lines of do construction workers like battle each other over which hammer is better and I said it because clearly the answer is no they don't right so I win I win the conversation as it turns out a week later I receive an email from a programmer who used to work in construction and he said yes Jeff they very much battle over these things right so maybe maybe that that that's good to know no matter what the industry if you're really into it people are just going to battle each other and that's okay right because everyone nobody like we're not bringing out pitchforks here at the end of the day we all share more in common than we don't but there's still a lot to learn from the people who really hate a tool why and is there a specific reason for it and can it teach you more about the type of developer you want to be okay so let me show you a couple examples of care but we're going to start without code we're going to reach outside of software development when I think about care I think about like everything I like or things I'm really passionate about usually boils down to the fact that the creator's put in a massive amount of care into it something as simple as like a perfect Nintendo Zelda game those things are so special because they take five years to make they have no bugs they are perfect those are really special things at least for me when I think about a book for example is anyone here read the Martian wow not many people the Martian is amazing the guy who wrote it fun facts used to be a programmer and now he's of course a full time writer and what's interesting about that is so it's so mathematical in that book and the cool thing is so much of it is real like he actually worked out these equations he didn't have to he could have made them up on the fly and 99.9% of the readers would have no idea but he didn't he actually worked out everything whether it's like alright earth is talking to Mars we need to figure out on what dates that would be most optimal and things of that nature that's very interesting to me so much care being put into something that most people don't notice Pixar is another example I think Pixar they are brilliant I think they finally hit that you know do you ever go back and watch kids movies that you loved as a kid and they're so bad like you can't you can't even get through ten minutes of it Pixar it's like they've hit that chord where they make a kid's movie that the kids love and the adults love on a completely different level can you imagine the amount of work that goes into that to find that balance and what's interesting about Pixar is one of the heads John Lasseter he's also directed a bunch of the movies like cars and stuff he has this phrase that he says to the designers and developers and the people who work on these movies he says sand the underside of the drawers I love this quote stance the underside of the drawers what exactly does that mean the way I interpret it at least is focus on the things once again the things that we think don't matter maybe matter the most so in this case why do I sand or paint the underside of the drawers nobody will ever see it don't waste your time on that right that's just stupid right that's so bad use of your time don't do that and he says do it I think that's really interesting and the way I interpret it is if you're focusing on this thing that doesn't matter imagine the care that you're putting into the things that do matter maybe the things that don't matter matter most here's another example inception I love this movie so much has anyone here seen inception good okay no spoilers any no spoilers beyond what you would see in the trailers okay I think Inception is so good if you just saw it once and you thought okay fine if you think of the ending and you thought the ending was really important it actually wasn't now the cool thing about inception is it is so much more complex than you probably think it's so complex to the point that entire books have been written about it where people just try to explain what the heck was going on in that movie people love to debate this and I think it's okay to share this with you because it's all ambiguous there is no answer so it's okay to show you what some of these people think now in Inception just quick recap it deals with this idea of people hacking into the minds of others in extracting information from them or hacking into their dreams so you can extract information from them that they wouldn't normally give to you right when they're away very cool stuff and when they're in these dreams you can go multiple layers so like geeks like me just think this is the coolest thing right you can go like a dream within a dream and a dream within a dream within a dream and time moves differently so ten years down here is like a week up here I just think that's cool I love movies where I have to research it for like weeks after it to fully understand it and I'm going to show you the coolest thing that you probably never knew about inception now when they're hacking into these dreams they play this song in their ears so as they're dreaming they play the song and the way it works is when that song is finished playing that is their cue that the dream is over they're their medication that stuff is about to wear off that's keeping them asleep and they're about to wake up okay so here is the cool stat the length of that song that plays is 2 minutes and 28 seconds okay the length of Inception the movie is 2 hours and 28 minutes and 0 seconds this is not a mistake and think about that basically everyone who sees this movie doesn't know this that yet he still put care into it he still took time to work this in even though basically everybody will never notice these are the sorts of things that really inspire me and what does it mean maybe it means the song is I'm sorry maybe it means the movie is over so the drain is up maybe it means the guy was dreaming the whole time maybe it doesn't right and that's why I'm okay not spoiling anything for you because it's entirely ambiguous and for any movie that deals with the concept of dreams people love to debate was he dreaming the whole time was this a dream was this if you think of a movie like Total Recall the exact same thing was he dreaming the whole time it's fun right I'm very fascinated by the level of care that goes into something like this I think it's really cool in terms of code what would that look like just focusing on things that seemingly don't matter but they do matter maybe it's as simple as just things like beautiful comments taking time to focus on things that literally no one else does right this is from your routes file it's kind of like a letter to the user of the framework right perfect flagpole comments and anyone who's used laravel for any period of we'll know this format where each line is three characters fewer than the one that came before it three lines each line is three characters fewer than the one that came before it and you see this everywhere in laravel in fact you don't not see it anywhere in laravel it's followed everywhere from here here quick note on this actually some people would say like comments are in an T pattern and what they mean by this and it's totally valid what they mean by that this is if you need to add a comment to explain what it is maybe some condition does then what that means is you didn't describe it in your code and your API well enough so instead you should refactor usually like take your condition refactor it's that a method I'm sorry refactor it to a method that's readable and then you make the comment redundant that's great advice what I've found though especially in this case I think that's the container class with laravel when you get to that low level it's really complex stuff so it just gets hard even when you do your best and further specifically for a framework you have to explain this not just to yourself but to every person who may want to contribute to the codebase so it's really important that you describe exactly what's going on here I think that's wonderful here's another example here's a configuration file laravel has the best configuration files I've ever seen I've used a lot of projects where you check out the configuration and you just can't understand it because they don't it's very vague and you're trying to figure out what does this do and you just have to do trial and error that's never happened with the laravel configuration files so this is something I completely stole and just applied to myself you don't need to read this it's just the idea of making it perfectly clear what it does for the users it's putting the user first in other words another example is as simple as just finding a way to import your classes and making it look as attractive as possible it's so trivial right yet it on some level I think it makes sense I think it makes a difference on some microscopic level as I was researching this I was just googling and I found this Stack Overflow thread I promise I just randomly found it and it's dated July 8th 2011 and as it turns out Larry veau was first at least committed to on github in June so this means soon this is what he was working on and quickly to paraphrase he's basically saying sometimes I just spend ridiculous amounts of time agonizing that's a keyword over making code look pretty and he's basically saying I'll scan the file and I'll just see if anything kind of pokes out at me and am I wasting my time and am I being OCD this is interesting to me because when I look at laravel it very much seems like Taylor's OCD and I think in the best possible way he is right I'm very thankful that he's somewhat OCD but you know what maybe we all have to be that way here's the top reply to that if you're spending that much time manually editing code I'd be willing to guess you're not very challenged because there's absolutely no reason for it and he continuously listen man it's good to have pride in your code but not when it comes at the expense of being smart just stop being so stupid Taylor it's basically what it translates to is very condescending right now what's interesting to me about that is he's right right and then it is important to note like agonizing over code when you're on company time it's like that's kind of a different thing so I totally get that when you're on company time you have different priorities you have different commitments you have to worry about those things but when you're on your own projects and when you're working on your own open source rules can be a little bit different so I do want to point that out what's interesting to me about this this reply though that everyone liked it had 100 likes I feel like they totally missed the point and what's most interesting to me is the thing that most attracted me into the framework is the fact that some of these kind of OCD things took place right and once again made me think wow he's putting so much care into this I want to check out what else is going on here right once again the things that don't matter maybe matter most once again we're sanding the underside of the doors it doesn't matter it doesn't make it different yet it does make a difference let me show you another example it's very basic controller from the laravel four days maybe some kind of flyer like a brochure when you create a new flyer you call flyer creates and you redirect flyers okay fine it's fine you know basic project it's okay what's interesting though is when laravel was being updated to version 5 as you may know controllers become name became namespace for the first time so laravel 5 introduced PSR for autoloading controllers are now namespaced which is great but one one worry I personally had as a user is well we have these level facades and some people hate them but I kind of like them to be honest at least for the scope of what I build kind of like them but now you would have to add a use like in this case for the redirect you have to say use redirect at the top in order to reference it and you're probably thinking like who cares dev it doesn't matter if you use any IDE or editor worth its sold you can do it automatically right it doesn't matter stop focusing on stuff that doesn't matter that's the entire point is like on some microscopic level it matters and you'll have to do that for any other reference you have to pull in so I like to think of it in terms of like mental debt right we talk about technical depth I like to think of mental debt of just consuming a class and every time you add just one more use statement it adds like that much more mental debt that's what I actually at least how I like to think of it so I remember talking about it and hailer said what maybe I had a redirect method on a parent class this is pretty common in frameworks and you reference that and you're good to go right yeah I would be fine but I don't think it's quite as good you know it's the same but it's not the same it's not quite as good so instead a handful of global functions for redirected - global functions the world's gonna end I think it's okay I think it's kind of awesome right I think it looks good it's not for everything but it looks good that's how we solved that and once again it's an example of making user happiness the first priority even at a microscopic level in terms of agonizing over just like how does this feel will I be annoyed when I have to use this yeah a little bit so maybe can I a ghen eyes over this and find a way to make it just a little more user friendly and so many people would say it's bad so many people would say it's bad and I feel like once again sometimes incredibly smart people including all of us including me have the ability to offer really bad advice because like ever said noted so much of it is dependent upon the scope of what we are personally building and what we are personally building and we forget that other people have just entirely different requirements right so you have to be careful about that it's okay once again to be to be honest about the scope of what we're building I think that's really important we're neither words the only truly dangerous thing is our ability to be disgracefully overconfident about the things that we barely understand that's one thing that annoys me is when people are so incredibly a confident about saying that this is so much better than this and when you ask them like why is this better usually it ends up being pretty abstract usually it's like well if you look at page 123 here then it shows once again that that's not that's you're not supposed to do this so why are you doing that right it all just ends up like people regurgitating from what they read in a book six months ago that's at least how it feels to me theme to simplicity we're starting to figure out kind of like once again I'm trying to figure out what would be special about laravel that makes it so incredibly popular years ago I think less than a hundred people went to alaric on now we have way more than that what is it about it that attracts it and how can i once again apply that to my own projects and I think it ultimately boils down to beautifully simple api's that put the user first the types were like you read a page of documentation you got it you understand exactly how to use it think how rare that is at least for me it's like I want to use this and it's so complicated with some of these components with laravel it's like okay got it read some documentation that makes sense I'd never use cues in my life but now I suddenly know how to do it because somebody cared enough about me to make it that much easier to consume very interesting so when you wonder like why people seem like crazy excited about something right when it's like oh geez back off it's a tool why are you so excited about this usually boils down to the fact they've been trying to figure this out and they couldn't do it and then finally they find some kind of tool or some kind of library where it just makes sense right and there's so many examples of this the fakir library the intervention library where just things just make sense it's so nice when you find an author who understands the user simple natural intuitive api's and when I think about myself that's one of my biggest mistakes all right is I'm building something and I'm focusing so much on the solution I just need to figure out like I have to do this and this and this to get it to work and I'm focusing so much on that means and I'm giving no attention whatsoever to how it feels to use and is it any wonder when I finally get it to work that it just sucks right because I didn't think about that I was just focused on the solution not how it feels laravel has so many of these in recent memory or at least as much as we can cover in the stock scheduler and laravel cashier we're going to go through these very quickly they're not to teach you them they're just to show you just how nice and natural they are if I wanna every single day at 11:59 trigger an artisan commands that's basically what I want just notice it's it reads exactly the way you would want it to or if I want to execute a terminal command or maybe it's something as simple as I just want to delete some ancient user events in my database or something pretty simple call this every month that's exactly what you would want so you write the API and you describe in a perfect world how would it feel to interact with this and then you just write the code to make that doable and what annoys me of most about this guy is he's the one who made it right he just holds hot dogs and writes code right it's kind of kind of annoying right I had to get them back for them anything you guys don't like it okay another example would be cashier right we've already covered this but just it's when we get beyond our ideas of what what write code is and how it should be this is kind of what you would want right if I just want to create a subscription that's what I want right so write the code and make it work or what about when you need a coupon well we don't call it set coupon we use with coupon because that's more natural that's how you would speak it and then you make it work if I want to swap to a different subscription then why don't we have a method called swap right it's amazing how just natural and obvious this is and when we try to implement these things on our own it's just so hard at least for me it's like I think I've made it simple and then I realized on the line like COD you weren't even close you were so far this is so complex it's agonizing over making things as simple and natural and intuitive as possible and that's why people get excited because it's really hard and most people can't do it and when you find a handful of people who can just make your life easier you get excited right like Riker here's how you would download an invoice and a quick aside on that actually a lot of people would say that's really bad for him right where a lot of people would say in this particular case the invoice class executes a little shell script or something and that we can't have that because that violates SRP and we can't do that so we need to call each other out on Twitter to let them know how screwed up and how bad they are all right this just annoys me can we just please for the love of God stop calling each other out on Twitter and making each other do we wonder why we all have some of these issues right and so many of the people I talk to to kind of feel the same ways you're constantly being called out when you're just trying to do good work right and it's like design pattern violation who says that it's not a violation their ideas they're their options right I love this quote it's perhaps impossible to avoid being patterns happy on the road to learning patterns it's very true for me might be for you so once again we're just focusing on with these books a and we're focusing on purity and architecture or whatever that means and we're not focusing on just user happiness and simplicity I'll show you another example this came out after the previous layer akan somebody wrote this in their blog and they were complaining that this was so bad once again you don't know what the context is you don't know what this project is so how is it bad right and of course what he was suggesting is this is the proper way to do it right instead well let's let's go with one at a time user finder fail ok there's there's a good argument to be made that you can wrap that in a repository it gives you a lot of flexibility you can decorate it especially for reads when you're using eloquent that's actually pretty useful but ok so we're going to switch that over to a user repository but you know what user repository is in a concrete class because we can't do that we learned we have to flip the dependencies so instead user repository is an interface and then we create an implementation and then we bind that implementation to the interface and then we inject it ok so now we're doing better right here's another return view and it's just a simple helper function where we load of you know we can't have bad we need to we need to isolate so instead we inject the view factory into the controller and once again but the dependencies it has to be an interface right so that's what we're going to do and now in the show profile method this is the right way to do it I guarantee there's a lot of people in this room who so yeah that's way better once again it depends upon context but let's just break it down is this better than this is when I look at this just just in the fact that the text is so much larger in this slide but is this better it's definitely testable it's definitely testable you could unit test this so easily so yeah okay is that the only metric though is this better kind of like that right my wife doesn't know anything about code she could read this you'd kind of understand it interesting what I would say about this is you have to fight for it I sometimes say guilty until proven innocent about these things you have to really fight for why you need this and if you have a good argument then then great you should do this approach because your project requires it but otherwise as a default this I think is pretty good I don't think it's that bad but once again this is the the proper way to do it okay so that brings us to our next theme distrust and it kind of leads into this one be open we should all be open you should take in as much as you possibly can but there's no choice but to have a healthy level of distrust right you need to be convinced and I'm going to show you an example of this using laravel elixir which I helped build many people thought and maybe still do think that laravel elixir was like a really stupid idea they would say why would why is laravel including this just use grunt or gulp well you know don't be stupid once again don't do this if we had listened to them this wouldn't exist and I think it's kind of cool for a lot of projects once again it's not for everything but it's not supposed to be for everything right that can't be your metric for everything your metric should be like the 80% use case or the 70% use case now why does the lick sir exist while show you a tweet from today from Remy sharp if you're not familiar with him he's a JavaScript developer and a very well-known in fact and he was saying today whenever I say you don't need the complexity and building sites I'm always asked about well how do you minify an and prefix inversion and all of these other things and he went on and he said the time taken to just add a couple CSS vendor prefixes is way way faster than the time require to add the bit build tools to automate he's right right we sometimes forget like yeah the build tool will automate it but you are going to spend hours upon hours upon hours learning this tool and researching it you know you do gulp is so great it's a lot easier than grump grunts in my mind and it still takes a long time to learn how to configure this stuff I think elixir should exist because of these two tweets because you know what it's not faster to add those prefixes than it is to use elixir here's your main gulp file in a laravel app and I'm proud of this because we worked really hard to get it like this here's how you would use it and what I love about this is just think at the end of the day this is what you want you end up having to write this for most projects right with gold and gulp is great by the way elixir is a wrapper around gold with gulp is fantastic but still you create that and you copy and you save it to a gist because you just copy and paste it to every project you're working on and it doesn't really describe it it's just thinking in terms of the solution I'll have to do this and 500 lines later I'm done and I have to research it and once again this has nothing to do with what I'm building but I just have to put energy into this right this is what I want I just want to I just want to compile sass I just I like browserify and just want to cache flushing files that's what I want yet I end up writing this so I'm going to show you how we went about building this this was an initial idea no production code had been written but we thought okay maybe I can figure out checks okay that might work and then Taylor submitted this one to me and now what's interesting about this is that it says straw dots it this is maybe the number one thing I've learned from laravel is this single thing I've never told him this strata at sip zero production code had been written but it was already being branded laravel straw now I honestly think now it's kind of kind of silly but still it was being branded before any code had been written it was been being given a name and is it any wonder when you use laravel and it just feels like so well branded right so many of the the different tools and packages it just feels like wow this is really nicely branded it's because it's being focused on at step one instead of once you finish the project I think that's really interesting so we decided we have to do this we went to work on it I had the wonderful idea that I would call the argument please and I would say please use less and run these tests good sir right that was a great contribution I'm joking by the way you guys don't laugh much okay so we got it to this point yeah it's getting there it's still like if we're thinking about mental debt that area at the bottom tasks which we could get rid of that and then please combine scripts hmm and then we're adding the full path from the project route if we agonize over it I think we can make it better so instead we were able to get rid of the test at the bottom so if we can get that away from the user that that mental death is no longer there great and so we are still worrying about the API because it just didn't feel right so Taylor said let me type it in a file and see what it looks like and this is exactly the way it should be right whether you're using something like PHP spec and you're starting from scratch or you're just creating an empty file and you're seeing how would this feel to interact with and is it any wonder that when you start with that stuff it turns out so much better and once again I continued with great recommendations like we call the argument hmm so we say straw that sittin I taste this ass I'm very wise no I'm just kidding so straw wasn't right but it got us on the idea of thinking of drinks or a wine or potion and eventually it got branded as laravel elixir and i'm very proud of this because it was so hard to get to that point or in other words agonizing over that agonizing over just making that as natural and intuitive as possible always pays off I think and most people don't agonize over it and it's pretty obvious but yeah plenty of people just felt that laravel elixir was kind of stupid and then dangerous that common key word and I'm glad we didn't listen to them as soon as we really still like sure this was posted on Twitter once again these people just exist it's a shame you know you want to say like you guys got to go right you just can't be involved because you play well with others laravel thinks developers are too stupid to learn gold because clearly that's what we thought we thought everyone is too stupid to learn gold so we have to make it easier no it's not even remotely true it was in response to those tweets that Remy sharp made because that is completely true it's a lot of work and especially if you don't work in that area it's a lot of work and we have other things to be focusing on we're trying to build a product here the code is a way to get us there at the end of the day hopefully we're trying to build a business and a product here that's the number one thing the code is just a way to get us there so can we make it just a little more natural once again really smart people can offer really bad advice and they do it sometimes in an arrogant way where you just they kind of make you feel like you're I can't understand why you would do this right that's kind of how they make you feel it's okay all right let's finish up you guys were ready for me to be done things I strive for care really focusing on care and things that you think don't matter maybe they do right focusing on simplicity and simplicity as it relates to the scope of what you're building right and that will be very different depending upon what you're building so it's important to just always ask yourself is this the most clear way I could build this and then yes obviously distrust a healthy level of distrust that doesn't mean going to your corner and just decide this is what you do and everything else you'll push away no let all of it end but have a healthy level of distrust so what's unimportant is paramount simpler always wins we have so many examples in terms of popular popularity the tool that's just a little more natural that favors the user a little bit more wins in terms of popularity every single time and this goes in with that idea of favoring the API over purity being honest about the scope of what we're building and what the requirements are and focusing on the fundamentals this is huge go back and really learn those fundamentals that you think you know but you might find that you didn't learn them as well as you think and then yeah let's just build things that's all we're here for you're going to get better we can't be terrified it'll release code just build things release it do it as best as you can you're going to get better you're going to do another project that's the way it goes for all of us but yeah trust no one including me these are just my ideas unless they are also yours thank you you
Info
Channel: Laracon EU
Views: 128,460
Rating: undefined out of 5
Keywords: php, laravel, laracon, amsterdam
Id: mDotS5BDqRM
Channel Id: undefined
Length: 54min 0sec (3240 seconds)
Published: Tue Sep 01 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.