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 web-site that you simply might get pleasure from. Take a search when you want

  2. I have witnessed that rates for online degree specialists tend to be an incredible value. Like a full College Degree in Communication with the University of Phoenix Online consists of 60 credits at $515/credit or $30,900. Also American Intercontinental University Online provides a Bachelors of Business Administration with a complete study course requirement of 180 units and a worth of $30,560. Online learning has made having your certification far more easy because you may earn your own degree through the comfort in your home and when you finish from office. Thanks for other tips I have really learned through the blog.

  3. Great web site. A lot of useful info here. I am sending it to several friends ans additionally sharing in delicious. And naturally, thank you on your sweat!

  4. Good information. Lucky me I discovered your site by chance (stumbleupon). I’ve bookmarked it for later.

  5. Have you ever considered writing an ebook or guest authoring on other sites? I have a blog based on the same subjects you discuss and would love to have you share some stories/information. I know my readers would appreciate your work. If you’re even remotely interested, feel free to shoot me an email.

  6. Nice blog here! Also your website loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my site loaded up as quickly as yours lol

  7. one of our guests not long ago recommended the following website

  8. we came across a cool web site that you just may well enjoy. Take a appear when you want

  9. My partner and I stumbled over here different web address and thought I might as well check things
    out. I like what I see so i am just following you.

    Look forward to checking out your web page repeatedly.

  10. You’re so cool! I do not think I have read anything like this before. So great to discover someone with a few unique thoughts on this subject matter. Seriously.. many thanks for starting this up. This website is something that’s needed on the internet, someone with some originality.

  11. I really like your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz reply as I’m looking to design my own blog and would like to find out where u got this from. thank you

  12. Piece of writing writing is also a excitement, if you
    know afterward you can write otherwise it is complicated to
    write.

  13. check beneath, are some completely unrelated web sites to ours, however, they may be most trustworthy sources that we use

  14. I discovered your weblog web site on google and examine just a few of your early posts. Proceed to keep up the superb operate. I just additional up your RSS feed to my MSN News Reader. Searching for forward to studying more from you in a while!?

  15. I conceive you have mentioned some very interesting details , regards for the post.

  16. of course like your website but you have to check the spelling on quite a few of your posts. Several of them are rife with spelling issues and I find it very bothersome to tell the truth nevertheless I’ll definitely come back again.

  17. Here is a superb Weblog You may Come across Intriguing that we Encourage You

  18. one of our guests just lately recommended the following website

  19. usually posts some incredibly interesting stuff like this. If youre new to this site

  20. Sites of interest we’ve a link to

  21. the time to study or take a look at the subject material or internet sites we’ve linked to beneath the

  22. Here are a few of the web sites we advise for our visitors

  23. please visit the web sites we comply with, such as this 1, because it represents our picks through the web

  24. here are some hyperlinks to web pages that we link to simply because we consider they are worth visiting

  25. Would you be considering exchanging hyperlinks?

  26. just beneath, are various totally not connected sites to ours, even so, they are certainly worth going over

  27. below you will uncover the link to some websites that we consider you should visit

  28. usually posts some extremely exciting stuff like this. If youre new to this site

  29. It’s really a nice and useful piece of information. I’m glad that you shared this helpful information with us. Please keep us informed like this. Thanks for sharing.

  30. I like this post, enjoyed this one appreciate it for posting .

  31. the time to read or check out the subject material or web pages we have linked to below the

  32. I enjoy what you guys are up too. Such clever work and reporting! Keep up the great works guys I’ve incorporated you guys to my blogroll.

  33. that could be the end of this post. Right here you will uncover some web pages that we think youll value, just click the links over

  34. This is very interesting, You’re a very skilled blogger.
    I’ve joined your feed and stay up for in the hunt for extra of your great post.
    Also, I’ve shared your website in my social networks

  35. My partner and I stumbled over here coming from a different web page and thought I
    may as well check things out. I like what I see so i am just following
    you. Look forward to finding out about your web page for a second time.

  36. After looking over a handful of the blog posts on your
    site, I seriously appreciate your way of writing a blog.
    I saved it to my bookmark website list and
    will be checking back soon. Please check out my website too and let me
    know what you think.

  37. I blog quite often and I seriously thank you for your information. The article has really peaked my interest. I am going to bookmark your website and keep checking for new details about once per week. I opted in for your RSS feed as well.

  38. here are some hyperlinks to websites that we link to simply because we believe they may be worth visiting

  39. always a large fan of linking to bloggers that I adore but really don’t get a lot of link really like from

  40. Way cool! Some very valid points! I appreciate you writing this post and also the rest of the site is also really good.

  41. This site really has all of the information I wanted concerning this subject and didn’t know who to ask.

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