Skip to content
Advertisement

Tag: design-principles

Creating new instance of concrete implementation in interface – is this an antipattern?

Let’s say I have the interface AuthorDao with two different implementation classes for example MyAuthorDaoImpl1 and MyAuthorDaoImpl2. In my interface AuthorDao I have some basic crud methods and one extra method which is static for getting a new instance of MyAuthorDaoImpl1. It looks like this: Questions Is this static method getInstance() is not an anti-pattern? Because in my opinion we

Advertisement