This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-06
Channels
- # announcements (3)
- # architecture (16)
- # beginners (5)
- # cherry (1)
- # cider (3)
- # cljsrn (2)
- # clojure (54)
- # clojure-dev (11)
- # clojure-europe (14)
- # datalevin (26)
- # emacs (8)
- # helix (5)
- # honeysql (5)
- # hyperfiddle (40)
- # lsp (12)
- # malli (23)
- # missionary (7)
- # nrepl (2)
- # off-topic (18)
- # releases (2)
- # yamlscript (1)
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?
Most gists by https://gist.github.com/hiredman
https://github.com/dharrigan/startrek is a good starting point
What's your pain point with multiple files? Sometimes it can indicate some weak spot in the editor or tooling side
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
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.
When I find time I need to upload my experiments maybe you'll be able to point out the right line of concerns separation
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.
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.
What's nice about the single ns, is that the order becomes that of dependency. What is used by things after comes before.
Then, when that gets too big, you know how to move things out, they're in the same order.
@UK0810AQ2 is this for a library or for an application?