I tend to partition my web apps loosely into “handlers”, “model”, and “views” just because I find it a good visual reminder of what sort of code should or should not live in each type of thing — keep web/request stuff out of the model; keep pure business logic out of the handlers; keep view-related concerns together. But as I start a new web app, I tend to have one big handler.clj
ns until I have enough code and enough common business logic to warrant refactoring out to multiple handlers, a model section full of business-related namespaces (although a lot of our business logic is already in a shared “library”), and view-specific stuff like how to render templates and header/footer wrappers and JS/CSS stuff etc.
(that said, some of our simpler web apps have just two namespaces: the “handler” stuff — all of the logic of the app including rendering — and the “bootstrap” stuff — initialize everything, define routing, logging/middleware setup)
i have a keybinding to "load file to repl"
And a keybinding to "run last test on REPL". Using midje, it show up in stdout. I use splited screen with code // repl
So I usually not seeing the "test" namespace.
But the main thing is design your namespaces/applications to be reloadable.
Some libraries like pedestal and datomic helps A LOT on that.
Where the library do not help, I do things like a simple (def register [...])
turns into (defn register [] [...])
so it's way "more reloadble"
Now I'm like trying to convince people to use less and less namespaces everyday, and they're like showing scaffold of folders on a application 😢
without even knowing what it'll be in the future
thanks for the answer. don't you face edge cases with that approach? for example, you "load file to repl" a changed defmacro how do you determine and reload all namespaces dependent on that defmacro that need to be recompiled? (else they'd be using the old macroexpansion) (Especially on a 100KLOC codebase)
I have a list of arbitrary long-running commands (listed in a file) I want to start/stop at once, and restart any of them if the process crash. (they are actually a bunch of kubernetes port-forward, that sometimes close for network/other reasons). Any existent tool that would help me? I’m thinking of making a quick babashka script otherwise.
systemd --user
Hmm true, and it would give me an excuse to learn systemd. I’ll check this link: https://wiki.archlinux.org/index.php/systemd/User
After googling a bit, it seems that while systemd allows to start multiple process in one unit, it can’t track them individually (to restart them in crash for example)
Yeah, make them each a unit
It’d be annoying to edit multiple files, as the list of commands changes often. In the same google search I found http://supervisord.org/introduction.html that seems to handle that use case
Hey wait
I forgot I switched to osx on monday….
I think I’ll just go with the babashka script 😅
Any redis (carmine) guys?
Can anyone remind me of the term (which I'm forgetting, and it's proving difficult to look up) for the "syndrome", I think it's called, in which a person with expertise is repeatedly able to identify substantial errors in journalistic reporting on their field, yet continues to believe those same outlets when reporting on things outside that field?
Gell-Mann Amnesia
That's it, thanks!!
Is there a good reference for organizational/architectural patterns in code that would describe things like what is an Entity vs Model vs ViewModel? What constitutes a Service or a View? etc.
Elements of Clojure is a good book for that level of design question I think
the classic of course is the gang of four design patterns book
(and the many follow ups and responses)
https://en.wikipedia.org/wiki/Architectural_pattern is a pretty good overview of the various names of architectural patterns and links to definitions of specific ones.
Maybe not exactly addressing your question, but this also might be of interest: http://mishadoff.com/blog/clojure-design-patterns/
hmm, looks like I have a bit of reading to do
If you're looking for resources that cover UI design, here are some of the resources I used to write https://blog.phronemophobic.com/what-is-a-user-interface.html • https://martinfowler.com/eaaDev/uiArchs.html • http://day8.github.io/re-frame/a-loop/ • https://dennisreimann.de/articles/elm-architecture-overview.html • https://reactjs.org/docs/thinking-in-react.html • https://blog.codinghorror.com/understanding-model-view-controller/ • https://softwareengineering.stackexchange.com/questions/127624/what-is-mvc-really • https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller • https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/Model-View-Controller/Model-View-Controller.html
Also the C2 wiki is a huge resource (fun fact: this is the original wikiwikiweb. the mother of all wikis) https://wiki.c2.com/?CategorySoftwareArchitecture