AI-Generated To-Do App0:07
We're entering an age of AI, and I think now more than ever, the human aspect of writing code matters. Let's take a look at ChatGPT and have it generate a to-do application for us. Uh, one that's pretty basic. It allows us to see all of our to-do items, add a new one, mark an existing one as complete, and we can even go so far as to tell it.
An existing one is complete and we can even go so far as to tell it to follow the latest Laravel conventions. And I'll throw in, uh, no need to explain, just show me the code and just kind of scrolling through it. I feel like this works. I'm sure it does, but we can probably all agree this isn't the way maybe we would write the code. For example, it uses things like compact,
Subjectivity vs Maintainability0:51
the way maybe we would write the code. For example, it uses things like compact, which are maybe a little bit dated. Uh, it has inline controller validation. We also might not structure our applications this way. Maybe it's underneath some kind of a domain. Uh, maybe we don't format our code this specific way. All of this kind of demonstrates the subjectivity of what makes code better. After all, if this code works, why does that matter?
what makes code better. After all, if this code works, why does that matter? The answer to both of those questions is maintainability. Until AI not only generates the code, but also maintains and updates the code, humans will always have a role in programming and taking that farther. Humans who write maintainable code will have a lead role. Let's take a look at another bit of code this time. One written by human, just like ai,
Unapproachable Human Code1:39
Let's take a look at another bit of code this time. One written by human, just like ai, this code probably works, but I think even more of us would agree this code's not very good, but let's try to drill down into the reason first. It's just not very approachable. Even though it's only 20 lines of code, it's really hard to see what it's doing syntax wise. It's not very complex, but it really appears more complex than it is.
Readability Matters2:03
It's not very complex, but it really appears more complex than it is. When we say things like, it's hard to see what the code's doing. What we're really talking about is readability. See humans read the code. Computers don't. They just parse the code and analyze it. They don't care about white space or structure or even syntax, really just that it compiles, but a human does.
or even syntax, really just that it compiles, but a human does. To prove this, I've rewritten this block of code and all I've really done is apply some formatting and change the structure, but I think we could all agree this is much more readable. Said another way. I'd much rather work on a code base that has code, which looks like this than code that looks like this. So what is it about this code? What makes it more readable?
Series Overview: 10 Practices2:46
that looks like this. So what is it about this code? What makes it more readable? Well, that's what we're gonna talk about in this series. I'm gonna cover 10 practices that will make your code more readable, more maintainable, and ultimately distinguish your code.
