Giter Site home page Giter Site logo

spring-course-3's People

Contributors

desire456 avatar

Watchers

 avatar  avatar  avatar

spring-course-3's Issues

Вопрос по архитектуре

Столкнулся с такой проблемой: в сервисах возвращаю, например, в методе findById дто объект. Потом я хочу в другом месте его использовать, но уже хочу ентити получить, а не дто. В связи с этим вопрос как лучше поступить при написании сервиса, чтобы таких проблем не возникало: возвращать ентити везде, а в прикладных местах мапить в дто или писать в сервисах кучу методов с разными return типами? @coursar, подскажите, пожалуйста?

Чем больше вложенность кода - тем сложнее "complexity" - тем выше вероятность ошибок

if (likeEntity != null) {
if (!likeEntity.getLike().equals(like)) {
likeEntity.setLike(like);
} else {
return likeMapper.fromEntity(likeEntity);
}
} else {
likeEntity = new LikeEntity();
likeEntity.setLike(like);
likeEntity.setAuthor(author);
likeEntity.setPost(post);
}

Если на проекте будут юзать стат.анализаторы, придётся отказываться от кучи вложенных if-else.

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.