What is a legacy code?

43

I've heard that term from some people's mouths, but I'm not usually good with these technical terms.

What would a legacy code be?

Is it related to outdated code?

    
asked by anonymous 11.01.2016 / 16:02

7 answers

39

TL; DR

There is no exact definition of what is legacy, but the meaning goes in the sense of an old code or produced with technologies already retired or old techniques, often difficult to maintain and control.

Legacy code, it can be that code produced in a language or platform where the manufacturer has already discontinued the support of new functionalities and / or security or that existing bugs will not be fixed, the programmer must circumvent these situations or create a patch if the platform / language / framework is open-source. The best alternative would be to isolate the problematic code and rewrite it with modern technology and integrate it into the old system.

Another situation where code can be considered legacy (in the sense of damn inheritance) is when the software has already been built and after a while all the original members of the project no longer work on it, the 'newbies' in charge have no concept at all of the project context, internal architecture work etc. Normally there is no documentation or the existing one is already completely out of date.

The definition of Michel Feathers, author of Effective Work with Legacy Code is

  

Legacy code is the one without tests.

The above sentence is very suspect, since one of the subjects discussed in his book is how to test legacy code and add unit tests.

Factors that are killing the code over time are lack of preventive maintenance or refactoring, client freezing of the platform no version update can be made due to some bizarre project requirement or certification policy, drastic changes in the architecture, every part of the software gets in a way this is also known as lava flow . All this combined turns any change, complicated because it is difficult to calculate side effects and to make matters worse there is no homologation environment so the change goes straight to production.

Related:

12.01.2016 / 00:57
33

So the Programmer Master said: That the programmers are many and the managers few - then everyone will be productive.

Legend has it that in a far-flung province there was a monastery where Master Programmer shared his teachings. One of his dialogues was about legacy code.

Master , asked the proud engineer of the court of Lao, ' Why legacy systems are used? Usually when read with legacy systems, I feel they lack Zen: They're like karesansui 1 who, in an abandoned house, are disfigured by time and carelessness. Forgotten, disconnect from the nature of the business;

' The answer is a reflection of the heart of the engineer ,' began the master. He then stood up, followed by the disciples who accompanied him on that spring morning where the mists of the morning still hung.

Then began a walk, which took them up the hill to the edge of the forest. Finding a place in the sun in the surrounding grass where the morning dew still lingered, he turned around and sitting on a nearby stone, began to observe the city in front, whose delicate roofs stretched as a handful of jewelry in a bag of jade color.

To his left, bordering the road where the places passed - here, a mother carrying a basket of bread, a baby in tow; there, a samurai with the purposeful stride of someone on an important mission given by your daiymio - a pillar of wood rose, decorated with Shinto reasons and a poem in style haiku :

  

く も と へ だ つ と も か や か り の い き わ か れ Filmography Clouds separate us - the time to leave arrived. The wild goose takes flight. 2

' This is the fourth incarnation of this city ', said the master, returning to the subject. ' Before the current name, others were used: other engineers, from the top of this ravine, observed the space in front of them - other constructions, other people, other times. The engineers who erected that pillar have long gone; his art is now appreciated elsewhere, or withdrawn from the pleasures of the world.

Fires swept the buildings of wood and bamboo; court dignitaries changed the official residence of address, size, color, shape and purpose; the fort that was built at the time of the war was converted into a warehouse.

Meanwhile the stone pit in the central square is the same - because its purpose is clear, its implementation simple, and its function perfectly observed. That's one of the reasons.

The mansion abandoned in the forest, also ancient, has another reason to be. Legends say a yōkai inhabits; soldiers avoid their surroundings, and mothers use it to contain the curiosity of their own offspring with stories of missing children.

The city in front of us is like a fabric of fibers from various eras, in a plot that tells at the same time the stories of the old and the new. Zen persists not in individual aspects, but in its daily life, in the life that inhabits its streets of varying widths.

The nature of legacy systems is similarly derived from respect for functionality or fear of the consequences of dealing with the unknown.

But the engineer was dissatisfied with the answer. ' But would that be the ideal, Master? Recently I returned from Edo, and the city stood magnificently - all new buildings, their varnishes glistening in the sun.

The master then replied: 'Not every city has a coffers as full as the Emperor, who can afford to rebuild a city at his pleasure. What would Zen be, in this case? Where would the balance between will, goal and achievement be? Would not the scene in front of you be perfectly balanced? '

The master and his followers continued to admire the city and its buzz. After a few minutes of contemplation, the engineer smiled. He had accepted the nature of the argument; with his new eyes, in front of him, the small town gleamed in perfect balance in the morning dew.

#, 1671

    
20.02.2017 / 16:40
30

It is a code that was already present before the code you want to write now and is related to the code you want to write now, but it was not written foreseeing this relation.

In general, the legacy code does not have an easy or obvious integration mechanism with this code that you want to write now.

Related expressions: legacy applications or legacy systems . The concept is the same: you need to write new applications that somehow relate to those that were already there (either integrating with them or replacing them).

Legacy code is outdated code?

Not necessarily, but usually yes, because the expression takes place precisely when it comes to the challenges of integration or replacement of the legacy.

If we need to replace, or if instead of expanding the existing we will integrate new algorithm, then it is likely that what is there (the "legacy") is "outdated".

It's important to note that "outdated," either needs to be replaced or can not be expanded, does not always mean it's bad.

In other words, the legacy is not always bad or badly done . There are several other reasons to replace a tool or use new ones to integrate with it instead of expanding it.

    
11.01.2016 / 16:16
14

The term can refer to two situations:

  • Code reuse, usually refers to supporting an old code or a code maintained by those who did not develop it, this means that the code does not necessarily have to be old.

    These are the correct uses for the term legacy code also being able to call legacy code .

  • The word lag , between gamers it is common to use the term Lag

      

    Latency At Game - in-game latency

    The word Lag is likely to have a "LOOKED" sound with Légui mixed or confused with the term legacy (meaning inheritance) and due to misuse it ended up that many use the term código legado to refer also to codes with performance or build performance problems.

    In this case, it is preferable to avoid bad habit and use terms like Performance, Latency, and Oscillation.

Legacy or legacy code

As already said, the code can be maintained by a person (or team) who did not develop it and only gives a little support about the code or is responsible that should create an alternative to it, but maintaining the functionality necessary.

It can also refer to a code written in a language where no one else is developing (being inside a company or not), however the code is still used.

One example I found interesting was this:

  • When is code "legacy"?

    It usually means that the code is written in a language or based on a system you do not usually do in new development .

    For example, most places do not write new programs in Cobol. However, a large part of your business can run in applications written in Cobol. So these applications are labeled "Legacy."

12.01.2016 / 00:39
3

This is a definition of my own: "Legacy is one that is inherited and you do not have enough confidence to modify it." All created code has the potential to become legacy, yes. But not all created code becomes legacy. In Goodliffe's book "How to be a better programmer" explains if a code is maintenance-free, it tends to disappear from the company, either by another internal tool or by vendor software. This can also be a good definition.

    
20.02.2017 / 03:46
1
  

Legacy.

     

s.m. What is passed on to the generations that follow.

When you join a company, it is referred to as legacy code any code that you are required to maintain and which has not been involved in initial development. It may have been written by programmers who are no longer part of the company's staff or older programmers on the team who will now devote their time to other projects.

    
20.02.2017 / 13:23
0

Legacy code is one implemented in part or in full using some old technology in relation to current technology. This is my definition. One of the reasons I see for this type of code is the limitation of the computational system where project is running.

    
20.02.2017 / 17:11