(1) As an API developer i dont want my clients to create the object.
Creation of object might require some additional things to do which as an API
developer i would do, would not like to give client the hassle of it.
(2) Helps me to maintain the number of instances being created.
I may want to have it as a Singleton. I do it.
Basically it gives me the security for my class and ables me to handle the lifecycle of it.
cheers,
Saurav
Be Objectively Oriented.Explore the power of OOPs.
My Blog, Eclipse EMF Query committer.
Also, you preserve the possibility to change your implementation later without having the client need to worry about it.
For example, you could easily return a different implementation and nobody will notice or have to change code on the client side. (This is given you work with interfaces).
JDBCSupport - An easy to use, light-weight JDBC framework -
Can somebody post me a good example illustrating these mentioned concepts???
Reason for me to ask is that I am still unable to get the complete understanding of the solution provided by Saurav and Sebastian.