Fork me on GitHub
#architecture
<
2023-08-06
>
Ben Sless05:08:08

This is more a code architecture question, revolving mainly around @hiredman's approach of "single file projects" I have a code base I tried organizing both split in files and in a single namespace and dammit, I'm unhappy with both. I have protocols, types, core functions, protocol extensions, what goes where? In what order? How will that affect the final project API for users?

solf07:08:31

Do you have a link to that "single file projects" approach?

vemv10:08:15

What's your pain point with multiple files? Sometimes it can indicate some weak spot in the editor or tooling side

Ben Sless10:08:00

It's more about how to organize (e.g. split) code across those files

vemv10:08:18

I've been very happy with "300LOC max per ns" rule of thumb. (It also keeps tools.namespace snappy) A longer count tends to indicate a mixing of concerns

👍 2
vemv10:08:24

Also, an api.clj/impl.clj separation tends to bring lots of clarity. That way I can learn about the important bits of a project very quickly Also good for testability - impl.clj fns are not private, so I'm not guilt-tripped into not testing them.

Ben Sless10:08:33

When I find time I need to upload my experiments maybe you'll be able to point out the right line of concerns separation

👀 2
Drew Verlee10:08:35

Text is always like several dimensions less than reality. It's like trying to spot a trend in two dimensions from reading the data expressed in one. That's my headache. Fixing that usually requires tools to match the problem and i don't think file organization plays a role in that directly.

Noah Bogart12:08:32

I leave files long until I have to do more than a second or two of searching to find the right section. That can be 200 lines or 1k, just depends on the project and problem domain.

Ben Sless15:08:12

Time to search is also a function of screen size 😞

👍 2
didibus20:08:58

What's nice about the single ns, is that the order becomes that of dependency. What is used by things after comes before.

didibus20:08:28

So the question of "in what order" is answered by it.

didibus20:08:46

Then, when that gets too big, you know how to move things out, they're in the same order.

2
fuad21:08:38

@UK0810AQ2 is this for a library or for an application?