5 Patterns of Engineers Who Write Messy Code

TLDRThis video discusses the common patterns of engineers who write messy code and provides tips on how to avoid making these mistakes. It emphasizes the importance of empathy, clear naming conventions, modular code structure, and proper use of version control.

Key insights

🔄Engineers often spend more time in the code review phase than in the initial coding phase, which leads to higher code quality.

📝Using meaningful and consistent variable and method names helps improve code readability and maintainability.

📦Breaking down large code files or classes into smaller, more focused units improves code organization and makes it easier to understand.

⛔️Commenting out unused code should be avoided, as version control systems already provide a way to access previous code states.

📏Excessive white space in code can make it harder to read and understand, so it's important to establish a consistent coding style and use a linter to enforce it.

Q&A

Why is code quality important?

Code quality is important because it affects maintainability, scalability, and collaboration within a software project. High-quality code is easier to understand, modify, and debug.

How can I improve my code naming conventions?

To improve your code naming conventions, use descriptive and meaningful names for variables, functions, and classes. Be consistent in your naming conventions throughout your codebase.

What is the benefit of modular code structure?

Modular code structure improves code organization and makes it easier to understand and maintain. It allows for better separation of concerns and promotes reusability.

Why should I avoid commenting out code?

Commented out code adds unnecessary clutter to the codebase and makes it harder to understand. Version control systems provide a reliable way to access previous code states if needed.

What is the purpose of using a linter?

A linter helps enforce a consistent coding style and catches common code errors and style violations. It helps improve code readability and maintainability.

Timestamped Summary

00:00The video introduces the topic of writing messy code and the importance of code quality.

02:30The speaker emphasizes the importance of empathy in code writing and maintaining.

04:37The first pattern discussed is low-quality or unreadable pull requests and the importance of providing clear context and code review.

06:53The second pattern is having terrible naming conventions, and the speaker provides tips for choosing clear and consistent names for variables and functions.

09:39The third pattern is having a monolith in the codebase, and the speaker explains the negative impacts of having large and complex files.

11:42The fourth pattern is keeping commented code in the codebase, and the speaker explains why this practice should be avoided.

13:15The fifth pattern is having too much white space in the code, and the speaker emphasizes the importance of a consistent coding style and using linters.

15:43The video concludes with a reminder to prioritize code quality and the impact it has on collaboration and productivity.