Packt
Writing Clean Code: 20 Code Smells & How to Avoid Them
Packt

Writing Clean Code: 20 Code Smells & How to Avoid Them

包含在 Coursera Plus

深入了解一个主题并学习基础知识。
中级 等级

推荐体验

2 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度
深入了解一个主题并学习基础知识。
中级 等级

推荐体验

2 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度

您将学到什么

  • Master strategies for recognizing and refactoring common code smells that affect code readability and scalability

  • Understand the SOLID principles and how they improve software design and maintainability

  • Learn best practices for handling complex data structures, eliminating redundancy, and reducing technical debt

  • Gain the skills to simplify and streamline your codebase, making it more intuitive, flexible, and easier to maintain

要了解的详细信息

可分享的证书

添加到您的领英档案

最近已更新!

May 2025

作业

24 项作业

授课语言:英语(English)

了解顶级公司的员工如何掌握热门技能

Petrobras, TATA, Danone, Capgemini, P&G 和 L'Oreal 的徽标

该课程共有24个模块

In this module, we will introduce the course and outline its goals. You will learn how identifying and removing code smells can drastically improve the quality and maintainability of your codebase, laying the groundwork for better software design practices.

涵盖的内容

1个视频1篇阅读材料

In this module, we will dive into essential software design principles, focusing on the SOLID principles. You'll explore how these principles can be applied to create cleaner, more maintainable, and scalable software architecture. We’ll also cover techniques for structuring modules effectively to improve code quality.

涵盖的内容

7个视频1个作业1个插件

In this module, we will guide you on how to read and comprehend large codebases effectively. You’ll learn techniques for navigating code efficiently and identifying areas where code smells can be improved or refactored for better clarity and maintainability.

涵盖的内容

1个视频1个作业1个插件

In this module, we will introduce the repeated switch code smell and discuss its negative impact on code readability and maintainability. You will learn how to recognize and refactor repeated switch statements for cleaner, more maintainable code.

涵盖的内容

3个视频1个作业1个插件

In this module, we will explore the primitive obsession code smell, focusing on how overusing primitive data types can complicate your code. You will learn how to replace these with domain-specific objects, improving abstraction and readability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will address inefficient loop structures, one of the most common code smells, and discuss their impact on both performance and readability. We’ll provide best practices for refactoring loops to make them more efficient and easier to understand.

涵盖的内容

3个视频1个作业1个插件

In this module, we will cover the long parameter list code smell and how excessive parameters can complicate function signatures. You will learn strategies for simplifying these lists, such as using objects or default values to enhance readability and maintainability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will address the knowledge duplication code smell, explaining how repeated logic across the codebase can lead to inconsistencies and higher maintenance costs. You will learn techniques for refactoring and removing redundancies to improve the maintainability of your software.

涵盖的内容

3个视频1个作业1个插件

In this module, we will explore how uninformative comments can clutter your code and reduce clarity. You will learn how to write useful, concise comments and improve code readability by eliminating redundancy.

涵盖的内容

3个视频1个作业1个插件

In this module, we will dive into the shotgun surgery code smell, where changes in one part of the system require modifications across multiple classes. You will learn strategies for refactoring to reduce the complexity of these scattered changes and improve maintainability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will discuss the problem of alternative classes with inconsistent interfaces, which can lead to confusion and usability issues. You’ll learn how to refactor classes to unify interfaces and improve code consistency.

涵盖的内容

3个视频1个作业1个插件

In this module, we will explore the refused bequest code smell, which occurs when a subclass inherits functionality that it does not use. You’ll learn how to refactor your code to reduce misuse of inheritance and prefer composition to improve flexibility and maintainability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will address the data clumps code smell, where related data is grouped together inappropriately. You will learn how to refactor these data structures to improve organization and encapsulation for better maintainability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will examine the middle-man code smell, where unnecessary classes add complexity by simply delegating functionality. You’ll learn how to refactor your code by removing unnecessary abstraction layers to simplify your codebase.

涵盖的内容

3个视频1个作业1个插件

In this module, we will explore mutable data and how uncontrolled changes to state can lead to bugs and inconsistencies. You’ll learn how to refactor your code to manage data immutability effectively for better reliability and predictability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will address the feature envy code smell, where methods tend to focus too heavily on data from another class. You’ll learn how to refactor your code to improve object boundaries and move behavior to the class where it logically belongs.

涵盖的内容

3个视频1个作业1个插件

In this module, we will explore the divergent change code smell, where a module requires frequent modifications for unrelated reasons. You’ll learn how to refactor your code to minimize the risk of frequent changes causing instability or regressions.

涵盖的内容

3个视频1个作业1个插件

In this module, we will explore the issue of large interfaces and how they can make code difficult to maintain and extend. You’ll learn how to refactor large interfaces into smaller, more manageable ones that are easier to maintain and scale.

涵盖的内容

3个视频1个作业1个插件

In this module, we will address the multitasker code smell, where classes or methods take on too many responsibilities. You’ll learn how to apply the Single Responsibility Principle to refactor your code and improve its clarity and maintainability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will focus on the importance of clear, intuitive naming conventions. You will learn how unclear names can cause confusion and how to adopt best practices for naming variables, functions, and classes for improved readability.

涵盖的内容

3个视频1个作业1个插件

In this module, we will discuss speculative generality and how over-engineering can make code unnecessarily complex. You’ll learn how to simplify code by removing premature abstractions and focusing on current requirements.

涵盖的内容

3个视频1个作业1个插件

In this module, we will explore the unnecessary exceptions code smell, where the excessive use of exceptions makes error handling more complicated than needed. You will learn how to simplify exception handling for clearer and more robust code.

涵盖的内容

3个视频1个作业1个插件

In this module, we will discuss the shallow module code smell, where modules contain little functionality relative to their complexity. You will learn how to refactor these modules to provide more meaningful functionality and enhance reusability.

涵盖的内容

3个视频1个作业1个插件

In this final module, we will summarize the key takeaways from the course, reinforce the importance of clean code practices, and offer guidance on how to continue improving your software design skills for better maintainability and scalability.

涵盖的内容

1个视频2个作业

位教师

Packt - Course Instructors
Packt
971 门课程229,122 名学生

提供方

Packt

从 Software Development 浏览更多内容

人们为什么选择 Coursera 来帮助自己实现职业发展

Felipe M.
自 2018开始学习的学生
''能够按照自己的速度和节奏学习课程是一次很棒的经历。只要符合自己的时间表和心情,我就可以学习。'
Jennifer J.
自 2020开始学习的学生
''我直接将从课程中学到的概念和技能应用到一个令人兴奋的新工作项目中。'
Larry W.
自 2021开始学习的学生
''如果我的大学不提供我需要的主题课程,Coursera 便是最好的去处之一。'
Chaitanya A.
''学习不仅仅是在工作中做的更好:它远不止于此。Coursera 让我无限制地学习。'
Coursera Plus

通过 Coursera Plus 开启新生涯

无限制访问 10,000+ 世界一流的课程、实践项目和就业就绪证书课程 - 所有这些都包含在您的订阅中

通过在线学位推动您的职业生涯

获取世界一流大学的学位 - 100% 在线

加入超过 3400 家选择 Coursera for Business 的全球公司

提升员工的技能,使其在数字经济中脱颖而出

常见问题