Skip to content

Code changes for Singleton and Builder Pattern assignment - #9

Open
venu123 wants to merge 3 commits into
kanmaytacker:masterfrom
venu123:master
Open

Code changes for Singleton and Builder Pattern assignment#9
venu123 wants to merge 3 commits into
kanmaytacker:masterfrom
venu123:master

Conversation

@venu123

@venu123 venu123 commented Sep 14, 2023

Copy link
Copy Markdown

Code changes for Builder Pattern assignment

this.instance = new DatabaseConfigurationBuilder();
}

public DBConfigBuilder WithDatabaseUrl(String url){

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor] Java uses camel case so a method name should look like withDatabaseUrl.
Read more about it here.

Comment on lines +59 to +61
public DatabaseConfigurationBuilder build(){
return instance;
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than returning the builder instance back, create an new object and return that.
This ensures immutability and isolation.

@venu123 venu123 changed the title Code changes for Builder Pattern assignment Code changes for Singleton and Builder Pattern assignment Sep 19, 2023

@venu123 venu123 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review change for singleton

@kanmaytacker
kanmaytacker self-requested a review October 4, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants