Git Product home page Git Product logo

Comments (2)

siyeonSon avatar siyeonSon commented on July 22, 2024

Builder를 자주 사용하시는 편인가요?

저는 매개변수가 3개 이상이 되면 거의 무조건 Builder 패턴을 사용하고 있어요.

Builder를 사용하였을때 해당 클래스의 추가로 필드가 생성되면, Builder를 사용하고 있던 모든곳에서 수정을 해주어야 하죠, 이 과정에서 놓친 부분에서는 Builder에서 값이 채워지지 않은 null 상태로 들어가게 되는데 다들 이러한 문제는 어떻게 생각하시는지 궁금합니다.

사용할 때마다 모두 수정해줍니다😢

from effective-java-study.

gunh0 avatar gunh0 commented on July 22, 2024

저는 prop 과 같은 방법으로 좀더 자바스크립트스러운? 구현을 선호합니다.

    private MongoClient connClient(String prefix, boolean isPrimary) {
        if (props == null) {
            return null;
        }
        String host = props.getProperty("mongodb." + prefix + ".server");
        int port = props.getProperty("mongodb." + prefix + ".port", Integer.class, 27017);
        String username = props.getProperty("mongodb." + prefix + ".username");
        String password = props.getProperty("mongodb." + prefix + ".password");
        String database = props.getProperty("mongodb." + prefix + ".database");

from effective-java-study.

Related Issues (20)

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.