Giter Site home page Giter Site logo

prgrms-clone-project's Introduction

프로그래머스 클론 프로젝트

STARBOOKS

  • 도서 주문 시스템

사용한 라이브러리

  • Spring web
  • Lombok
  • MySQL
  • Testcontainers
  • gson
  • JDBC
  • Thymeleaf

기능

Customer CRUD

회원을 생성, 조회, 업데이트, 삭제할 수 있다.

Order CRUD

주문을 생성, 조회, 업데이트, 삭제할 수 있다.

Product CRUD

상품을 생성, 조회, 업데이트, 삭제할 수 있다.


하면서 느꼈던 고민들

DTO를 어디서 변환할 것인가?

DTO변환을 컨트롤러에서 하느냐 서비스에서 하느냐 가 고민거리였습니다. 컨트롤러에서 하자니 컨트롤러가 지저분해지는 것 같았고 서비스에서 하자니 DTO변환은 비지니스 로직과 거리가 멀게 느껴졌기 때문입니다. 고민끝에 컨트롤러는 클라이언트와 서버를 이어주는 다리역할만 해야 한다고 결정을 했고, DTO변환까지는 서비스에서 해도 무방하지 않을까 라고 생각을 하게 되었습니다. 또한 서비스에서 DTO변환을 지금까지 해본적이 없어서 이번에는 DTO변환을 서비스에서 진행하였습니다.

그렇다면 DTO를 변환하는 메서드는 어디서 관리할까?

DTO변환을 해주는 메서드를 mapstruct 라는 라이브러리를 사용하면 각 도메인 별로 DTO변환 메서드를 관리할 수 있었습니다. 처음에는 이것을 사용하여 코드를 작성하였는데 도메인을 생성, 업데이트 하기 위한 DTO가 별도로 존재한다면 이것 역시 관리가 잘 되지 않는 것 같았고, 해당 DTO가 변환하는 기능까지 담당해야 한다고 생각을 하여 mapstruct를 사용하지 않고 그냥 DTO에 변환 메서드를 작성하였습니다.

prgrms-clone-project's People

Contributors

goshkim avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.