Click here to Skip to main content
16,004,535 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Legacy Code Documentation Pin
MarcusCole683331-Jul-24 7:12
professionalMarcusCole683331-Jul-24 7:12 
GeneralRe: Legacy Code Documentation PinPopular
snorkie31-Jul-24 4:45
professionalsnorkie31-Jul-24 4:45 
GeneralRe: Legacy Code Documentation Pin
jmaida31-Jul-24 16:04
jmaida31-Jul-24 16:04 
GeneralRe: Legacy Code Documentation Pin
honey the codewitch31-Jul-24 23:38
mvahoney the codewitch31-Jul-24 23:38 
GeneralRe: Legacy Code Documentation Pin
snorkie1-Aug-24 2:31
professionalsnorkie1-Aug-24 2:31 
GeneralRe: Legacy Code Documentation Pin
Matt Bond1-Aug-24 2:37
Matt Bond1-Aug-24 2:37 
GeneralRe: Legacy Code Documentation Pin
iplaykeys1-Aug-24 3:45
professionaliplaykeys1-Aug-24 3:45 
GeneralRe: Legacy Code Documentation Pin
Jeremy Falcon31-Jul-24 6:02
professionalJeremy Falcon31-Jul-24 6:02 
MarcusCole6833 wrote:
Is it Maintained?
Legacy code or not, if the code is updated the docs for it should be updated.
MarcusCole6833 wrote:
Do you look for it or just explore the code?
It should be a part of the code. jsdoc or doxygen style comments should be littered all throughout the code. There should also be READMEs in the project. No point in having to hunt down an external resource that would only get stale.
MarcusCole6833 wrote:
What do you do if it is not there?
Ask why it's not there with the original devs. If I'm now responsible for said legacy code and if there is some documentation somewhere then I'll try and add it to the project.
MarcusCole6833 wrote:
Is the code documenting itself good enough?
No. This goes back to the age old "what makes a good comment" issue. People that say code is always self-documenting are just wrong. They've never worked with other humans and certainly was never a professional dev.

What makes a good comment? Not stuff like this:
JavaScript
// set x to 5
let x = 5;
Well no duh. That is self-documenting and obvious, but stuff like this always isn't:
TypeScript
// keep the raw data for these, also bands should use the population
const average = [...simpleMovingAverage(sample, range)].pop()?.actual ?? 0 as Price;
const band = standardDeviation(sample.map((x: Market) => x.close), true).actual * deviations;
Not everyone maintaining the code may know off the top of their head the note about how something should be implemented. One could argue RTFM, but let's be realistic... people maintaining code do not Google every last line of code. Also, there may be no well-known manual for some things.

It's easy for someone to "fix" it and break it and even get past a PR. So, when you do something that may be considered unusual or haphazard or just only known by a select few having a comment should present to make it explicit. As such, I don't consider code always self-documenting in the real world.
Jeremy Falcon

GeneralRe: Legacy Code Documentation Pin
Maximilien31-Jul-24 6:49
Maximilien31-Jul-24 6:49 
GeneralRe: Legacy Code Documentation Pin
CHill601-Aug-24 2:32
mveCHill601-Aug-24 2:32 
GeneralRe: Legacy Code Documentation Pin
Jeremy Falcon1-Aug-24 6:42
professionalJeremy Falcon1-Aug-24 6:42 
GeneralRe: Legacy Code Documentation Pin
RickZeeland31-Jul-24 7:43
mveRickZeeland31-Jul-24 7:43 
GeneralRe: Legacy Code Documentation Pin
jeron131-Jul-24 7:54
jeron131-Jul-24 7:54 
GeneralRe: Legacy Code Documentation Pin
RickZeeland31-Jul-24 8:14
mveRickZeeland31-Jul-24 8:14 
GeneralRe: Legacy Code Documentation Pin
jeron131-Jul-24 8:27
jeron131-Jul-24 8:27 
GeneralRe: Legacy Code Documentation Pin
0x01AA31-Jul-24 9:01
mve0x01AA31-Jul-24 9:01 
GeneralRe: Legacy Code Documentation Pin
kmoorevs31-Jul-24 9:16
kmoorevs31-Jul-24 9:16 
GeneralRe: Legacy Code Documentation Pin
Greg Utas31-Jul-24 10:36
professionalGreg Utas31-Jul-24 10:36 
GeneralRe: Legacy Code Documentation Pin
trønderen31-Jul-24 11:31
trønderen31-Jul-24 11:31 
GeneralRe: Legacy Code Documentation Pin
Jeremy Falcon31-Jul-24 11:51
professionalJeremy Falcon31-Jul-24 11:51 
GeneralRe: Legacy Code Documentation Pin
charlieg31-Jul-24 11:10
charlieg31-Jul-24 11:10 
GeneralRe: Legacy Code Documentation Pin
trønderen31-Jul-24 11:22
trønderen31-Jul-24 11:22 
GeneralRe: Legacy Code Documentation Pin
trønderen31-Jul-24 11:21
trønderen31-Jul-24 11:21 
GeneralRe: Legacy Code Documentation Pin
charlieg31-Jul-24 12:02
charlieg31-Jul-24 12:02 
GeneralRe: Legacy Code Documentation Pin
jana_hus31-Jul-24 15:57
jana_hus31-Jul-24 15:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.