Join me while I learn HTMX and talk at you about it
Twitter: @htmxlabs
So this is just a thought I've been having recently, Not just in development world and in code and in HTMLX and in all this stuff, but also just in life and the rest of my life. It's to stop taking shortcuts all the time. And shortcuts and I don't even mean, like, doing things the hacky way or something like that. I'm talking about like even efficiency. You know, this is like a developer drive to make everything efficient and to find the most efficient way to do everything.
Lazarus:And usually, that's a really good thing. That's a good instinct. It's a good thing to kind of it's part of what drives developers to build the things they build and to make them better and that's all a good thing. But you know this is just kind of some recent stuff I've thought about and it it's basically that it's okay to do things the long way. The more maybe the more inefficient way.
Lazarus:And okay. So so one of the things in life that I would I would say this goes with is cleaning your house. So there's a kind of efficient way to do this in my mind, and everybody probably does this different ways. But, you know, you can, like, you look at your mess, you just take everything, you organize it into all these piles, you just sort of sit in one place in the room, go through all your items, organize it into a bunch of different piles. Once you have the piles, then you can maybe, you know, sub organize it from there and then put everything you know, where it needs to go.
Lazarus:You've made sort of minimal, moving around. You know, it's a it's a kind of an efficient process. I think there are some issues with this process. For me, it's like if you have to stop in the middle of it, what happens? You're left with piles and piles of sorted, unsorted things, you know, then you don't have time to do the whole project.
Lazarus:So then it just sits there for another week or something like that. So the drive for efficiency in this case gets you this bigger mess. Unless you do everything at one time you have a bigger mess. And I think this is true of code and refactoring too, so, you know, if you think in your head, okay well here's what I'm gonna do, I'm just gonna rip out everything and rebuild this piece. What happens when you finish?
Lazarus:You know, what happens when you can't finish that? You have to come back to it. Now it's not in your head anymore when you come back to it. It just sits there and sits there and sits there. So the goal to do everything like that and just kind of handle it in one the most efficient way, which is to do it all at once and everything like that.
Lazarus:Not always the right approach. Okay. So so what's the alternative? I think for cleaning, what I found, this is just what I'm doing recently, is to just do one item at a time. So what does this mean?
Lazarus:It means you're walking around the house a bunch. It's very inefficient. You you take you know pick something up, figure out okay where should this go? Bring it there. Just walk that one piece over.
Lazarus:And you can do that as much or as little as you want. You're not going to create any more of a mess. If you stop in the middle, fine. If you don't stop and just keep going, you're just gonna make it cleaner and cleaner. There's no there's no in between state that's a disaster.
Lazarus:What's inefficient about this, you're taking a bunch of extra steps. You're walk you know, maybe instead of carrying 3 things at once you intentionally carry one thing at once. So what's the benefit of this? You know, first of all, you're not making a huge mess that you you if you stop in the middle doesn't matter, but also you're taking extra steps. Those extra steps are actually a good thing.
Lazarus:As a developer, as someone who works from their computer, at their desk, at a cafe, whatever it is, you might not walk enough. I don't know. I don't walk enough. I don't take enough steps. Steps are actually good for you.
Lazarus:Get up and get moving. It's not this like punishment to in the way that, you know, just my my own brain has done in the past. It's like, oh, I I'm gonna have to just walk back and forth. Like, that's actually good for you. It's good.
Lazarus:You know, you try to get your, you know, x number of k steps per day. What whatever I don't know if people track steps or not. I didn't used to, but I I have actually started tracking steps mainly just because my phone does it for me anyway. So, you know, maybe you try to hit some number of steps per day. And what if you can hit that number while you're cleaning up and you just take extra steps, it's like taking a walk around the neighborhood, but you're just taking a walk around your house, picking one thing up at a time, putting it where it goes, not worrying about the inefficiency of walking the same steps over and over again.
Lazarus:That's okay. It's okay to do that. So what does this mean for code, and for like development? What's the what's the analogy for code and development? So I'll, I'll, I'll just say for me, I'll tell a quick story.
Lazarus:So, you know, I work in the Laravel world, and I think there's a temptation for any developer to when you start a new project, there's a bunch of things you have to do, right, at that first, just to get that first project going. You know there's a you do like, first of all you start like Laravel new project name, Right? That just sets up the repo, sets up what you need. You do git add, you do a git init, you start your git project. Then to actually make your first route you do this, maybe you install certain packages, composer, require, LiveWire, all those things that you're just starting a new project, you haven't done anything with the business logic yet, but you've taken maybe 5, 10 steps, you know.
Lazarus:And so I think, and then I certainly have had this thought, I'm like, you know what? I could write like a macro basically to just do all this for me. Right? It's like everything. You try to make things more efficient.
Lazarus:So I did that. I wrote something called, you know, the velerator. It was like, what was the I don't even remember why I called it that. Had something to do with like oh, yeah. Laravel generator.
Lazarus:So Velerator. So it I would just it was just one command and it was, you know, fun to write, and it would go through and it would figure out I would even give it like the initial tables that it would build, and then it would do composer, I mean it would do a BHP artisan, create migration, and create model. So I would give it the model. So it was like this script where you just passed it in. Here's all the models I want it to build, and it would build it.
Lazarus:And so then you just run this one script and you don't have to go through all those inefficient steps of creating the project every time. It's just like all those steps that you would normally do when you create a new project are just gone. They're done instantly. Right? So I was like, oh, this is fun.
Lazarus:This is cool. This is great. So a couple problems with that. First of all, things change. Laravel changes.
Lazarus:Everything changes. So when they change, your script suddenly needs to be updated. And then you're sitting there fumbling with updating your script. Right? And then if you don't feel like updating your script and fixing it, you go back to, okay, I guess I have to do this the manual way.
Lazarus:I gotta do it the boring way. But now you've kind of like you're a little rusty, because as much as you understood it at a deep fundamental level to make that script, your hands and your brain, they're not used to doing it if you did that a bunch. If you did it a bunch, you know, you use the script if you've been using the script for a while. So you're a little rusty actually doing it, and it kind of slows you down. So I think of it now, so I stopped using my scripts, you know, it's like what I realized, I think, is that this is like, in in martial arts, there's like the word kata, which is like a series of kind of training things that you do over and over and over again, so that they just become second nature.
Lazarus:So this is like a code kata, setting up a new project. Even I now include going to, my server and continuing that process, going to my domain, setting up a new domain. So I can now, almost without thinking about it, start a new project, do whatever I need to do to get that project just existing, set up a git, then I go to my domain name service and set up a new domain, point it at my server. I go to my server. I pull in the project from Bitbucket.
Lazarus:All these things that if I had to figure them out every time would be a huge pain, but they're just little steps. I could write maybe one script to do them all, but then I would be separated from it. I would it would be too far away from me. So doing it yourself, doing it just in the most inefficient way, step by step, doing it over and over again, That's actually that's helped me. That makes me feel closer to my code and closer to the process.
Lazarus:I understand the process better. When there's changes, when Laravel changes, when the website changes, I'm not guessing at what that change is, I'm just, oh, okay. The thing I used to do doesn't work exactly the same, I gotta look up the new way to do it. Now I can update my kata, I can update the thing that I do, this sort of training exercise. You just go through it slowly and you do it over and over again.
Lazarus:And there's really a benefit to that, to not taking those shortcuts, to not trying to find the quick way around everything. You know, whether it's cleaning up in the house or and I now I do think about it in terms of steps a lot too, because a lot of stuff that I used to do, it's almost lazy, Where it's like, you go to the grocery store and you're, like, circling around. I gotta get a closer spot. I gotta get a closer spot. Like, why?
Lazarus:Why do I have to get a closer spot at the grocery store? So I can save steps? Like, what what's the benefit to me to saving some steps? There's no benefit. The benefit is actually parking farther away.
Lazarus:And now that's what I do. If I go somewhere to the grocery store or to the cafe or just anywhere, I don't mind parking maybe even in a separate parking lot and just walking a little bit farther because it's like well, you know, maybe I'm not gonna get a chance to take a walk today. Maybe I'm just gonna be sitting all day, so why not park a little farther away, take a nice walk in the sunshine, and not take that shortcut. Not try to make the most efficient path from a to b, because you might find something else on the way, and you might kind of enjoy taking a little extra time, taking a little extra walk, going through all those steps over and over again so that eventually, you know, when you're building something, you just know those steps, like they are just part of your process. They're just ingrained.
Lazarus:You know, you do that for years years, and these things just become ingrained. So, this is just a little shout out for not taking the shortcuts. You know, sometimes if you take a shortcut you sort of stray from the path. You know, you forget what the actual path is. So just something to to think about.