6 Tips For Tackling Inherited Code

Default avatar.
May 07, 2019

When you’ve worked in the digital industry for long enough, eventually you’re going to have to work with code that you’ve inherited from someone else. Whether this is part of a handover process from another company, written by a developer that has since moved on or written by a freelancer, sooner or later you’ll find yourself sifting through line after line of code that you didn’t write.

When this happens it’s easy to slip into a negative mindset. It might be using a structure you are unfamiliar with, seem over-complicated, disorganized, or just different to your regular development approach — it’s rarely plain sailing.

Something built using a slightly different approach can quickly become unmanageable

It’s not my fault, It’s already a mess” - letting yourself off easy with this type of attitude can create a Frankenstein’s monster of a website if you’re not careful. Something built using a slightly different approach can quickly become unmanageable if every developer who works on the project adds their subjective approach. Whether it be naming conventions, class identifiers or even JavaScript functions.

Below are some tips to help you prepare for and manage inherited websites and see them as something to nurture rather than dread.

1. Ask Nicely for Documentation

Documentation for a site will often exist somewhere in some form. Hopefully! It may be out of date but anything is infinitely better than nothing. When receiving the codebase for a site, always make sure this question is raised early to ensure that any and all documentation is provided during the handover process.

2. Invest the Time Early

Take the time to understand the code you have received. Don’t just glance at it. Invest the time to really look at the file structure, CMS, task runners and whether or not the site is relying on any template engines.

Older sites…can often carry a lot of excess baggage

This would be a good time to start some documentation for the site if it doesn’t already exist, or add your own notes to any existing documentation.

You won’t be able to successfully carry out updates to a site you don’t understand. The result will be obfuscated, bug-ridden code that will only lengthen the time required to carry out even the smallest of tasks.

Make sure you know the site map, how many pages there are, and where the code for those pages is within the structure. This will help you to identify any obsolete or unused code that can be stripped out. Check for unused JavaScript libraries too. Older sites, or sites that have had multiple developers or agencies working on them, can often carry a lot of excess baggage. Anything you can tidy up or clear out will undeniably benefit the site’s longevity.

3. Tackle Unknown Functionality

Don’t wait for it to break! Take a look at any scary functionality on the site and make sure you’re fully aware of any and all complex API integrations. Make sure these are understood and documented clearly.

When working with this functionality, add or update comments in the code to make it clear what functions are doing what and why; saving yourself and others from having to figure it out every time the project is picked up.

4. Keep it Consistent

Learn the system and adjust your code writing habits to fit the current style. Familiarize yourself with reusable classes and functions so you aren’t duplicating any code. This will help reduce overall bloat, increase longevity and improve readability if the site is passed on to another development team.

Adding your own coding methods to an inherited site will make it much harder for other developers to pick up; so although adapting your approach might seem counter-intuitive, a willingness to be flexible is really beneficial here.

5. Spend Some Time in the Analytics

It’s important to familiarize yourself with as much of the site as possible, and digging around in the analytics can give you a lot of useful information. Get to know what devices users are viewing the site on and which browsers require support. Having this knowledge early on means you are prepared when new work comes through and know what fallbacks to put in place and can be prepared for testing.

Always run the site through a site speed test to flag any major performance issues. There may be a few quick wins you can implement to improve the site — such as optimizing large images or minifying CSS or JavaScript files.

6. Don’t Use “Someone Else Built it” as an Excuse

We need to get ourselves out of the habit of writing bad, lazy code because ‘it’s already a mess’. Creating a nightmare project is not something your wider team will want to touch. We’ve all written code we weren’t particularly proud of at some point, often for reasons outside of our control.

We’ve all written code we weren’t particularly proud of…

Tight deadlines, scope creep, and difficult clients are just a few factors that can affect the quality of a site build. Move away from looking for someone to blame and focus on ways you can improve what you have. Always take pride in your work.

The time and effort you put into any site, whether building from scratch or inheriting, pays off in the long term as it creates a readable, maintainable project. You, the team around you and the client will benefit enormously from having a positive attitude towards inherited sites.

So the next time you find yourself having to pick up someone else’s code (before you roll your eyes and start muttering obscenities to yourself) run through these tips and you may just turn a potential nightmare project into a breeze.

Lucy Carter

Lucy Carter is a Web Developer at Stickyeyes and also helps out at a Leeds-based Code Club, teaching children how to code. When she’s not crafting magnificent websites she tends to be climbing big hills.

Read Next

3 Essential Design Trends, November 2024

Touchable texture, distinct grids, and two-column designs are some of the most trending website design elements of…

20 Best New Websites, October 2024

Something we’re seeing more and more of is the ‘customizable’ site. Most often, this means a button to swap between…

Exciting New Tools for Designers, October 2024

We’ve got goodies for designers, developers, SEO-ers, content managers, and those of you who wear multiple hats. And,…

15 Best New Fonts, September 2024

Welcome to our roundup of the best new fonts we’ve found on the web in the previous four weeks. In this month’s edition…

3 Essential Design Trends, October 2024

This article is brought to you by Constantino, a renowned company offering premium and affordable website design You…

A Beginner’s Guide to Using BlueSky for Business Success

In today’s fast-paced digital world, businesses are always on the lookout for new ways to connect with their audience.…

The Importance of Title Tags: Tips and Tricks to Optimize for SEO

When it comes to on-page SEO, there’s one element that plays a pivotal role in both search engine rankings and user…

20 Best New Websites, September 2024

We have a mixed bag for you with both minimalist and maximalist designs, and single pagers alongside much bigger, but…

Exciting New Tools for Designers, September 2024

This time around we are aiming to simplify life, with some light and fast analytics, an all-in-one productivity…

3 Essential Design Trends, September 2024

September's web design trends have a fun, fall feeling ... and we love it. See what's trending in website design this…

Crafting Personalized Experiences with AI

Picture this: You open Netflix, and it’s like the platform just knows what you’re in the mood for. Or maybe you’re…

15 Best New Fonts, August 2024

Welcome to August’s roundup of the best fonts we’ve found over the last few weeks. 2024’s trend for flowing curves and…