
这是“重构金字塔”系列的第二个模块,致力于实现清洁代码。
尽管核心重构书籍(“重构”和“重构到模式”)中没有提到重构到责任链,但这些书中描述的技术允许为这样的重构之旅创建计划。
本课程的目标是将代码库从一组深度嵌套的条件 if/else 语句中分离出来。这是一种非常常见的情况——如果它被放置很长时间——那么在后续代码扩展之后会导致非常复杂的遗留代码。
我们使用重构技术并实时执行所有更改。参与者下载源代码并与培训师一起执行所有更改 – 一步一步。在这个示例中,我们使用责任链设计模式作为我们重构之旅的目标。
责任链之旅让与会者可以练习代码转换,例如
合并 If 语句
合并嵌套
如果语句
提取方法
用查询替换 Temp
移动方法
内联方法
提取类/提取委托
提取接口 – 重命名方法和变量
课程以作业结束,参与者可以体验在清洁代码和旧代码中实施附加要求之间的区别。这是跳过和应用准备重构之间的区别。
Last Updated 04/2020
MP4 | Video: h264, 1280×720 | Audio: AAC, 44.1 KHz, 2 Ch
Genre: eLearning | Language: English + srt | Duration: 15 lectures (1h 58m) | Size: 1.13 GB
Replace nested & messed-up if-else statements with Chain of Responsibility using Refactoring Pyramid & Clean Code rules
What you’ll learn
Refactoring
Clean Code
Design Patterns
SOLID Principles
Working with Legacy Code
Requirements
Java 1.8+
IntelliJ Community Edition
JUnit
Maven
Description
This is the second module of series called “Pyramid of Refactoring” dedicated to achieving Clean Code.
Although Refactoring to Chain of Responsibility is not mentioned in the core refactoring books (“Refactoring” & “Refactoring to Patterns”) the techniques described in these books allow to create a plan for such a refactoring journey.
The goal of the course is to disentangle the codebase from a set of deeply nested conditional if/else statements. It is a very common case – and if it is left for a long time – then it leads to a very complex legacy code after subsequent code extensions.
We use refactoring techniques and perform all the changes live. The partititants download the source code and performs all the changes together with the trainer – step by step. In this sample we make use of Chain of Responsibility Design Pattern as goal of our refactoring journey.
The journey into Chain of Responsibility allows the attendees to practice code transformations like
Merge If Statements
Merge Nested
If Statements
Extract Methods
Replace Temp with Query
Move Methods
Inline Methods
Extract Class / Extract Delegate
Extract Interface- Rename Methods & Variables
The course ends up with Homework, where the participants can experience the difference between implementing additional requirements within Clean Code and within Legacy Code. This is the difference between skipping and applying Preparatory Refactoring.
Who this course is for
Software Developer
Software Architect
IT Team Leader
原创文章,作者:steven,如若转载,请注明出处:https://rr3d.cn/34802.html