💻CS software engineer / Book Author
http://MaximilianoContieri.com
http://CleanCodeCookbook.com
Ask AI to scan your codebase for functions that use two or more parameters of the same type.
Instruct it to propose an entity name, generate the type or class, and rewrite both the function and its callers to use the new entity.
Ask AI to scan your codebase for functions that use two or more parameters of the same type.
Instruct it to propose an entity name, generate the type or class, and rewrite both the function and its callers to use the new entity.
This refactoring mirrors that natural [language structure](maximilianocontieri.com/what-is-wron...) in your code.
This refactoring mirrors that natural [language structure](maximilianocontieri.com/what-is-wron...) in your code.
In the real world, you describe searches using named criteria rather than ordered lists.
In the real world, you describe searches using named criteria rather than ordered lists.
You move closer to a [one-to-one map](maximilianocontieri.com/what-is-wron...) between the business concept of a "search request" and your code model.
You move closer to a [one-to-one map](maximilianocontieri.com/what-is-wron...) between the business concept of a "search request" and your code model.
You create opportunities to [reuse the parameter object type](maximilianocontieri.com/code-smell-1...) across related functions.
You create opportunities to [reuse the parameter object type](maximilianocontieri.com/code-smell-1...) across related functions.
You make function calls self-documenting because each value clearly indicates its purpose.
You simplify adding new optional parameters without breaking existing code.
You make function calls self-documenting because each value clearly indicates its purpose.
You simplify adding new optional parameters without breaking existing code.
You avoid order confusion and increase readability.
You make functions easy to extend with new parameters.
You bring semantic meaning to the input data.
You avoid order confusion and increase readability.
You make functions easy to extend with new parameters.
You bring semantic meaning to the input data.
1. Identify multiple parameters of the same type
2. Create a meaningful entity to group them
3. Add missing validation rules to fail fast
4. Replace function signatures with the new entity
5. Adjust all callers to pass the entity
6. Add context-specific names to improve clarity
1. Identify multiple parameters of the same type
2. Create a meaningful entity to group them
3. Add missing validation rules to fail fast
4. Replace function signatures with the new entity
5. Adjust all callers to pass the entity
6. Add context-specific names to improve clarity
[Code Smell 122 - Primitive Obsession](maximilianocontieri.com/code-smell-1...)
[Code Smell 122 - Primitive Obsession](maximilianocontieri.com/code-smell-1...)
[Code Smell 188 - Redundant Parameter Names](maximilianocontieri.com/code-smell-1...)
[Code Smell 188 - Redundant Parameter Names](maximilianocontieri.com/code-smell-1...)
[Code Smell 143 - Data Clumps](maximilianocontieri.com/code-smell-1...)
[Code Smell 40 - DTOs](maximilianocontieri.com/code-smell-4...)
[Code Smell 143 - Data Clumps](maximilianocontieri.com/code-smell-1...)
[Code Smell 40 - DTOs](maximilianocontieri.com/code-smell-4...)
[Code Smell 194 - Missing Interval](maximilianocontieri.com/code-smell-1...)
[Code Smell 194 - Missing Interval](maximilianocontieri.com/code-smell-1...)
[Code Smell 87 - Inconsistent Parameters Sorting](maximilianocontieri.com/code-smell-8...)
[Code Smell 10 - Too Many Arguments](maximilianocontieri.com/code-smell-1...)
[Code Smell 87 - Inconsistent Parameters Sorting](maximilianocontieri.com/code-smell-8...)
[Code Smell 10 - Too Many Arguments](maximilianocontieri.com/code-smell-1...)
- Missing [Intervals](maximilianocontieri.com/code-smell-1...)
- Missing [Intervals](maximilianocontieri.com/code-smell-1...)
- [Primitive Obsession](maximilianocontieri.com/code-smell-1...)
- [Data Clumps](maximilianocontieri.com/code-smell-1...)
- Weak type safety
- [Primitive Obsession](maximilianocontieri.com/code-smell-1...)
- [Data Clumps](maximilianocontieri.com/code-smell-1...)
- Weak type safety
- Hard extension
- [DTOs](maximilianocontieri.com/code-smell-4...)
- Weak semantics
- Repeated [validations](maximilianocontieri.com/code-smell-4...)
- Hard extension
- [DTOs](maximilianocontieri.com/code-smell-4...)
- Weak semantics
- Repeated [validations](maximilianocontieri.com/code-smell-4...)
- Parameter [overload](maximilianocontieri.com/code-smell-1...)
- [Order confusion](maximilianocontieri.com/code-smell-8...)
- [Anemic Models](maximilianocontieri.com/code-smell-0...)
- Parameter [overload](maximilianocontieri.com/code-smell-1...)
- [Order confusion](maximilianocontieri.com/code-smell-8...)
- [Anemic Models](maximilianocontieri.com/code-smell-0...)