Clean Code In The Browser
2.2. Episode 2 Part 2
By Chris Powers, 53m

"Clean Code in the Browser" Episode 2 Part 2 picks up where Part 1 left off by implementing changes to a code example using the Single Responsibility Principle and Command Query Separation.

Next, we learn about the benefits of "Taco Bell Programming", discovering how it can be used in a JavaScript environment with functional composition techniques.

We talk about applying the Single Responsibility Principle (or at least its spirit) to HTML documents and template files. Using several code examples we see how HTML code can be clarified by focusing on a single job for each element.

Finally, we finish the episode by applying SRP to our CSS. By carefully using SRP-inspired naming conventions and techniques in our CSS, we prevent collisions and improve the robustness of our styling code.

2.1. Episode 2 Part 1
By Chris Powers, 54m

In the first part of "Clean Code in the Browser" Episode 2, we start talking about the "S" in the SOLID Principles: the Single Responsibility Principle.

First, we discuss the meaning of software "best" practices. Everyone knows those are the practices that we're all supposed to be using, but is that always the truth?

We dive into the Single Responsibility Principle, identifying what it means, why it matters, and how we can apply it specifically to JavaScript. Picking up from some code we started in Episode 1, we use SRP as our guide for refactoring code structure and finding the right place for each piece of logic to live.

Finally, we explore how Command Query Separation can be a complimentary technique to SRP for reducing the scope and role of individual methods and functions. We work our way through another code example, finding opportunities to use both SRP and Command Query Separation to avoid code churn and cohesion.

This episode had so much content that we had to split it into two! Be sure to check out Episode 2 Part 2 for more insights into how SRP can help you write Clean Code in the Browser!

1. Clean Code In The Browser
By Chris Powers, 1h 20m

The Web has been a dominant platform for over twenty years, but over that time code quality has been surprisingly low. An entire generation of developers came up through the ranks with a working understanding that front-end code was hard to write well, and harder to maintain over time. How did we get here, and how can we make positive changes towards quality in our browser code?

This new series is called "Clean Code in the Browser" and focuses on improving the code quality of our front-end code. In this first episode we look at how we got into this mess in the first place:

We start by exploring common pitfalls and patterns that lead to failure in Web projects.

Next, we go back through a brief history of quality on the Web since its inception, analyzing the forces that set the stage for poor code quality in front-end code.

Once we've looked at the historical forces, we move on to cultural forces. We talk about the division between front-end and back-end developers and how these rifts reinforce cultures where quality is not valued.

Finally, we will look at Client-Server architecture and how its role in the Web has shifted over the last 50 years. These changes have introduced architectural challenges to Web developers and make it more difficult to maintain best practices.