News for hackers. Stuff that matters.
Re:Ask HN: Which are the best resources to learn software ar... by thijsvandien on Friday January 31, 2020 @07:35PM (#22207516)
You don't want your business logic to depend on anything other than interfaces that it "owns". The actual database access code would be an implementation of such an interface. In other words, the business logic specifies in abstract terms what it needs, and the code surrounding it provides that.
Re:Ask HN: Which are the best resources to learn software ar... by veeralpatel979 on Friday January 31, 2020 @07:46PM (#22207604)
Thank you for this comment; I will keep this in mind.

When working with a language like Go, where I have a DB access layer where I'm running raw SQL queries, I agree with this.

When working with Rails, though, I typically just make ActiveRecord calls in my service layer; it's simpler.

Re:Ask HN: Which are the best resources to learn software ar... by insulanian on Sunday February 02, 2020 @03:19AM (#22215846)
How do you write unit tests your service layer then? Unit testing is much more important in dynamic languages, because there's no compiler to protect you from basic mistakes.