lainchan / λ

(untitled)

P. Seuqram Nivek · 2024-07-21 08:03
I don't know how often you Lain work with personal projects from the very scratch, but I was wondering how do you organize (if you organize, I think gohorsing is totally valid too) that kind of web projects. I built this Go Postr thing to learn more about Go and webdev stuff, and I'm happy that some patterns that I "discovered" rewriting that same project over and over again had names. I'm still confused about this services/repos thing, I found out in a blog post, but I can't find many resources about this pattern -- maybe it's just a searching skill issue, I'll figure out the correct name of that soon. So, how Lain approach, or would approach, a web application like a *chan or a social midia clone?
Colmerauer · 2024-07-23 22:45
>>39645 That's the service-repository pattern, when combined with MVC it makes for a very clean codebase. A problem I found with this pattern is when it's a personal project or a small team, you're looking at a death-by-1000-cuts situation where to implement any tiny thing you have to consider everything from the data layer through repository then how that repository is used by a service and then how the service is used from a controller. For everything you ever make you have to consider all of the steps over and over again. As an answer to your question yes I generally separate things into two layers - consumer facing (actual user/machine interface for my program (web/cli/api/other)) - services (the actual functionality) and if the complexity/feature-set increases I then wrap these two layers into a domain and create different domains.