2 ms·
That will only work when your functions don't have side effects. So no database access, no network calls etc. You could work around that by passing in your data
by misja111 4y ago
That will only work when your functions don't have side effects. So no database access, no network calls etc.
You could work around that by passing in your database client as parameter but when you have a DAO class with lots of functions this quickly becomes tedious.
- patates 4y agoOP said: > I write functions using ‘static’ all the time. I prefer that a function be static. This, however, does not mean that all the functions should be static. IMHO, the more static stuff you can extract from your instance methods while keeping parameters count to max 3 (magic number that works for me), the better.
- foobarian 4y ago> You could work around that by passing in your database client as parameter Yes this is the way. [1] [1] https://en.wikipedia.org/wiki/Hexagonal_architecture_(software) https://en.wikipedia.org/wiki/Hexagonal_architecture_(softwa...