Skip to main content
Code Review

Return to Answer

edited body
Source Link
Gerold Broser
  • 1.3k
  • 8
  • 20
  1. Neither MonogDB'sMongoDB's BasicDBObjectBuilder nor your UserDocumentBuilder is a Builder according to the pattern of the GoF.
  1. Your name UserDocumentBuilder is somehow confusing. Especially when you then define:

     BasicDBObjectBuilder userDocumentBuilder = new BasicDBObjectBuilder()
    

    It represents a builder for a user, not a builder for a document of a user, doesn't it? Hence, I'd rather call it UserDBObjectBuilder.

  2. AFAICS the only added value to BasicDBObjectBuilder is the addDetails(...) method to add keys/values from a Map rather than single key/value pairs only.

    Why don't you simply:

     public UserDBObjectBuilder extends BasicDBObjectBuilder
    

    and just overload add(...) with add(Map details) therein?

  3. You supply a passwordHash to:

     public UserDocumentBuilder(..., String passwordHash, ...)
    

    and you apply another hash algorithm to this already-hash then? Why?

  4. MongoDB's BasicDBObjectBuilder implementation, apart from the missing method descriptions, is questionable on its own:

    • What is the difference between add(...) and append(...)?
    • What does push(String key) do? Adding a key with a null value associated to it?
    • What if I invoke BasicDBObjectBuilder.start("key", "value").start()? Is the building process started over again by eliminating the values given at the first start(...)? → These start() methods should better be different constructors.
  1. Neither MonogDB's BasicDBObjectBuilder nor your UserDocumentBuilder is a Builder according to the pattern of the GoF.
  1. Your name UserDocumentBuilder is somehow confusing. Especially when you then define:

     BasicDBObjectBuilder userDocumentBuilder = new BasicDBObjectBuilder()
    

    It represents a builder for a user, not a builder for a document of a user, doesn't it? Hence, I'd rather call it UserDBObjectBuilder.

  2. AFAICS the only added value to BasicDBObjectBuilder is the addDetails(...) method to add keys/values from a Map rather than single key/value pairs only.

    Why don't you simply:

     public UserDBObjectBuilder extends BasicDBObjectBuilder
    

    and just overload add(...) with add(Map details) therein?

  3. You supply a passwordHash to:

     public UserDocumentBuilder(..., String passwordHash, ...)
    

    and you apply another hash algorithm to this already-hash then? Why?

  4. MongoDB's BasicDBObjectBuilder implementation, apart from the missing method descriptions, is questionable on its own:

    • What is the difference between add(...) and append(...)?
    • What does push(String key) do? Adding a key with a null value associated to it?
    • What if I invoke BasicDBObjectBuilder.start("key", "value").start()? Is the building process started over again by eliminating the values given at the first start(...)? → These start() methods should better be different constructors.
  1. Neither MongoDB's BasicDBObjectBuilder nor your UserDocumentBuilder is a Builder according to the pattern of the GoF.
  1. Your name UserDocumentBuilder is somehow confusing. Especially when you then define:

     BasicDBObjectBuilder userDocumentBuilder = new BasicDBObjectBuilder()
    

    It represents a builder for a user, not a builder for a document of a user, doesn't it? Hence, I'd rather call it UserDBObjectBuilder.

  2. AFAICS the only added value to BasicDBObjectBuilder is the addDetails(...) method to add keys/values from a Map rather than single key/value pairs only.

    Why don't you simply:

     public UserDBObjectBuilder extends BasicDBObjectBuilder
    

    and just overload add(...) with add(Map details) therein?

  3. You supply a passwordHash to:

     public UserDocumentBuilder(..., String passwordHash, ...)
    

    and you apply another hash algorithm to this already-hash then? Why?

  4. MongoDB's BasicDBObjectBuilder implementation, apart from the missing method descriptions, is questionable on its own:

    • What is the difference between add(...) and append(...)?
    • What does push(String key) do? Adding a key with a null value associated to it?
    • What if I invoke BasicDBObjectBuilder.start("key", "value").start()? Is the building process started over again by eliminating the values given at the first start(...)? → These start() methods should better be different constructors.
edited body
Source Link
Gerold Broser
  • 1.3k
  • 8
  • 20
  1. Neither MonogDB's BasicDBObjectBuilder nor your UserDocumentBuilder is a Builder according to the pattern of the GoF.
  1. Your name UserDocumentBuilder is somehow confusing. Especially when you then define:

     BasicDBObjectBuilder userDocumentBuilder = new BasicDBObjectBuilder()
    

    It represents a builder for a user, not a builder for a document of a user, doesn't it? Hence, I'd rather call it UserDBObjectBuilder.

  2. AFAICS the only added value to BasicDBObjectBuilder is the addDetails(...) method to add keys/values from a Map rather than single key/value pairs only.

    Why don't you simply:

     public UserDBObjectBuilder extends BasicDBObjectBuilder
    

    and just overload add(...) with add(Map details) therein?

  3. You supply a passwordHash to:

     public UserDocumentBuilder(..., String passwordHash, ...)
    

    and you apply another hash algorithm to this already-hash then? Why?

  4. MongoDB's BasicDBObjectBuilder implementation is, apart from the missing method descriptions, is questionable on its own:

    • What is the difference between add(...) and append(...)?
    • What does push(String key) do? Adding a key with a null value associated to it?
    • What if I invoke BasicDBObjectBuilder.start("key", "value").start()? Is the building process started over again by eliminating the values given at the first start(...)? → These start() methods should better be different constructors.
  1. Neither MonogDB's BasicDBObjectBuilder nor your UserDocumentBuilder is a Builder according to the pattern of the GoF.
  1. Your name UserDocumentBuilder is somehow confusing. Especially when you then define:

     BasicDBObjectBuilder userDocumentBuilder = new BasicDBObjectBuilder()
    

    It represents a builder for a user, not a builder for a document of a user, doesn't it? Hence, I'd rather call it UserDBObjectBuilder.

  2. AFAICS the only added value to BasicDBObjectBuilder is the addDetails(...) method to add keys/values from a Map rather than single key/value pairs only.

    Why don't you simply:

     public UserDBObjectBuilder extends BasicDBObjectBuilder
    

    and just overload add(...) with add(Map details) therein?

  3. You supply a passwordHash to:

     public UserDocumentBuilder(..., String passwordHash, ...)
    

    and you apply another hash algorithm to this already-hash then? Why?

  4. MongoDB's BasicDBObjectBuilder implementation is, apart from the missing method descriptions, questionable on its own:

    • What is the difference between add(...) and append(...)?
    • What does push(String key) do? Adding a key with a null value associated to it?
    • What if I invoke BasicDBObjectBuilder.start("key", "value").start()? Is the building process started over again by eliminating the values given at the first start(...)? → These start() methods should better be different constructors.
  1. Neither MonogDB's BasicDBObjectBuilder nor your UserDocumentBuilder is a Builder according to the pattern of the GoF.
  1. Your name UserDocumentBuilder is somehow confusing. Especially when you then define:

     BasicDBObjectBuilder userDocumentBuilder = new BasicDBObjectBuilder()
    

    It represents a builder for a user, not a builder for a document of a user, doesn't it? Hence, I'd rather call it UserDBObjectBuilder.

  2. AFAICS the only added value to BasicDBObjectBuilder is the addDetails(...) method to add keys/values from a Map rather than single key/value pairs only.

    Why don't you simply:

     public UserDBObjectBuilder extends BasicDBObjectBuilder
    

    and just overload add(...) with add(Map details) therein?

  3. You supply a passwordHash to:

     public UserDocumentBuilder(..., String passwordHash, ...)
    

    and you apply another hash algorithm to this already-hash then? Why?

  4. MongoDB's BasicDBObjectBuilder implementation, apart from the missing method descriptions, is questionable on its own:

    • What is the difference between add(...) and append(...)?
    • What does push(String key) do? Adding a key with a null value associated to it?
    • What if I invoke BasicDBObjectBuilder.start("key", "value").start()? Is the building process started over again by eliminating the values given at the first start(...)? → These start() methods should better be different constructors.
Source Link
Gerold Broser
  • 1.3k
  • 8
  • 20
  1. Neither MonogDB's BasicDBObjectBuilder nor your UserDocumentBuilder is a Builder according to the pattern of the GoF.
  1. Your name UserDocumentBuilder is somehow confusing. Especially when you then define:

     BasicDBObjectBuilder userDocumentBuilder = new BasicDBObjectBuilder()
    

    It represents a builder for a user, not a builder for a document of a user, doesn't it? Hence, I'd rather call it UserDBObjectBuilder.

  2. AFAICS the only added value to BasicDBObjectBuilder is the addDetails(...) method to add keys/values from a Map rather than single key/value pairs only.

    Why don't you simply:

     public UserDBObjectBuilder extends BasicDBObjectBuilder
    

    and just overload add(...) with add(Map details) therein?

  3. You supply a passwordHash to:

     public UserDocumentBuilder(..., String passwordHash, ...)
    

    and you apply another hash algorithm to this already-hash then? Why?

  4. MongoDB's BasicDBObjectBuilder implementation is, apart from the missing method descriptions, questionable on its own:

    • What is the difference between add(...) and append(...)?
    • What does push(String key) do? Adding a key with a null value associated to it?
    • What if I invoke BasicDBObjectBuilder.start("key", "value").start()? Is the building process started over again by eliminating the values given at the first start(...)? → These start() methods should better be different constructors.
lang-java

AltStyle によって変換されたページ (->オリジナル) /