DEV Community

This is the feeling of working with legacy code.

Theofanis Despoudis on June 29, 2018

A long time ago when I started my career as a developer I had both the unfortunate and fortunate experience of working with existing code - that is...
Collapse
 
sudiukil profile image
Quentin Sonrel

<?php

I stopped there, I believe you 😂

Collapse
 
thebouv profile image
Anthony Bouvier

New and shiny code today is the legacy code of tomorrow.

Collapse
 
mfp22 profile image
Mike Pearson

True, but that code sucked back then too.

Collapse
 
alainvanhout profile image
Alain Van Hout

I once came across a developer that was able to write 'instant legacy' code.

Collapse
 
drewknab profile image
Drew Knab

Yep, this.

I once inherited a PHP application in a single index.php that echo'd four or five different HTML pages depending on a post back to itself and whether it was post or get and then the contents of the post or get.

All of the business logic looked exactly like this.

Collapse
 
okolbay profile image
andrew

I once wrote an application like this. I guess we all have dark pages of our history )

Collapse
 
aksel profile image
aksel

He goes on to say that code becomes "legacy" because it works, and no one wants to change something that works, and his goal anytime he's writing software is to make it so good that it'll one day become legacy.

That's a pretty cool way of seeing things. Of course, it wouldn't always work on a large scale, where the requirements can change much later on. But when working on something isolated, some specific functionality, I think it's a good mantra.

Collapse
 
catriname profile image
catrina • Edited

i'd have to say this actually looks clean? you have to take into context the time frame it was created and what was available then. "front end" development didn't exist in the slightest.

i inherited asp (classic) legacy code and grew through php that looks much like this and couldn't go past certain versions because of the "zend" restrictions/legacy connections. it is the reality of being a developer.

thanks for posting something so raw. it really gives people a grasp of what code is actually out there!

Collapse
 
theodesp profile image
Theofanis Despoudis

It was in 2013, at least we had Angular.js

Collapse
 
31547 profile image
31547 • Edited

this HURTS. what hurts worse is that when i first got into web development and backend development by screwing around on php5 when i was 13, i did exactly this.

hurr, whats an API??? MVC??? :thinking:

Collapse
 
scottishross profile image
Ross Henderson

I know the feeling! I inhereted a HTML4 site that was based on a Wiki Site. Had to strip that all out and bring it into HTML5!

Collapse
 
joshcheek profile image
Josh Cheek

Always fun to see the Gilded Rose in production! ❤️

Collapse
 
theodesp profile image
Theofanis Despoudis

In that case, it's more than a stripped Corpse flower. The gilded rose can be refactored easier.

Collapse
 
joshcheek profile image
Josh Cheek

Gilded Rose is as logically as gnarly as this, the reason this is harder to refactor is b/c it's (presumably) untested and it depends on web requests and a database.

Collapse
 
thebouv profile image
Anthony Bouvier

And just like people, it rots.

:D