Code Monkey home page Code Monkey logo

blog-v4's People

Contributors

leejacksoon avatar

Watchers

 avatar

blog-v4's Issues

과제 lv4 피드백

과제 구현하시느라 고생 많으셨습니다. 저는 코드 관점 및 데이터 관점에서 피드백을 좀 드리려고 합니다.


  • package는 소문자로 이름을 지어주셔야 합니다.
  • like는 board와 comment 모두 가지고 있는 구조로 되어있는데, 테이블 정규화가 덜 되어 있습니다. 이러면 board 좋아요의 경우 comment가 비어지게 되고, comment 좋아요의 경우 board가 비어있는 상태가 됩니다. 추천드리는 방식은 category라는 column을 추가해주시고 거기에 board인지 comment인지 구분할 수 있도록 넣어주시고, 대상이 되는 entity id를 foreign key로 가지고 가면 좋을 것 같습니다. 물론, JPA의 mapping 기능들은 사용할 수 없다는 단점이 있긴 한데, 직접 관리를 하더라도 훨씬 더 유지보수하기 쉬워질겁니다.
  • BlogService에 너무 로직이 너무 몰려있습니다. 특히 이번에 추가한 Like에 대한 service 로직들을 비교해보면 사용하는 entity만 다를 뿐 코드 구성은 매우 비슷하다는걸 알 수 있습니다. 이런 경우, 두 서비스에서 Like에 관련된 공통된 로직을 추출해서 LikeService를 따로 만들어주신 후에 private method로 구현해두고, LikeService에서 LikeBoard와 LikeComment와 같이 별도 public method로 만들어 service를 사용하는 controller에서 호출을 하고, 내부적으로는 entity를 구분짓는 parameter를 전달해서 공통된 로직을 타게끔 구현하는 방식으로 리팩토링이 가능합니다. 가장 좋은 것은 그냥 위에서 조언드린 테이블 구조를 바꿔서 하나의 LikeService를 구성하는게 가장 좋아보이기는 합니다만, 위에서 조언드린 테이블 구조를 바꾸지 않는 선에서는 취할 수 있는 좋은 방법이라 기회되시면 적용해보시면 좋을 것 같습니다.

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.