News for hackers. Stuff that matters.
Re:Code colocation is king by arvindrajnaidu on Thursday February 03, 2022 @09:41AM (#30192980)
I agree. Tests for example used to be in a separate folder mirroring the code folder structure. I have moved away from that to put it right next to the file.

Random thought: Can the IDE recommend next file to work on - “people who worked with this file, also worked on”. The real problem is not where we keep it, it’s how quickly we can get to it.

Re:Code colocation is king by jbreckmckye on Thursday February 03, 2022 @11:08AM (#30194190)
You see, this is a design that's taken hold of a lot of codebases, and I don't think it works. I see a lot of projects with big folders mixing top level exports, implementation files, tests, test utils, fixtures and the like.

I'd much rather see the 'mirrored' approach.

> Random thought: Can the IDE recommend next file to work on

I'm _sure_ I've seen something like this in IntelliJ.

EDIT: I did! It's in the changes tab > the eye icon > 'show files related to active changelist'. It then sometimes will make suggestions based on project history.

Re:Code colocation is king by nerdponx on Thursday February 03, 2022 @09:47AM (#30193074)
Tests that involve complicated setup or are otherwise bigger than "unit" tests probably don't make sense to keep in the source tree.

But it's a nice idea to keep unit tests specifically alongside the "units" of code that they test.