Maximiliano Contieri

Software

Code Smell 278 – DirName and File | HackerNoon

Avoid Ambiguous Naming for Path Variables Problems Unclear variable purpose Bijection Fault Misleading context Repetitive code Harder maintenance Reduced readability Abbreviations Increased cognitive load Solutions Honor the Bijection Use precise names Avoid ambiguity Keep context clear Extract reusable code Follow naming conventions Reify names with their rules Context When handling a single fileName or directoryPath, vague names like file or dirName create confusion. A file should represent a File A fileName should represent the name

Read More »
Software

Code Smell 277 – UPPERCASE Acronyms | HackerNoon

Avoid Jumbled Acronyms for Clarity TL;DR: Treat acronyms like normal words to improve human readability. Problems Reduced readability Breaking naming style Words confusion Harder to pronounce Solutions Treat acronyms as Capitalized words Use camelCase or snake_case Context Acronyms in uppercase (like JSON, XML, REST) in camel case break the natural reading flow. You may think sendJSONRequestOnHTTPREST is a clear name, but it makes your code harder to read, especially when you string multiple acronyms together.

Read More »
Software

Code Smell 272 – API Chain | HackerNoon

Streamline Your API Tests: Less is More TL;DR: Use primitive steps to verify API behavior instead of direct requests. Problems Unnecessary API calls Slow test performance Overcomplicated validations Fragile tests Slow feedback loops Maintainability Misleading test results Solutions Test primitive outcomes Validate responses directly Avoid extra API steps Simplify test logic Context When you test an API, you might fall into the trap of using multiple API requests to verify a single operation. Making a

Read More »
Software

Code Smell 270 – Boolean APIs | HackerNoon

Avoid booleans, always TL;DR: Replace boolean security flags in APIs with separate, more secure endpoints. Problems Overly simplistic security model Lack of granular control Potential for misuse Reduced traceability Difficult maintenance Solutions Create separate endpoints Implement granular permissions Enhance logging capabilities Deal with code duplication Refactorings Context Many APIs (like WhatsApp) use boolean flags to toggle security features. An API might have a secure parameter that enables additional security checks when set to true. While

Read More »
Software

Code Smell 261 – DigiCert Underscores | HackerNoon

This is your reminder: Don’t forget to check strings with special characters like underscores TL;DR: Underscore and special characters can lead to validation errors Problems Incomplete Validation Security Risks Missed Tests Incorrect Setup System Inconsistency Breaking changes with legacy data Solutions Use consistent prefix Implement strict validation Check system outputs Create migration tests Test with legacy data Context In digital certificate validation, ensuring domain control is critical. An incomplete validation and potential security issues. DigiCert

Read More »
Software

Refactoring 014 – How to Remove IF | HackerNoon

The first instruction you learned should be the least you use. TL;DR: Remove all your Accidental IF-sentences Problems Addressed Code Duplication Possible Typos and defects Code Smell 07 – Boolean Variables Code Smell 36 – Switch/case/elseif/else/if statements Code Smell 133 – Hardcoded IF Conditions Code Smell 156 – Implicit Else Code Smell 119 – Stairs Code Code Smell 145 – Short Circuit Hack Code Smell 101 – Comparison Against Booleans Code Smell 45 – Not

Read More »
Software

Code Smell 255 – Addressing Parallel Hierarchies in Code | HackerNoon

Double Trouble: The Curse of Redundant Structures TL;DR: Parallel hierarchies lead to duplication and tight coupling. Problems Increased complexity DRY / Code Duplication Maintenance Nightmare Coupling Ripple Effect Potential for inconsistencies across different hierarchies Solutions Merge hierarchies Use composition Extract Common Functionality Refactorings Context Parallel hierarchies occur when you must make a counterpart every time you create a domain class. The counterpart might be persistence, UI, Controller, tests, Serialization, etc. This leads to duplicate structures

Read More »