Same approach but flat structure? #55
-
Hello! Do You think it’s ok to organize small to medium size project with the same approach as you described but flat structure?
There are http server and zmq server. Is it good idea if there is about 5-10k sloc in project? What would You do when for example mongo and Postgres needs slightly different fields types, let’s say user Id will be different type for mongo and postgres. Should I put two user types in user.go file and two interfaces? One for Postgres and memory and one for mongo? I hope I described my problem as clear as possible 😅 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @pegeraw, good questions.
I think a flat package structure is generally fine for small projects (e.g. <10KLOC). The main benefit for splitting out subpackages is isolation and that's not as critical when you don't have much code to isolate from each other.
If your data layers need different different input types then I would create unexported types for each one (e.g.
You can probably even go one step further and move your |
Beta Was this translation helpful? Give feedback.
Hi @pegeraw, good questions.
I think a flat package structure is generally fine for small projects (e.g. <10KLOC). The main benefit for splitting out subpackages is isolation and that's not as critical when you don't have much code to isolate from each other.
If your data layers need different different input types then I would create unexported types for each one …