Skip to content

Latest commit

 

History

History
911 lines (675 loc) · 78.3 KB

File metadata and controls

911 lines (675 loc) · 78.3 KB

drawing

Let's learn about Refactoring via these 223 free blog posts. They are ordered by HackerNoon reader engagement data. Visit the /Learn or LearnRepo.com to find the most read blog posts about any technology.

Refactoring is the process of restructuring existing computer code without changing its external behavior, to improve its internal structure and readability. It enhances code maintainability, reduces technical debt, and makes future development easier.

Enhancing product functionality, reducing deterioration, and satisfying the needs of users - all of that is achieved through software maintenance.

Many of us know about includes, joins but sometimes we confuse about their usage. As I was experimenting with code refactoring in one of my projects, there I have tried these things. So I thought I can share these findings with you guys.

Use these 6 VS Code extensions that help devs get organised and work effectively.

If you’re looking at ways to clean up our code, reduce complexity and improve functionality - these refactoring extensions will help you move faster.

5 easy wins to refactor even the worst legacy code

Technical debt metrics help you to monitor deficiencies in your current codebase. We decided to look at how they work, and pick out the best tracking tools.

This post contains a step-by-step example of a refactoring session guided by tests. When dealing with untested or legacy code refactoring is dangerous and tests can help us do it the right way, minimizing the amount of bugs we introduce, and possibly completely avoiding them.

As a developer, you’re always looking for cutting-edge tools, tricks, and extensions. Here are 7 tools that'll improve your productivity and efficiency.

10 Ways to refactor Python code to make it more Pythonic

The most complete curated collection of software and programming quotes

In this guide, you'll learn what is legacy code, its characteristics, tools, and the best practices for working effectively with legacy code and technical debt.

Ye olde Reliable Data Structures and Their Controversial (Write) Access.

Using JSON Mapping to Work with APIs of Various Image Services. This approach is applicable to any other services that are similar in type of returned results.

"Don't touch it, it works" is problematic. It leads us down a bad path. How do you handle a project that held that policy for years?

The Rule: When naming a variable, don't encode it's type into its name, even in a dynamically typed language.

The code smells bad. Let’s see how to change the aromas. In this series, we will see several symptoms and situations that make us doubt the quality of our developments. We will present possible solutions. Most of these smells are just hints of something that might be wrong. They are not rigid rules.

Why the first instruction we learn to program should be the last to use.

An exercise improving legacy code

Avoid software bottlenecks by understanding the 'God Object' anti-pattern in object-oriented programming. Learn its impacts, examples, and best practices.

Unit tests and laziness: a dispute-free method to boost individual skills within tech teams.

Ye olde Reliable Data Structures and Their Controversial (Read) Access.

Using objects as data structures is an established practice that generates many problems associated with the maintainability and evolution of software. It misuses brilliant concepts that were stated five decades ago. In this second part we will reflect on the reading access of these objects.

AI-generated code outperforms lazy programmers. Software jobs are declining, but centaurs will survive.

Originally published at Managing Technical Debt.

Join Ayse and her son Mert in a tale that weaves lessons from a teenager's messy room into innovative code refactoring techniques.

In this short, but nonetheless useful article, I have summarized the most beneficial tips for writing clean code. These rules are independent of the language you use and are invaluable for both beginners and experienced programmers.

This article looks at how you can refactor your code using Visual Studio Code (VS Code) and Visual Studio Code plugins.

We keep practicing this amazing Kata and learning. You can follow the steps!

Developing a complete word game is very easy with TDD

The other day I was reading up on the legendary React God Dan Ambrov’s great but very un-TLDR post on useEffect.

In this guide, you’ll learn all about refactoring source code: the benefits, challenges, tools, and best practices, and what is the difference between refactoring and technical debt.

There are more code smells. Let’s keep changing the aromas. We see several symptoms and situations that make us doubt the quality of our development. Let's look at some possible solutions.

The Rule: Whenever you name a variable, function, or class, ask if it is concise, honest, expressive, and complete.

Avoid Boolean variables, they lead to conditional logic and force you to write Ifs. Create polymorphic states instead

Here's how to avoid duplicate email validations.

Let’s imagine the monolith project with an enormous code base that has been developed for a couple of decades (unbelievable, right?). This project is probably going to have a myriad of features and a considerable (hopefully!) number of automated tests covering the verification of our priceless features on multiple levels. All the way up the famous, or infamous, depending on who’re you gonna ask, testing pyramid from the unit foundation down below to the end-to-end peak high above.

More code smells. No joke. We see several symptoms and situations that make us doubt the quality of our development.

Building models and solutions in software is not just about programming. We will review Peter Naur's classic paper.

There are yet more code smells. Let’s keep changing the aromas. We see several symptoms and situations that make us doubt the quality of our development.

This article summarizes my experience as a writer during the pandemic year 2021

"Let's limit the scope of this." is your new motto :-) Start learning the codebase by fixing bugs.

During a recent, mock technical interview, I was given the following problem to solve.

Are we done on code smells? Guess not.

Refactoring isn't a luxury — it's a habit that separates good engineers from great ones.

Leave comments just for important design decisions. Don't explain the obvious.

Here is the post-mortem on what worked, what failed, and the critical difference between generating code and refactoring systems.

It smells because there are likely many instances where it could be edited or improved. Most of these smells are just hints of something that might be wrong.

Recently, I had to deal with an old codebase that was difficult to maintain and scale. In this article, I'll share how my team and I decided to deal with maintenance and the best practices we implemented to reduce time spent on refactoring.

Last week we hosted a webinar where I interviewed Adam Tornhill, CTO & Co-founder of CodeScene, about technical debt: what is it, why is it important, and how to manage it effectively.

Most of these smells are just hints of something that might be wrong. They are not required fixed per se… (You should look into it though.)

Always stay in control when using AI tools. Blind trust can lead you to costly mistakes.

The first instruction you learned should be the least you use

Most of these smells are just hints of something that might be wrong. They are not required fixed per se… (You should look into it though.)

Yesterday, 2022 Oct 7th one of the larger blockchains had to be halted. This news was shocking since most blockchains are decentralized by definition.

Most of these smells are just hints of something that might be wrong. Therefore, they are not required to be fixed per se… (You should look into it, though.)

We all love T.D.D. We know its benefits, we have read a thousand tutorials on how to build a system using this technique. But this not feasible for currently legacy systems.

I recently came across a route handler that was 2k LOK (lines of code). This possibly happened due to lack of rules and guidelines in place. I tried to understand the control flow, but 3 mouse scrolls down I was forgetting where I have started and what it's all about. Just a hint (not actual project code):

A step-by-step guide on how to refactor side effects in your python code. Examples, pictures, and recipes on how to deal with dirty code with side effects.

Replace vague error messages with specific, actionable feedback that helps users solve problems.

It smells because there are likely many instances where it could be edited or improved.

In this guide, you will learn why it is important to write code comments, what are different code comment types, and the 4 best practices.

What

If you can't explain all your code, don't commit it.

TL;DR: It's time to spring clean your work-life, and make space for joy. Get rid of extraneous work, add a bit of mindfulness, and the WFH world is yours. You can do this regardless of who you are, but if you are the CEO or in a managerial position, the imperative is much higher.

In this article, I want to share my practice and tips about refactoring on Compose.

Many engineering teams get stuck and cannot ship quality software fast because of technical debt. The best engineering teams I've talked to use the right tools.

Programmers use Null as different flags. It can hint at an absence, an undefined value, en error etc. Multiple semantics lead to coupling and defects.

Architecture Decision Degradation (ADD) quietly kills velocity. Learn how it happens, the warning signs, and how to fix it with real-world patterns.

Code refactoring provides a well-needed mental break for developers, and I think many devs can relate to this. Writing code all day is very demanding, especially if you create new functionality day by day. It’s a taxing exercise, and developers often need some space to think about the codebase's overall organization and look back on what can be improved.

When you use mutable objects as keys in hashed collections, changing them breaks contracts.

Identifying smells in your code and debugging the easy way.

Yet more code smells? Aren't them enough?

Most of these smells are just hints of something that might be wrong. Therefore, they are not required to be fixed per se… (You should look into it, though.)

Eliminate unused functions, constants, and "just-in-case" code.

We all agree: a good name is always the most important thing. Let’s find them.

When you add flags like isTesting, you mix testing and production code. This creates hidden paths that are only active in tests.

Remove or replace getters with behavior-rich methods that perform operations instead of exposing internal state.

Don't waste time refactoring code that never changes; focus on frequently modified problem areas.

I stumbled upon a thread recently where the question was posed, “What are some common mistakes when refactoring code?”

I blog about clean code, refactoring and TDD. I have been working on the industry for the past 25 years

I asked a bunch of developers to share some of their horror stories of technical debt.

TODOs are a tricky subject for developers. Many codebases are guilty of having TODOs linger around while nobody knows who’s responsible for a TODO or even has the required context to tackle it. Yet, should we feel ashamed for our lingering TODOs?

How to debug your code the easy way

I see many Engineering teams under huge pressure to build fast and often lacking time to fix and clean up their codebase.

Send messages only to your direct acquaintances, not their friends.

More code smells for your reading pleasure

The most beautiful code, the most beautiful functions, and the most beautiful programs are sometimes not there at all.

Excessive concern about the beauty of the source code can compromise the outcome of a project.

Finding the stinky parts of your code--debugging and programming help for software developers.

Every software company has some amount of technical debt, which is additional development work created in the long-term by taking a shortcut in the short-term to get code out the door. Technical debt can take the form of poor design decisions, much-needed refactorings, technology upgrades, and outstanding bugs.

Code smells are a classic. It smells because there are likely many instances where it could be edited or improved.

The term Bug sounds like an excuse out of our scope infecting our systems. It is not. Software quality is under our control. It is our responsibility to deliver

You put multiple assertions in one test, making failures hard to analyze.

The importance of code refactoring is immeasurable since its purpose is to simplify the code for better performance. ⚡Use all the benefits now.

With much of the DevOps stack having matured and good practices becoming more mainstream, the need for quality in software has quickly become a central issue

Time is not absolute. Your code breaks when you treat it that way.

Are we done on code smells? Probably never!

The Y2K22 Bug is the consequence o very bad software design

It smells because there are likely many instances where it could be edited or improved.

Low-code is a means to develop applications with visual, intent-driven development tools reducing the need to create lines of custom code.

In this article, I’m not gonna talk about specific code refactoring details but some critical issues of this project.

Developers deal with technical debt every day, and they know how to prevent and manage it better than anyone else. Here’s just some of what they had to say.

Avoid methods that return Object, Any, or null instead of specific types. Make them fully polymorphic

Are we tired with code smells? Not yet!

Passing databases creates accidental coupling and breaks business encapsulation.

Refactoring is the process of restructuring existing code to improve its quality, maintainability, and readability.

Is your team still using Python 2? If you’re not sure, now is a really good time to check. In April, the Python team released version 2.7.18, and it will be the last version of Python 2.x. If security vulnerabilities or other bugs are discovered going forward, they will NOT be fixed. To ensure that your software is secure and functioning properly, it’s imperative to develop a plan for migrating to Python 3. Numerous strategies can be found online. This post outlines an approach that we recommend you take.

Imagine you have several blocks of similar layout which are hard-coded on the frontend side. These blocks are not dynamic, they are not being fetched from back-end, it’s just a layout. Most beginners, when they see similar blocks of layout, start to think about arrays as a tool to handle similar stuff.

More code smells incoming

Maximiliano Contieri from Germany has been nominated for a 2020 Noonie in the Software Development Awards Category for Hacker Noon Contributor of the Year - REFACTORING.

This another code smell chapter

Most of these smells are just hints of something that might be wrong. Therefore, they are not required to be fixed per se… (You should look into it, though.)

Let's talk about legacy code and its refactoring

Most of these smells are just hints of something that might be wrong. Therefore, they are not required to be fixed per se… (You should look into it, though.)

I was recently asked to answer the somewhat vague question, “How do you interact with a large undocumented code base?”

The smell of code smells is a classic, but you should look at it more carefully if you want to improve your code smell.

Refactoring is the process of changing the current codes of software to make it easier to understand and maintain without modifying its internal functionality.

Spaghetti describes code that is poorly structured and difficult to understand. It often involves deeply nested loops, excessive use of goto statements, and com

Yet more code smells? Plenty of!

Alex Omeyer from the United States has been nominated for TWO 2020 Noonies in the Future Heroes and Development award categories. Without further ado, we present to you, this big techy world, from the perspective of Alex - right after this ad break:

This is my talk at Tech Excellence on combining Artificial Intelligence and Clean Code

In many systems, the expiry date of a credit card is often represented by simply using a Date object. This can lead to potential issues and misunderstandings.

Code churn is a measure or indication of how often a file changes. It typically refers to how often a developer throws out code

Release early, release often — just don’t forget to refactor ;)

In the article, we cover the topic of code refactoring and discuss the value of the process.

Functions with unclear names hide intent and confuse readers. Use descriptive, action-oriented names.

When you model your identifiers with real-world concepts rather than database rows, you avoid exposing accidental implementation details.

We see several symptoms and situations that make us doubt the quality of our development. Most of these smells are just hints of something that might be wrong.

Jamal stared at his screen, perplexed by the convoluted SQL query he was trying to decipher.

Are you Developer doing FrontEnd? Are you using Webpack?

Repository: entronad/crypto-es

Use clear and concise regular expressions, and test them thoroughly.

This article will guide you through the process to craft a technical debt proposal to justify the time spent solving technical issues.

See how to use the Extract Method refactoring technique to get started on your journey to being more skilled at refactoring! Check out this C# code example!

Code is dependent on data and models, and therefore on the abstractions used in them, so refactoring is inevitable today. Why? Usually, refactoring means change

Most of these smells are just hints of something that might be wrong. Therefore, they are not required to be fixed per se… (You should look into it, though.)

Replace global variables with dependency injection to improve testability and reduce coupling.

Learn how to eliminate repeated code, enhance maintainability, and create a single source of truth with our DRY (Don't Repeat Yourself) principles.

When you store or compare passwords as plain-text, you expose users to unnecessary risk.

There are a set of skills and qualities which make the ideal software developer we are all searching to be or searching for to employ. However, right now I am going to emphasize the importance of a quality that is mostly found in senior developers.

An API might have a secure parameter that enables additional security checks when set to true. While this approach seems simple, it introduces several problems.

Warning: Setters Considered Smelly

You can break down a complex validation regex into smaller parts to test each part individually and report accurate errors.

How to replace static functions with object interactions.

Learn how to prevent unreliable tests by generating or mocking test data, ensuring full control over the testing environment and avoiding external dependencies.

There’s a lot of hype about ‘vibe coding’, but it’ll make you feel lighter if you do it more often.

Your code smells because there are likely many instances where it could be edited or improved.

Returning a successful HTTP status when the actual result contains an error confuses the API consumers.

In the bible of software engineering, Clean Code, comments are often characterized as failures to write expressive code.

Replace restrictive inheritance hierarchies with flexible object delegation

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live” — John F. Woods

Maintain clear version documentation, test versions thoroughly, and deprecate old versions gradually. This practice will ensure that your API users are happy.

Beginners are afraid to remove code. And many seniors too.

In the early hours of November 18, 2025, Cloudflare’s global network began failing to deliver core HTTP traffic, generating a flood of 5xx errors to end users.

More smells on the way.

Pass the essence to all your objects so they will not need to mutate.

Prevent chaining return statements for better code readability and flow.

Ternary metaprogramming uses conditional operators to select and invoke methods dynamically. It leads to code that's harder to understand, debug, and maintain.

We see several symptoms and situations that make us doubt the quality of our development.

Skipping status reports in conditional branches causes silent delays and race conditions.

Overusing implicit returns makes your code harder to read and debug.

We see several symptoms and situations that make us doubt the quality of our development.

If you use a separator to break the attributes, you need to make sure the separator does not belong to the domain, and you should escape it.

It smells because there are likely many instances where it could be edited or improved.

That little input() call might seem harmless, but it's quietly sabotaging your ability to test, debug, and grow your project.

In this episode, Maximiliano Contieri helps us understand the longstanding tension between academia and industry from an insider’s perspective.

Extract a common abstract class to mimic real-world structure.

Learn how to write reliable and professional-looking React code using "Wishful Programming" aka "Top-Down Code Design". Great for coders of all levels.

Replace nullable optional attributes with empty collections to eliminate null checks and leverage polymorphism.

Avoid assigning values you never use.

You can and should test private methods without using AI.

Wrap primitive arrays into domain-specific collection objects to improve type safety, reduce duplication, and better model real-world concepts.

Another new fancy AI tool. We keep getting closer to the singularity. But not on programming.

When machines generate large amounts of code, you need to apply one consistent style to all files.

It smells because there are likely many instances where it could be edited or improved.

Avoid combining the Visitor pattern with instanceof checks.

This story is about pain, agony, and denial of ready-made solutions. It is also about changes that improve the code’s readability and help the development team stay happy. The object of this post is an interface that helps a program communicate with a database.

I interviewed Adam Tornhill, CTO & Co-founder of CodeScene, about technical debt: what is it, why is it important, and how to manage it effectively?

Inevitably, we’ll someday come across legacy software, inconsistent databases, or integration modules that simply don’t work. It might sound wise to fix this software, especially if they’re crucial to the business. The problem that refactoring costs development and validation time, and the business does not always have this time to invest, but at the same time needs the fix. How can we both deliver the business requirements in time and still not break everything?

Subclasses should honor ALL their parent’s contract.

Don't use metaprogramming. It is not that cool.

Coding tutorials to help you in your coding life.

A real-world Agent Skills refactor: progressive disclosure, the 200-line entry rule, and workflow-first design to prevent context blowups and regain speed.

Creating a new exception without throwing it leads to silent failures.

Memoization can help you improve the performance of recursive functions involving redundant computations but compromise code readability and maintainability

Arrange your code so the main logic flows along the left margin, handling edge cases early with guard clauses.

Technical debt is a common term in software engineering management. It has been the target of debates for many years. The name comes from a financial analogy because some people defend that developers buy time by shipping faster (and with lower-than-expected quality).

Refactor and extract functions longer than 5 lines. Here's how.

Pass essential attributes during object creation to reduce mutability and eliminate getters and setters.

Bloated setup that's only partially used makes your tests more coupled and harder to understand.

  1. Identify methods that receive owned attributes
  2. Remove those parameters from the method signature
  3. Replace usage with direct access to the attribute

Your code smells because there are likely many instances where it could be edited or improved.

Avoid hallucinated or fake packages that can compromise security and stability.

A major security flaw, PKfail, persisted unnoticed for 12 years, compromising hundreds of devices.

This article highlights the critical need for fail conditions in tests expecting exceptions.

Use separate exception hierarchies for business and technical errors.

You should avoid storing stateless utility classes as instance variables initialized with new.

Make your code simpler and more maintainable by removing redundant or unused annotations.

Be explicit when creating tests to ensure clarity and maintainability.

Avoid using prefixes on collections whenever possible.

Using sets for attributes simplifies your code and makes state management easier.

Discover why cryptic code hurts readability, security, and trust in your software.

Breaking Free from the Evil Singleton

Use real abstractions and real objects instead of accidental string manipulation.

Missing return statements cause unexpected behavior.

Learn how declarative code improves readability and maintainability by simplifying logic and reducing verbose loops.

Wrap messy parameters into a single meaningful entity.

Your code smells because there are likely many instances where it could be edited or improved. Most of these smells are just hints something might be wrong.

You map concepts to optimized numbers.

You reference external AI conversations to explain code instead of writing declarative tests

What is refactoring? Why do we go through the trouble of improving code that works?

Avoid Magic numbers without explanation. You don't know their source and are very afraid of changing them.

The 2020 Noonies are here and they are both much greener and much bigger than last year. Among the 2,000+ deserving humans nominated across 5 categories for over 200 award titles, we discovered Maximiliano Contieri from Argentina, who’s has been nominated for in the Software Development category. Without further ado, we present to you, our big techy world, from the perspective of Maximiliano .

Don't comment on what you are doing. Name what you are doing.

Explore strategies to tackle technical debt and enhance code quality. Learn to balance business goals with refactoring for long-term success.

5/12/2025: Top 5 stories on the HackerNoon homepage!

Your code smells because there are likely many instances where it could be edited or improved.

12/5/2024: Top 5 stories on the HackerNoon homepage!

Alex is a software engineering veteran with over 30 years of hands-on professional experience. He is a staunch advocate of Extreme Programming and TDD.

God Objects form when you concentrate too many responsibilities in a single class.

8/11/2025: Top 5 stories on the HackerNoon homepage!