News for hackers. Stuff that matters.
Re:Negative Two-Thousand Lines of Code by uticus on Wednesday June 25, 2025 @05:55PM (#44382155)
> make a copy and slightly modify it

In addition to not breaking existing code, also has added benefit of boosting personal contribution metrics in eyes of management. Oh and it's really easy to revert things - all I have to do is find the latest copy and delete it. It'll work great, promise.

Re:Negative Two-Thousand Lines of Code by 0cf8612b2e1e on Wednesday June 25, 2025 @07:12PM (#44382661)
I mean…when you have a pile of spaghetti, there is only so much you can do.
Re:Negative Two-Thousand Lines of Code by travisgriggs on Wednesday June 25, 2025 @07:33PM (#44382790)
Ask for more staff, reorganize the team into a set of multiple teams, and hire more middle management! Win win for the manager.
Re:Negative Two-Thousand Lines of Code by 8n4vidtmkvmk on Thursday June 26, 2025 @12:57AM (#44384296)
Add tests to the function as it exists today. Submit. Add new functionality, make sure tests still pass. Done. Updating a function here and there shouldn't require more staff.
Re:Negative Two-Thousand Lines of Code by SkyBelow on Thursday June 26, 2025 @08:39AM (#44386844)
This implies adding tests that accurately capture all the nuances of the function and don't test the simplest logic need to hit code coverage. When we are talking someone new to the function, then this is about the same as asking them to learn the function so they can be sure they didn't make an error when they changed it. The benefit of tests is that they are written by the person creating the function originally who is most aware of the hidden dangers of it.

I'm distrustful on unit testing as I've seen too many tests written to make code coverage numbers but that don't actually test the functions they are aimed at. A non-trivial number which run the function asynchronously and then report a successful run before the function even finishes executing, meaning that even throwing errors don't fail the tests (granted, part of that is on the testing framework for letting unexpected errors ever result in a pass).

Re:Negative Two-Thousand Lines of Code by dml2135 on Thursday June 26, 2025 @03:09PM (#44390354)
Of course, this is the way you need to write tests -- to test the actual logical pathways and requirements of the code, and not just finagle them together to overfit some code coverage metric.
Re:Negative Two-Thousand Lines of Code by hdjrudni on Thursday June 26, 2025 @10:17PM (#44393204)
We have a saying at my work. "If you like it, then you should have put a test on it". If the original author didn't add adequate coverage and you end up breaking them, it's on them.
Re:Negative Two-Thousand Lines of Code by mrweasel on Thursday June 26, 2025 @05:24AM (#44385636)
Spaghetti piles are where you can do the most... if you're brave enough and have agency to do so.
Re:Negative Two-Thousand Lines of Code by sumtechguy on Thursday June 26, 2025 @08:36AM (#44386821)
Add some meat sauce and more spaghetti :)
Re:Negative Two-Thousand Lines of Code by nico on Wednesday June 25, 2025 @10:21PM (#44383681)
Immutable functions! I guess that’s one way of doing functional programming /s
Re:Negative Two-Thousand Lines of Code by Sharlin on Thursday June 26, 2025 @04:20AM (#44385324)
In a (very real) sense, git is an immutable data structure of immutable snapshots of code.
Re:Negative Two-Thousand Lines of Code by ThunderSizzle on Thursday June 26, 2025 @12:32PM (#44388947)
You can do commit squashing in git, right? I know HG history editing wa much more of a pain than it seems to be in git.
Re:Negative Two-Thousand Lines of Code by Sharlin on Friday June 27, 2025 @08:36AM (#44396322)
Yes, but it just creates a new immutable branch in the commit graph. All the old commits are still there, but if they're not reachable from the root refs, they'll get GC'd eventually. The only mutable parts are HEAD, branch/tag names etc that can be changed to point to whatever. Anything that has a hash is necessarily immutable, because changing it in any way (including changing its parent pointer(s)) changes the hash.
Re:Negative Two-Thousand Lines of Code by windward on Thursday June 26, 2025 @06:27AM (#44385971)
pfft, that's just symbol versioning
Re:Negative Two-Thousand Lines of Code by kevincox on Friday June 27, 2025 @03:32PM (#44399584)