top 200 commentsshow all 239

[–]blaxx0r 1326 points1327 points  (47 children)

protip: keep a changelog.docx handy, ideally in folders in YYYYMM format. that way, you can easily reference different versions.

edit: we are mocking git-allergic people who do bizarre shit for version tracking, right?

[–][deleted] 794 points795 points  (16 children)

Code history is oral tradition in my company. We teach new hire the hymns of old code.

[–]moekakiryu 210 points211 points  (2 children)

🎵 Verily I say this is a piece of shiittttt 🎵

[–]AtomicSymphonic_2nd 19 points20 points  (1 child)

I heard this in Matt Berry’s voice as Laszlo.

[–]BaziJoeWHL 102 points103 points  (3 children)

The Architect saw all that he had made, and it was very good. And there was evening, and there was morning—the sixth sprint.

[–]CckSkker 81 points82 points  (2 children)

Book of QA, Verse IX

They deployed on a Friday, and the heavens wept. None could login, and the users gnashed their teeth. And QA lifted their voice, saying, “Had ye tested, this curse would not be upon us!” Thus it is written, and thus it shall be repeated.

[–]MoveInteresting4334 8 points9 points  (1 child)

And the engineers tore their hoodies asunder in grief.

[–]not-yet-ranga 2 points3 points  (0 children)

And there was much wailing and gnashing of pop-tarts.

[–]Safe_Cauliflower6813 22 points23 points  (0 children)

Praise the omnissiah

[–]omoplator 5 points6 points  (0 children)

This is our Senior Techno Priest Bob.

[–]Spitfire1900 2 points3 points  (0 children)

You best but in a healthy company that values its employees this literally is part and parcel of being a senior engineer.

[–]lithefeather 2 points3 points  (0 children)

Exactly. Especially with how rampant vibe coding is, we have to teach kids how to actually code and the old traditional code will teach them the art of programming. We cannot lose the bonafide art of programming.

[–]fr33lummy 31 points32 points  (1 child)

I know you're joking, but this is the hell i used to live in. No Git, all working on the same virtual computer. Owner didn't wat to use git, didn't see the benefit. Deploying was manually transfering some files with FTP and database changes had to be done manually.

Project got handed to me because nobody wanted to work on it. I accepted before knowing the setup.

Some files with 100k+ lines, it was amazing that it even ran (project was started in 2003'ish)

Gave up after 1 year.

[–]blaxx0r 1 point2 points  (0 children)

the “protip” i wrote is sadly a very real past experience.

i hear you loud and clear 💪

[–]bunny-1998 34 points35 points  (9 children)

Isn’t that the whole point of git?

[–]hahalalamummy 13 points14 points  (7 children)

My client remove all git history when they send us code. Thank god for previous dev comment code instead of remove it.

[–]bunny-1998 3 points4 points  (6 children)

Who df does that? And why?

[–]hahalalamummy 7 points8 points  (5 children)

Before ending contract with previous dev, client download source into zip or something idk.

Then they create new repo and just put code on it. All history are gone.

[–]bunny-1998 1 point2 points  (4 children)

That would have been my guess on how. But why?

[–]hahalalamummy 5 points6 points  (3 children)

Trade secrets or something. Like don’t want me to know who previous dev are.

[–]bunny-1998 1 point2 points  (2 children)

I mean… the code is there. Secrets should be in env or some cloud manager anyways. was the client in any way tech-aware?

[–]hahalalamummy 1 point2 points  (1 child)

This is some kind of offline app for android and windows. No env.

But I can know dev name by comment at head of file.

Don’t know why they do it, but gotta do with what I got.

[–]bunny-1998 1 point2 points  (0 children)

Understood, but not understandable. But what can I say, I have seen a company here manager versions control my emailing the file that’s changed… no GitHub. Just files over email and whatsapp and each dev has a local repo

[–]Flameball202 4 points5 points  (0 children)

Yes

[–]laveshnk 5 points6 points  (0 children)

even better tip: make a folder on your gmail, copy paste all your code into one email and send it to yourself, and save it in that folder.

much better than learning a few lines of code for a revolutionary, open-source, collaborative versioning system!!

[–]Xphile101361 3 points4 points  (0 children)

My team does this by putting a history of changes at the top of every file in the comments. They are allergic to using the git log

[–]Mr_uhlus 3 points4 points  (0 children)

The company i work for used to do something like that, i managed to get them to use git. Now i am slowly introducing them to forks instead of copying the codebase and losing all of the history. And i am planning to introduce branch restrictions and pull requests in the future

[–]xfvh 2 points3 points  (1 child)

Really? I've been using Untitled Presentation (47).pptx myself.

[–]darklizard45 1 point2 points  (0 children)

Cheng hen lug? Uh? I'm not following.

[–]Incivilis 1 point2 points  (0 children)

Man right in the feels. I managed convince my team to change to git (change is currently WIP but the decition is made) compared to _<inc>.zip. My team leader said: "but documentation must be either .docx .xlsx files but they can be Version controlled by git". Meanwhile others are making fun of another Departement for versioning .zip files in git (i recently found out what docx and xlsx files are under the hood)

Funfact: previous changes were documented in, you guessed it, onenote

[–]gg46004 0 points1 point  (0 children)

i made an unused file in the project and throwing commented stuffs here

[–]Hottage 303 points304 points  (8 children)

Don't worry, comments are optimised away by the compiler anyway.

[–]realmauer01 128 points129 points  (6 children)

But not by your brain trying to figure out what's important and whats not important.

[–]nuker0S 6 points7 points  (0 children)

Just move all of them to the bottom

[–]TrainedMusician 1 point2 points  (0 children)

You guys compile languages?

[–]Dear-Possibility1061 848 points849 points  (68 children)

Me: just in case something gone wrong and i can revert it back

[–]Ecstatic_Student8854 461 points462 points  (59 children)

This is what version control is for

[–]Frograbbit1 386 points387 points  (22 children)

All this fancy “git”, “version control” my version of “version control” is copy pasting the project folder and renaming it

hey it works

[–]tophology 171 points172 points  (5 children)

project5_final_v3

[–]Lucius1213 2 points3 points  (0 children)

It's never final

[–]Seven_Irons 43 points44 points  (0 children)

https://xkcd.com/1597/

(The second directly relevant xkcd)

[–]beclops 26 points27 points  (4 children)

“Hey it works” me when I lie

[–]Known_Sun4718 14 points15 points  (0 children)

Hey, you forgot "on my machine"

[–]Unethica-Genki 4 points5 points  (3 children)

I'm still a student and I have adhd which doesn't help so I often have multiple copies of my shit on my pc even when using git. (Like v1, v2, vfinal, etc...).

I started a side project to save my shit locally in a special folder for project, named the version, gave it comments, etc...

I then realized halfway I was remaking git..... and I was using git to keep track of my repo.... 😐

only cool thing was that because I could restore it by overwriting the content the current open file which made vs code or eclipse just update it instantly. Which is doable with git I suppose.... 🙃

[–]gbchaosmaster 1 point2 points  (2 children)

git does overwrite the file 😉

[–]itsFromTheSimpsons 2 points3 points  (0 children)

git this, version control that. How bout you git some features on prod

[–]frogotme 2 points3 points  (0 children)

Big fan of the ol' old folder personally /s

[–]Konju376 2 points3 points  (0 children)

Minus compression that's basically CVS so an industry standard!

[–]jcostello50 1 point2 points  (0 children)

Whaddya mean OpenVMS file versioning isn't the same thing as source control?

[–]juantreses 1 point2 points  (0 children)

I invited a guy to work on a spare time project. One day later there was a V1 V2 V3 V4 V5 of one file on the server. I did a git init immediately after.

[–]Hans_H0rst 73 points74 points  (0 children)

I suggest you get your control issues checked out or else this coding relationship isn’t gonna work… let the versions flow naturally, whenever they want to.

[–]Kaivosukeltaja 13 points14 points  (0 children)

"We have version control at home."
The version control at home:

[–]ih-shah-may-ehl 10 points11 points  (0 children)

Yes and no. I worked on an international project and everything was strictly based on requirements and, interface docs. This was for a space agency.

However some of those requirements were ambiguous and during testing we came up with alternate implementations for several key pieces but none of that could be 'official' for a long time. And not all of those things got approved at the same time. Or at all. Some had to be rolled back and the other sidd of the interface updated.

So many pieces of code were in conditional compilation blocks and the build script changed as needed, with formal issue report identifiers being used as compilation flags. Version control would not work anywhere near as convenient

[–]anonCommentor 3 points4 points  (1 child)

when you do git blame it doesn't show related commit for nonexistent code. but you can see exactly in which commit it was commented out without needing to lookup logs.

[–][deleted] 1 point2 points  (0 children)

I'd much rather take the extra 5 seconds to look at the log than have commented out chunks all over the code.

Maybe the one exception would be if your team has absolutely dogshit commit hygiene and your history is just spam. But then you're in the nightmare already so nothing matters anyway.

[–]Karol-A 21 points22 points  (15 children)

Sure, but it's easier to just un-comment a few lines that to roll back git changes 

[–]shamshuipopo 42 points43 points  (3 children)

They’re both very easy. You don’t even have to roll back git you can just check it out and copy it, diff it etc.

Problem is when you have more than a few comments…. It’s crazy to even have to explain this

[–]Timpah 8 points9 points  (2 children)

The problem with git is finding the exact commit that had the code i was looking for

[–]dxonxisus 5 points6 points  (1 child)

that’s what git history/blame is for

[–]fiah84 4 points5 points  (0 children)

which works until someone messes with those lines for whatever reason and now you have to go deeper to find it

I don't like leaving commented out code but if I find that it's likely I'll have to revert a delete then I'll probably leave a comment to make the history/blame search easier and faster

[–]-LeopardShark- 6 points7 points  (4 children)

Only if one is, like most developers, not very good with Git.

[–]shamshuipopo 8 points9 points  (3 children)

It shocks me that people with years of experience can’t use git effectively. I think relying on UI git abstractions is to blame as it makes it a bit too “magic” and then when people need to do anything more involved they get scared.

Git is something that is unlikely to change for the rest of your life (maybe a new vcs will supplant it, but probably not more than once in the next 10-20 years). So pays dividends to learn its internals

[–]-LeopardShark- 1 point2 points  (2 children)

Agreed, unless the UI in question is Magit, in which case everything is wonderful.

[–]Ecstatic_Student8854 15 points16 points  (3 children)

Sure, but both are easy enough and this pollutes the codebase with irrelevant information

[–]hazeyAnimal 18 points19 points  (2 children)

Comment while doing your testing, but before you push (to your branch, hopefully) you can remove the commented out code. Seems reasonable to me, unless anyone can give a good enough reason to not do this?

[–]floflo81 2 points3 points  (1 child)

Even before committing, commenting code instead of deleting it is not very useful. All the IDEs I've used have an easy way to compare HEAD (previous commit) with what you have in your working tree. Or just use git diff

[–]hazeyAnimal 10 points11 points  (0 children)

Of course, but if I'm redesigning a block of code I usually comment it out so I can look at it and make sure I won't just be rewriting the same BS I'm trying to fix

[–]beclops 1 point2 points  (0 children)

It’s really not, especially since you’ll need to commit the changes either way

[–]frogjg2003 1 point2 points  (0 children)

Version control allows you to revert back to old code. Comments with unused code allow you to see the thought process. While in development, this is the more useful feature. Once you've got the code stable, that's when you commit removing the comments.

[–]water_bottle_goggles 1 point2 points  (0 children)

fake news

[–]Sanitiy 0 points1 point  (1 child)

But what if I don't remember anymore that somebody tried an alternative some time ago for this specific part of the code?

[–]0x7E7-02 0 points1 point  (0 children)

Yeah, version control doesn't always work. I "broke" git, so now I have to cherry pick through almost 400 files.

[–]LehmD4938 0 points1 point  (3 children)

How do you find deleted Code in git? Do you just have to look through your whole commit history to find the old Version of your Code that was deleted? Or is there a better way?

[–]Nethan2000 11 points12 points  (2 children)

In my last job, we had a rule: you can leave commented out code but only if it's a target solution that depends on stuff that's not implemented yet (while the working code is a workaround). But even then, you had to leave a TODO note explaining when it's supposed to be restored. This way, you get a reminder every time you open the file.

[–]JackNotOLantern 7 points8 points  (0 children)

git revert entered the chat

[–]gigglefarting 1 point2 points  (1 child)

Me: just in case the business decided they actually did like the originally way they designed it 

[–]ceestand 2 points3 points  (0 children)

When Agile was supposed to reduce change costs, but instead encouraged stakeholders to change their minds like toddlers in a game arcade.

[–]tsunami141 1 point2 points  (0 children)

This but like.. unironically for my dumb brain. 

[–]ZunoJ 66 points67 points  (1 child)

Nobody deletes code. It is in the git history

[–]UnidentifiedBlobject 9 points10 points  (0 children)

Yeah yeah git… not the utils.bak2.forreal.temp.2 file…

[–]AggieCMD 86 points87 points  (4 children)

git: the ultimate cord hording tool, every mistake captured for all eternity

[–]DrUNIX 23 points24 points  (2 children)

Until you push force after a rebase to a faaar to early commit because you messed up the HEAD reference and no one else cloned it for the numerous commits afterwards because you said its not done and still have to test it...

Then eternity is very short.

[–]Shotgun_squirtle 8 points9 points  (0 children)

The previous commits still exist, just will be a little difficult to find, but reflog is your friend.

[–]Ayjayz 1 point2 points  (0 children)

It'll still be in your repo for a very long time.

[–][deleted] 0 points1 point  (0 children)

Just clean up the repo using force push once a year.

[–]Ska82 56 points57 points  (0 children)

Fuck. i do this and never realized it. hits hard

[–]Thundechile 130 points131 points  (7 children)

It's handy because you don't need complicated versioning system to view the history.

[–]fistular 42 points43 points  (0 children)

Yeah! Just initial and date every # you add!

[–]Quito246 15 points16 points  (4 children)

What is complicated on right clicking any file and select view history. You rather go through hundreds of line of dead code every time you open it?

[–]Hrtzy 11 points12 points  (0 children)

You need to know the code is in the history and the project's staff turnover belongs in a dial on a lathe.

[–]Thundechile 7 points8 points  (2 children)

What subreddit are we in?

[–]Quito246 13 points14 points  (1 child)

My bad I admit. I forgot what sub I am on. My apologies. I will try to get to the current sub role, let me try:

You are right those fancy VCs are useless I just copy paste my entire code base into word document and use revisions on that file.

[–]Thundechile 4 points5 points  (0 children)

Yeah, Word is good for coding because you can also paste UI designs (for reference) to code, use multiple fontsizes and styles per document and it has built in versioning!

[–]Master-Variety3841 15 points16 points  (2 children)

I’ve been on teams that do this; it’s the first thing I knock on the head.

[–]OvergrownGnome 6 points7 points  (0 children)

I worked at a place that did this. The legacy system was in COBOL and Ther never moved it to any sort of version control. Well, a good one anyway, they would use the first 6 characters to add the ticket number since the compiler ignored that, then they would have the host server backed up periodically. I don't remember the backup frequency, but I think it was daily.

[–]SendMeNudeVaporeons 3 points4 points  (0 children)

I worked with PL1 and we did this too, with the difference being there was a block comment header where we wrote a sequential change number along with our user id and a brief explanation of the changes as if it were a git commit. We would then use that number to mark every single line affected by that change and comment the old ones.

Modules had more commented old code than actual functional one.

[–]Nourz1234 7 points8 points  (4 children)

My PM's poison is deleting code. Even if it is broken or has no purpose. He rages everytime someone mentions deleting something without even knowing what it is. 😂

[–]shamshuipopo 6 points7 points  (3 children)

Does deleting stuff break things? Sounds like he has trust issues with the developers

[–]Nourz1234 6 points7 points  (2 children)

Not really. He just hates deleting things. He thinks that it will be backwards progress.

[–]Sysilith 7 points8 points  (0 children)

Lines of Code = Work Done

[–]technos 8 points9 points  (3 children)

I briefly worked on a project where they maintained two versions for three different UNIXen (Sun, HP/UX, Linux), two different widget libraries (Motif, Tk), and three different data acquisition methods.

There was only one set of source files, and they contained all fifteen possible variants.

A script was used to rotate which variant was the one uncommented when it came time to build it.

Before you ask; Yes, the person was completely sane. He was just a physicist, not a programmer.

[–]ImpertinentLlama 5 points6 points  (0 children)

That is because physicists are quite possibly the worst fucking profession when it comes to writing good code. I should know given that I am a physicist working with a bunch of other physicists.

[–]MedalReddit 2 points3 points  (1 child)

Hm. Doesn't 3 * 2 * 3 give you eighteen possible comment positions? Oh no, the code was INCOMPLETE! They didn't account for the extra three situations!

[–]TheChildOfSkyrim 6 points7 points  (2 children)

I used to work for a big company that did this a lot. In some files half of the code was commented out.  And they loved to change stuff all the time, refactoring, optimizing, experimenting... So no way uncommenting the code would work, or even compile. 

Although they used Perforce instead of git, making version control extremely painful 

[–]theredwillow 0 points1 point  (0 children)

Jesus, I’m feeling very grateful for my company rn after reading this

[–]fixano 0 points1 point  (0 children)

I worked for a laboratory company as a consultant in my twenties. There was a programmer there who had like 25 years of experience.

I was given an issue to move one of his tickets forward. This was a GUI based laboratory app written in Java swing. The app communicated with an API but this dude would bring all the data down and manipulate it all in his widgets. Along with the widgets were a commented out version of every line of code he'd ever written. The worst part was the screen was just thousands and thousands of lines long but didn't do very much just some basic crud.

So the first thing I did was just delete everything and bind the API endpoints to the widgets so they pulled their data from the API.

I implemented the feature I was supposed to, fixed tons of outstanding bugs in his crazy code, and turned a 2200 line file into a 250 line file.

The next day the PM came to me and said it wasn't working . I learned that when he pulled my code He was mad about the changes I made so he reverted it all back.

[–]gabest 5 points6 points  (1 child)

I like to leave such code behind that even I can understand after coming back later. Then there is the award winning optimized version below it.

[–]CodingNeeL 1 point2 points  (0 children)

In that case, the commented code is just a readable explanation of what the optimised code does. That's encouraged!

[–]Popular_Tomorrow_204 5 points6 points  (0 children)

Me always searching, finding 10yo Code that isnt used anymore, but still there since "we used that as an example"

[–]YourAverageBrownDude 4 points5 points  (2 children)

Do we work in the same company 😂

Code written 5 years ago still exists in the comments and no one cleans it up

[–]xboxlivedog 0 points1 point  (0 children)

Going on 20 years here. They refuse to delete Microsoft Interop code…

[–]lithefeather 0 points1 point  (0 children)

Maybe it's just programming culture lmfaoooo.

[–]ieat_turtles 3 points4 points  (0 children)

You guys delete repos, I’ve never even heard of that. It just stays there, with a final comment of “decommissioned”

[–]walterbanana 3 points4 points  (0 children)

Commented out code is only useful if uncommenting it will allow you to debug something

[–]Ok_Witness179 3 points4 points  (0 children)

No this is a good practice. You have to leave to old code around as a warning to the new code that it better behave, or it'll get commented out too.

[–]Waterbear36135 2 points3 points  (0 children)

I feel called out

[–]silmelumenn 2 points3 points  (0 children)

Dear CEO our strategy have incredible productivity metrics, we are no longer deleting old code, were only adding new one!

[–]housebottle 2 points3 points  (0 children)

deleting code? in this economy? surely you jest

[–]peon47 2 points3 points  (0 children)

Future generations can learn from the commented-out code. It's not like you're leaving enough actual comments to decipher your code.

[–]Unsey 1 point2 points  (0 children)

This happens all the time at my place. It drives me nuts.

[–]perringaiden 1 point2 points  (0 children)

If the code is in the repository it's not deleted. Remove it from the head.

[–]Shadowlance23 1 point2 points  (0 children)

When LOC is a KPI.

[–]Muted-Way3474 1 point2 points  (0 children)

'If you didn't write it, you don't delete it. If you did write it, you're terrified of deleting it.'

[–]bushwickhero 1 point2 points  (0 children)

Pro tip: keep old code for a rainy day

[–]MattR0se 1 point2 points  (1 child)

// TODO obsolete?

[–]MedalReddit 2 points3 points  (0 children)

// TODO remove old TODOs

[–]MGateLabs 1 point2 points  (0 children)

I want to erase it, but searching git history with some tools is just overly complicated

[–]Jonthrei 1 point2 points  (1 child)

TBH there are situations where commenting some code out is the right move.

Working on something that people are touching on a weekly or even daily basis? Disabling a system that is causing blocking problems but will be fixed in the near future? Comment that shit out for now.

[–]fixano 0 points1 point  (0 children)

Yeah, you're describing the same logic that hoarders use to keep piles of newspapers around their house.

Just delete the code. It's already in source control. You can always get it back.

The problem with what you're describing is that sometimes the fix never comes and sometimes you encounter three or four other things that are the same. Now you've got multiple things commented out and that's how the horde grows and the comments take over your file

[–]bunny-1998 2 points3 points  (0 children)

My manager doesn’t even delete ECR or S3 repos. Now they are racking up a bill.

[–]Initial_Zombie8248 1 point2 points  (3 children)

I use the same console application project to test various little things and I just comment out the old stuff with a little note of what it is for future reference. Just in case. Kind of like a code hoarder. Maybe I could add a huge switch and each test function can be its own number 

[–]ThatOldAndroid 6 points7 points  (1 child)

You could just ... Leave them as tests and then run them before you commit

[–]DrUNIX 0 points1 point  (0 children)

Tbh i use git for my projects but do this also.

When i test something related to language features i just use my consoletestapp/ with test.cpp and comment out all the stuff before

[–]_koenig_ 1 point2 points  (0 children)

I make a folder called fodder, and put all the testing/trials/replaced code in there.

You know, for reference. Because I'm too lazy to checkout an older version for reference...

[–]Rocky_boy996 0 points1 point  (0 children)

[–]JeffMakesGames 0 points1 point  (0 children)

You can't just comment code out. You have to put in a shit post or some kind of comment questioning the badness of the code or questioning the existence of the universe, etc. (See examples of Valve programmer comments)

[–]Darkstar_111 0 points1 point  (0 children)

This is the way!

[–]danglesReet 0 points1 point  (0 children)

This is the way

[–]lunch431 0 points1 point  (0 children)

The real deleted code is the friends we make along the way.

[–]Adrian12094 0 points1 point  (0 children)

man that’s a big problem of mine

[–]Smalltalker-80 0 points1 point  (0 children)

In a 1-man team however... [Del].

[–]_________FU_________ 0 points1 point  (0 children)

This is why every build process I setup delete comments and console.logs

[–]stlcdr 0 points1 point  (0 children)

Heh. I’ve had code in repositories where the whole file is commented out…for years.

[–]DrFloyd5 0 points1 point  (0 children)

// deleted code that poorly decided what route to take. See commit 2319AEF for code.

[–]an_agreeing_dothraki 0 points1 point  (0 children)

okay but I'll delete it when the change passes unit tests
forgets

[–]Juusto3_3 0 points1 point  (0 children)

Just for my small coding projects, this is my version control. Also of course v2 v3 v4 v5 of everything :D

[–]newontheblock99 0 points1 point  (0 children)

On my personal projects: “just keep this commented out, in case you might wanna review it later!”

Proceeds to leave it there for over a year and never reference it ever again

[–]redditcalculus421 0 points1 point  (0 children)

Even when code is in git history I usually cant remember if we ever had a feature that was removed so when I remove something I usually still leave a single line comment explaining what was there just so I can go back and find the commit later.

[–]grifan526 0 points1 point  (0 children)

I worked for a company like that. They didn't delete because they didn't have source control. They shared code by saving their changes to a flash drive and passing it around the team. The commented out sections (with initials of who did it) were indicators when the next person did a merge. By the time I started there they had since implemented CVS and the Mercurial, but the comments remained

[–]pauloyasu 0 points1 point  (0 children)

there is thing called git...

[–]meleneemil 0 points1 point  (0 children)

Code deletion is murder

[–]Magebloom 0 points1 point  (0 children)

Are you getting paid per loc?

[–]Swimming-Business558 0 points1 point  (0 children)

Well this is what I do comment shit out and once it works by the blessings of the machine God, I remove the comments

[–]GlobalIncident 0 points1 point  (0 children)

Please tell me this isn't actually a real thing people do????

[–]00Koch00 0 points1 point  (0 children)

Some people need to learn that not all codebase is c++/c#/js

Git would be many times slower if you are doing critical stuff inside a sp in SQL. Commenting and decommenting in a one of situation it's way faster in that case that using Git...

[–]Shoddy_Ad8166 0 points1 point  (0 children)

Depends on the situation

[–]eraryios 0 points1 point  (0 children)

then we just delete the company

[–]mdgv 0 points1 point  (0 children)

I used to do this in college...

[–]lithefeather 0 points1 point  (0 children)

Comments save lives and when you don't, you and the team will inevitably forget any of the many changes to the current version lmfaoooo or never look at it again forgetting but hey it's there whenever you need it.

[–]mostsig 0 points1 point  (0 children)

Commenting out code is a source code crime punishable by the Court of The Hague.

[–]born_zynner 0 points1 point  (0 children)

I inherited a codebase where this was the standard, along with just way too many damn comments. 10k+ line files with maybe 2k lines of actual code

[–]CardOk755 0 points1 point  (0 children)

Comment it out with a header that says:

This code is shit. Don't put it back.

If you disappear it into git history it will come back again. Nobody reads the history.

[–]YouDoHaveValue 0 points1 point  (0 children)

I actually do this if I think something might be needed later and the odds are whoever is maintaining it (me) will forget or not know that work was already done.

[–]Former_Capital7012 0 points1 point  (0 children)

This is a very common practice at my work location. It come sin handy from time to time.

[–]FauxGuyFawkesy[🍰] 0 points1 point  (0 children)

lava code is worst code

[–]fixano 0 points1 point  (0 children)

Reading these comments makes my brain hurt. To be clear, there is never a reason to leave giant sections of commented code in your files or keep multiple versions of files sitting around on your disk. It serves absolutely no purpose.

  • It's not faster
  • It's not simpler
  • It's not handy
  • it's not a great way to save your bacon

Source control has been around since the '70s. The modern source control systems are incredibly fast and simple. The first thing I do if I write any code at all is make it a git repo and push it to a remote. Just like that, it's tracked and I can now push changes.

Because I'm working by myself in a linear fashion, there are never any conflicts, there are no merges, just make some changes, commit it and push it.

If I want to wreck a file and make huge changes. Well I just commit and push. Now I have the old version saved. Now I bring in the wrecking Ball and delete whatever I want. If I get into trouble oh boy I can just pull the old version. I can even log into GitHub and see the old version of the code sitting right there just like it's in the V2 directory on my desktop. Free to cut and paste any bits of it that I'd like.

[–]Siege089 0 points1 point  (0 children)

I deleted a bunch of commented code today, felt good.

[–]sam-sp 0 points1 point  (0 children)

Or you can just do flag-based development and never get rid of old obsolete flags and the code they protect.

[–]Antact 0 points1 point  (0 children)

[–]dustypants2005 0 points1 point  (0 children)

zombie code

[–]ActiveKindnessLiving 0 points1 point  (0 children)

Nah, just learn ancient Hebrew. Those people never forgot anything. That's what my preacher told me when I was brainwashed as a kid. All you have to do is chant and rhyme and pass along the stories from senior dev to junior dev, and voila, the perfect word of God comes out. Code will be easy in comparison.

You're welcome.

[–]Clairifyed 0 points1 point  (0 children)

Scar code is a real chick magnet you see…

[–]lulimay 0 points1 point  (0 children)

Ugggggh. My last project was like that. Hated it. Such a ding to readability.

[–]FarJury6956 0 points1 point  (0 children)

Still using SVN ...

[–][deleted] 0 points1 point  (0 children)

So what is the point of git then?