Refactoring vs Rewriting a Mobile App from Scratch

To refactor or rewrite?

That is the question. If you’re not sure of the best way to revitalize your application, you’re not alone. Altering and updating code is a unique skill set that even many experienced developers don’t develop.

But if you’re considering rewriting or refactoring your mobile app code, you probably have a solid reason to do it. Let’s put the idea to rest that there’s a clear-cut, definitive rule about what’s the best choice. Every project is different.

There are often ways to make an app run and load faster. But boosting performance or adding in new features often leaves app owners with a tough choice.

To assist, we’re breaking down refactoring vs rewriting. This article has everything you need to make an informed decision for your project with definitions, pros, cons, the questions you should ask, and what to consider.

Defining Refactoring

You’ve probably heard of code refactoring before. However, it’s a concept with many definitions. And it can be complex to describe based on what you’re doing and the technical expertise of whom you ask. For our purposes, we’ll keep things at the most basic level and not dig into the technical caveats. 

Refactoring is updating the code of an app. Typically, this involves restructuring things so that future updates are easier to implement. Developers can reduce the complexity of the code and even use new technology or updated versions of third-party libraries to refactor. 

There may be some rewriting involved on a small scale. But a developer will usually only adjust functionality on a system-by-system basis to work with updated architecture. 

One of the biggest misunderstandings around refactoring is that you’ll reach an endpoint where the app’s structure is perfect. But refactoring can get messy. You should view it as more of a technique for development as opposed to a completed design.

As stated, the definition of refactoring shifts based on what you want to accomplish. It can range from fixing a specific system in an app all the way to a full-on cleanup. For this article, we’ll define it simply as taking code and making it better.

Defining Rewriting

Coming up with a definition for rewriting is more straightforward. As the title of the article states, it’s rewriting an application from scratch or taking an application and writing it as you want it. But let’s break that down a little more. 

When a developer rewrites, they take the coding process from a blank slate and build something new. There are no limitations from existing code — no refactoring. And a developer can implement newer technology or third-party libraries directly into the newly written architecture. 

It’s a clean slate with no legacy code — leftover code to update. And it’s possible to use new frameworks and code language from the start. It’s also an opportunity for a developer to avoid previous mistakes and develop and test with fresh eyes. 

Many developers may encourage rewriting as it presents an opportunity to start fresh without having to fix previous mistakes. However, rewriting comes with its own set of challenges. Even waited 16 years before rewriting the original site from PHP to their own proprietary language.

Refactoring vs rewriting pros and cons

Refactoring Pros

  • Developers can take each step as a separate aim and work carefully in a targeted manner.
  • Even if you completely drop the refactor halfway through the process, cleaner code will still exist in the architecture.
  • Often, developers can send updates as milestones.
  • It’s possible to test fixes and new features against the existing application.

Refactoring Cons

  • It’s difficult and often impossible to change libraries or frameworks.
  • Refactoring can improve the code, but it won’t fix underlying problems with the architecture.
  • It has a lot of costs associated with testing to ensure the app can do what it did before with no issues.
  • It’s old tech, so finding a developer may be more difficult.
  • Sometimes it takes more time than rewriting.

Rewriting Pros

  • A rewrite involves experience, so you’ve — hopefully — learned from previous mistakes.
  • No need to adjust old code to new technology. You can implement it from the start.
  • Auto-removes all instances of legacy code which can be buggy
  • Offers a fresh start which can have a positive influence on quality and productivity.

Rewriting Cons

  • A rewrite is not a refactor, so there isn’t much to update users about during the process — the potential for low retention.
  • Takes a lot more time during the planning phase. 
  • The app must offer benefits. It’s pointless to rewrite an app if it has less functionality than the original.
  • You lose customer support on the app, as the developer’s focus will shift completely to the rewrite.

Refactor existing code or rewrite from scratch: what to take into consideration

There are a lot of pros and cons, but there’s no definitive answer. With that in mind, let’s look at the things to consider when thinking about refactoring or rewriting from scratch.

Time and Cost

No matter how clear the plans are for a rewrite, there are no guarantees everything will work perfectly. It always takes longer to rewrite an app than it does to refactor it. Therefore, time and cost should be key considerations when choosing whether to refactor or rewrite. 

Legacy App

When refactoring, a developer can continue to support the current application for your users while refactoring the code. This actually goes in the ‘pros’ column for refactoring. But if you want to rewrite a code, you’ll need to divert resources to the development of the new application. If you don’t have the resources to support the legacy app while rewriting the new one, this can be an issue to consider.

System

Functionality between systems doesn’t always work, so it’s a key consideration when choosing refactoring or rewriting. If you want to use a new library or technology in your app, but it doesn’t translate to the old application, the project already made your choice.

What questions should I ask to make the right choice?Here’s a list of questions to ask when choosing between refactoring or rewriting:

  1. By refactoring now, how long does it keep the app running at full capacity?
  2. If you want to add new technology to an app, can the language of the app understand the new technology language?
  3. Do I have the time and resources to devote to a full rewrite?
  4. If I rewrite, will the app perform better than the original?
  5. What’s the status of the architecture of the app?
  6. Is there a record of documentation and comments for the original development of the application?
  7. Is the application broken in the first place? What’s the advantage?

Conclusion

If you’re considering rewriting or refactoring a mobile application, it can be an overwhelming experience. Hopefully, the information in this article can help you lean towards the best choice for your needs.

But if you’re still unsure, contact PURPLE! We make software development easy, and our team is ready to help you make the best choice for your business.

Are

you

ready

to

join

our

software

playground?

Are you ready to join our software playground?

Are

you

ready

to

join

our

software

playground?

Before we craft your solution, we want to get to know you and understand your needs. We’ll review your application and schedule a call as soon as possible.

This field is required
Please provide a correct email
This field is required
Submit
Thank you for submit, we will get back to you soon!
Oops! Something went wrong while submitting the form.