Welcome to No Compromises. A peek into the mind of two old web devs who have seen some things. This is Joel.

And this is Aaron.

It's a argument as old as time, how should this code be formatted? Do I use spaces or tabs? What is the standard I want to use? All these different things.

And as time goes on, we have these tools that will auto-format our code based of standards. You know that, right?

Mm-hmm (affirmative).

I mean, of course, we have our own standards for PHP, we use some for JavaScript. So, really, there's no excuse ever to look at code and say, "That's not formatted right," anymore, because we have tools that automatically do it, right?

Maybe. There's edge cases, things that they can't do. But I think line wrapping and stuff, right?

Well, yeah. I mean, that's true. You can get them to decide a line wrap and, oh, if it's this rapid or if it's many attributes, put them on all new lines. That kind of stuff.

Sure. Right, yeah.

But there are edge cases. There are even like... Not even indenting per se, but I just want to structure this set of code a little bit different so it makes more sense to me, but both formats are correct. There's a little subjectivity in there.

I felt kind of guilty now, though, based off of all the tools I have available to myself when I open up a code editor and I just start removing blank lines and adding them, indenting and removing stuff. You ever kind of feel that way? Do you even do that?

You mean like something that the code formatting standard wouldn't have picked or wouldn't have caught? Or like, it would've caught it, but you just want to do it yourself?

A little bit of both sometimes.

Okay.

Like I said, it won't catch it, other times it might format it. If you have a single, huge line of something, it might format it in one way, but I want it formatted a different way.

Both are legal according to the standard.

Okay. It'll just pick one, and I don't want that way.

I can't say I do it a lot. But there's definitely been times where it's like, I look at something, and I'm like, "I don't like that," but the standard says it's fine, so should I just move on or not?

Yeah. Well, I always feel guilty too, because we have all these different tools and I shouldn't be spending my programmer brain looking at line breaks and indenting and moving stuff around. Like, such a waste of time and money, right?

You shouldn't be doing that. And I felt so guilty about that, but I still do it every once in a while. Last time I was doing it, I was like, "Why am I feeling guilty?" So I pushed it out of my brain.

I said, "I don't know. You've done this for years and years and years, and hopefully you're a good programmer still. So let's just do it and let's not feel guilty about it."

Okay.

So I spent another 10 minutes formatting this code, kind of mindlessly. I don't even remember what I was doing. I just know it was getting closer and closer to what I liked, it was looking pretty to me. Everything was nice.

I feel like a sculptor with clay, and you're just shaping it to get it just right.

In a way, right? They say sometimes code is like art. And I'm pushing out this idea of being guilty, just kind of moving through it. And I get to the end time to commit the code, so I'm committing it. Code changes, formats took me 15 minutes.

I know it could have probably took me maybe 2, 3 minutes with the automated tool, but okay, fine. And then as I'm committing it, I realized something else happened really cool that I was not expecting. I had solved another ticket in my head while I was doing this code formatting.

I was kind of putting it off. Honestly, I was putting it off. I knew that if I did this code formatting, the next thing was this difficult task. So I knew if I used my automated tools, I got to get to this difficult task sooner.

I wasn't admitting that to myself, but I think after looking back, that's kind of how I felt. So I was procrastinating by at least doing something that is useful.

Your hands were on the keyboard.

Well, exactly. But during that time, I actually gave myself some breathing room, a little bit of time to think. And while I was doing something that is so second nature to me, making beautiful code, I started thinking about this other stuff.

And that's why I told you, I can't really remember what I was formatting, but I know it was good at the end, and then I'd solved this other issue. I think I've changed my mind a little bit.

I don't want to waste time, but I think there is some value in spending some time doing mindless tasks so that your brain can chew on something else. And you don't have to feel guilty about that because you actually are doing something.

I'm tracking with you. I want to point something out though.

Okay.

You said this was like a 10 or 15-minute exercise, right? This wasn't like half a day.

Correct.

I think that's important and that obviously you could take this to an extreme. But if it's the 2 minutes versus 10 or 15 minutes, then, yeah, you're basically taking a break while your hands are still on the keyboard.

And I will sometimes take a walk, but then you're almost more disengaged. And it does free your mind up more to problem solve or whatever, but now you got to get back in the groove. Whereas you're still in the groove of programming, so I can see some benefits to this approach.

I would say you have a point there. It's maybe a tiered system where it's like you are in your groove, you're in your zone while you're in your zone doing stuff.

If you have a semi-hard problem, maybe do something simple so your brain can chew on that. If you have a very difficult problem that actually requires a lot of planning and thinking, maybe go outside and take a walk then.

Yeah. I've even taken a nap, just 15, 20 minutes, closing your eyes. Like, you don't even fall asleep, but it's a mental reset.

Well, not all of us can take the nap with our heated floors.

I'm not lying on the floor.

It was nice, though, to use an automated tool and kind of balance it without turning off my brain entirely.

Yeah, that takes some balance because we do automate things to free ourselves up from monotonous or menial, tedious tasks. But we don't want to completely relinquish authority. Because again, this is code formatting, which is subjective, I would argue.

That's why there are so many different coding standards. So maybe over time we change our mind, but if we turn our mind off and we just let the tool tell us what's right and wrong, we would never grow, or you'd lose the opportunities like you talked about earlier in this story.

But just in general, the tool is for me. It's not telling me what to do.

Oh, and don't get me started on seeing a commit with some weird code in it and someone saying, "Oh, that was the automated tool that did that." No. No, that was you.

I've tried that.

Normally, we come up with a funny topic, but just this last week I just... Oh, it's been... I'm really tired, a lot of work. It's been rough.

Just like one of my dogs. Ruff, ruff, ruff.

Joel, come on. You know what's even better than automated tools reviewing your code? Two old men like us.

I think you meant to say two Laravel experts like us. But if that's something you're interested in, we offer a code review service. Head over to masteringlaravel.io/codereview.

No Compromises, LLC