C-Thinker님의 Repository/DAO, DTO, 그리고 확장성과 퍼포먼스란 글과 거기서 인용된 [MyStory Series] Repository? DAO? 을 읽다가 DAO와 리포지토리를 그냥 뭉뚱그려서 같은 개념(주로 레이어를 가리키는 말)으로 사용하는 것이 눈에 띄였다.

‘리포지토리’는 Eric Evans의 DDD책이 나오고 DDD의 관심이 고조되면서 유행하기 시작해서 요즘엔 DAO를 대신하는 폼나는 용어로 많이 쓰이는 듯 하다. 예전에 많이 쓰던 UserDao 대신 UserRepository라고 사용하기도 하고, 스프링의 데이터 액세스 로직을 담은 빈에 사용하는 스테레오타입 애노테이션도 @Repository다.

그런데, DAO나 리포지토리가 그냥 비슷한, 서로 바꿔서 사용할 수 있는 용어일까.

한국 DDD의 아버지라고 불리는 이터너티님의 DAO와 REPOSITORY 논쟁이라는 날카로운 글을 보면 DAO와 리포지토리는 확연이 구분되는 다른 의미를 가진 용어이다. 물론 나는 이터너티님의 의견에 모두 동의하는 것은 아니지만, 어쨌든 원래 리포지토리라는 말이 정의되고 사용되기 시작한 기원을 따져보자면 이터너티님의 지적이 맞는 듯.

보통 DDD 책에서 리포지토리라는 용어를 처음 접한 경우가 많은데 사실 그보다 먼저 나온 마틴 파울러옹의 P of EAA(Patterns of Enterprise Application Architecture) 책에서 먼저 리포지토리가 소개됐다. P of EAA 내용을 소개한 웹 페이지(http://martinfowler.com/eaaCatalog/repository.html)에서도 그 내용을 볼 수 있다. 이 내용만 잘 살펴보더라도 단순히 데이터 액세스(매핑) 레이어를 리포지토리 레이어라고 부르는 것은 적절하지 않은 것 같은데.  뭐 IT 용어가 반드시 하나의 의미로만 사용될 이유야 없으니 부르고 싶은대로 부르겠다면 뭐 할말은 없지만.

웹 페이지보다 좀 더 자세하게 Repository 내용을 다룬 P of EEA 책의 Repository 항목을 보면 관련 샘플 코드도 나와있으니 관심 있으면 살펴보는 것도 좋을 듯. 재밌는 것은 P of EEA의 참고서적에 DDD가 나온다는 것. 출간은 안됐고 저술중인 것으로 나오는데, Repository 항목을 보면 이 책과 Evans에 관한 언급이 나온다. 웹 페이지에선 아예 책 추천도 하고.

그런데 transparent persistency를 지원하는 하이버와 같은 ORM에선 리포지토리의 구현이 상당히 직관적이기도 하다. 소위 리포지토리/DAO 레이어를 취급 안하는 본격 EJB3/JPA 문화에서는 그래서 다르게 받아들이기도 하는 듯. 전에도 개빈 킹은 하이버 사상으로는 DAO와 리포지토리에 대해서 끝까지 차이점을 모르겠다고 하기도.

레이어를 말할 땐 그냥 데이터 액세스 레이어라고 하는게 나에겐 가장 자연스럽지만, 그냥 DAO 레이어라도 해도 그만. 그래도 리포지토리 레이어라는 말은 글세.

그런데 전에도 비슷한 글을 썼던 것 같기도 한데… 흠. 뭐 어때.

Related posts:

  1. Nexus Maven Repository 1.0 출시
  2. [토스3] 스프링 JDBC DAO에 lazy-loading 기능 적용하기
  3. [토스3] 스프링 JDBC DAO에 lazy-loading 적용하기 (2)
  4. 유쾌한 이슈처리 재촉 메일
  5. Spring활용전략 세미나를 마치고
  6. TSE2006 셋째날 세션1 – Applying DDD int the Enterprise with AspectJ
  7. TSE2006 넷째날 두번째 세션 – ROO
  8. Spring ROO 대충대충 분석 (1) 공개과정
  9. Eternity님의 Domain-Driven Design의 적용 시리즈
  10. Spring 3.0 (27) R-599 JDK1.5+ Concurrent
  11. Generic DAO Pattern with JDK5.0

Facebook comments:

to “DAO와 Repository”

  1. we came across a cool internet site which you may well enjoy. Take a look should you want

  2. Thank you so much for providing individuals with remarkably spectacular chance to read from here. It is always so pleasurable and as well , packed with a good time for me and my office fellow workers to search the blog at a minimum three times a week to find out the fresh issues you have got. And definitely, I’m so usually pleased with all the beautiful suggestions served by you. Some 2 facts in this posting are essentially the simplest I’ve ever had.

  3. Direct Dutasteride Enlarged Prostate Without Perscription Internet http://cialibuy.com – Cialis Vytorin cialis 5mg Viagra Quanto Costa In Italia

  4. check below, are some absolutely unrelated web-sites to ours, having said that, they’re most trustworthy sources that we use

  5. The facts mentioned in the article are a number of the best accessible

  6. here are some links to web-sites that we link to due to the fact we think they may be worth visiting

  7. below you will locate the link to some websites that we think you should visit

  8. just beneath, are many absolutely not associated internet sites to ours, however, they may be certainly really worth going over

  9. the time to read or pay a visit to the content or sites we’ve linked to below the

  10. The facts mentioned inside the write-up are a number of the ideal accessible

  11. Love checking this blog :) If anyone here is interested in improving their blog fans, can I suggest a really well thought out gig. Find it here- seo marketing, or just copy https://www.fiverr.com/fastandy/test-other-gig-backlink-reports-for-active-links-df-obl-da, it’s to be seen to be believed!

  12. Great information. Lucky me I came across your blog by chance (stumbleupon). I have saved as a favorite for later!

  13. Excellent, what a webpage it is! This weblog presents helpful information to
    us, keep it up.

  14. Big fan of this blog :) If anyone here is interested in increasing their presence in google, can I recommend a really fantastic job. Look into it here- victorious seo, or just visit https://www.fiverr.com/fastandy/test-other-gig-backlink-reports-for-active-links-df-obl-da, it’s the best!

  15. Wonderful story, reckoned we could combine a handful of unrelated information, nevertheless genuinely really worth taking a appear, whoa did 1 discover about Mid East has got more problerms also

  16. I want to point out my appreciation for your kindness for women who actually need help on this particular situation. Your personal dedication to passing the message along was incredibly good and have continually permitted women much like me to realize their ambitions. Your own invaluable facts denotes a whole lot a person like me and even more to my fellow workers. Best wishes; from all of us.

  17. S9ThLr tyfwekbnalum, [url=http://usdewsogwxfy.com/]usdewsogwxfy[/url], [link=http://mbhwpfjblfvz.com/]mbhwpfjblfvz[/link], http://kjmcoubfavxh.com/

  18. 4GY3Lb rrpfioqsvqjh, [url=http://ydrzvayhswsw.com/]ydrzvayhswsw[/url], [link=http://okfisrjcrhbu.com/]okfisrjcrhbu[/link], http://yotqlqqzjlui.com/

  19. The facts talked about in the article are a few of the most beneficial available

  20. Good post. I learn something new and challenging on blogs I stumbleupon on a daily basis. It’s always helpful to read through content from other authors and practice a little something from other web sites.

  21. Order Now Zentel Best Website C.O.D. Mastercard On Line http://cialibuy.com – Buy Cialis Does Cephalexin Make Dogs Tired Buy Cialis Dental Antibiotic Amoxicillin Protection How Long

  22. I’ve read several good stuff here. Certainly value bookmarking for revisiting. I wonder how so much attempt you set to make the sort of fantastic informative web site.

  23. Hey there! I simply would like to give you a huge thumbs up for your excellent information you’ve got right here on this post. I am returning to your website for more soon.

  24. Wonderful story, reckoned we could combine a number of unrelated information, nonetheless actually really worth taking a appear, whoa did one master about Mid East has got additional problerms too

  25. Sites of interest we have a link to

  26. Wonderful story, reckoned we could combine several unrelated data, nonetheless genuinely worth taking a look, whoa did one particular find out about Mid East has got more problerms also

  27. You are so cool! I do not suppose I’ve truly read anything like that before. So good to find someone with a few genuine thoughts on this subject matter. Seriously.. thanks for starting this up. This web site is one thing that is required on the web, someone with a little originality.

  28. here are some hyperlinks to sites that we link to simply because we believe they may be really worth visiting

  29. This website was… how do I say it? Relevant!! Finally I’ve found something that helped me. Many thanks!

  30. very handful of internet sites that come about to be comprehensive beneath, from our point of view are undoubtedly nicely worth checking out

  31. This is a topic that is near to my heart… Cheers! Where can I find the contact details for questions?

  32. I must show thanks to you for bailing me out of this type of issue. Just after surfing around throughout the internet and coming across proposals which are not beneficial, I assumed my life was gone. Being alive without the presence of solutions to the difficulties you’ve fixed through your good website is a critical case, and those which might have in a wrong way damaged my entire career if I had not encountered your blog. Your own expertise and kindness in dealing with a lot of stuff was crucial. I am not sure what I would’ve done if I hadn’t encountered such a stuff like this. It’s possible to now look ahead to my future. Thanks a lot very much for this high quality and results-oriented help. I won’t think twice to refer your web site to anyone who ought to have tips on this situation.

  33. I’m pretty pleased to find this great site. I need to to thank you for ones time for this fantastic read!! I definitely really liked every part of it and I have you book-marked to look at new stuff on your site.

  34. Here is a great Weblog You might Uncover Exciting that we Encourage You

  35. This site was… how do I say it? Relevant!! Finally I’ve found something which helped me. Kudos.

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2017 Toby's Epril Suffusion theme by Sayontan Sinha