is it good, that every PHP class implements a Singleton pattern? I think, it will be less memory usage because of it. Is it right opinion? Thanks!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Software is meant to model the reality. that’s the way the OOP exists. that said, Singleton is not a hammer for all nails. You can use it in certain models, but there are others which simply will not adjust.
Take for example, model a list of persons. If you decide to create a Person class, then you will not be allowed to have more than one person on your model.