TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Should you use DAOs these days and when is it appropriate?

2 pointsby CorvusCryptoabout 9 years ago
There seems to be a lot of debate on whether or not DAOs are appropriate in modern data access layers, and from what I&#x27;ve searched (e.g. refs [1],[2],[3]), it seems there are good cases for using a DAO and there also seem to be convincing cases you don&#x27;t want to use one (I&#x27;m very pliable in my opinion apparently). I personally like the idea of adding an extra layer of abstraction and tbh it doesn&#x27;t seem like as much work as people say to code in the methods, hell we use DAOs at work and they work great but that&#x27;s just one case. I&#x27;d like to hear your thoughts though on when (&#x2F;if) it is appropriate to implement a DAO nowadays, and why you use it over just plain ORM or JPA or other data access patterns.<p>Here&#x27;s what sparked this question if you&#x27;re interested: RE: a PHP project, got into a bit of a debate on using DAOs and basically it came down to someone saying they had bad experiences with DAO and therefore want to just use our framework&#x27;s data access implementations (ActiveRecord-based btw). I am for adding an extra layer of abstraction that allows us to constrain data access as well as increase code portability in case major version updates or framework changes occur (a fairly likely possibility in our case) so we don&#x27;t need to spend as much time adapting to their data access methods. Naturally we had fun debates over what to do. Honestly I can work around either, but again, I want to know your thoughts!<p>refs: [1] http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;2100115&#x2F;i-found-jpa-or-alike-dont-encourage-dao-pattern [2] http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;3818589&#x2F;java-ee-architecture-are-daos-still-recommended-when-using-an-orm-like-jpa-2 [3] http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;1748238&#x2F;pros-and-cons-of-the-use-of-dao-pattern

no comments

no comments