Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » PHP - The benefits of the singleton
PHP - The benefits of the singleton [message #1753486] Tue, 07 February 2017 05:42
Priti Mujumdar is currently offline Priti MujumdarFriend
Messages: 1
Registered: February 2017
Junior Member

I am learning some of the codes and see the use of singletons, where it seems to me, they do not need (or do not understand because of the lack of experience). It has become a rule of etiquette. For example, in the same class database. And why should such a design is used $ class :: getInstance () -> method1 () instead of $ class :: method1 ().

Why make the method public and to contact him through the dungeon if you can make it static? Can it be of help to reduce the load? Or, for the purpose of inheritance? As I understand, for DB Singleton only needed when the need to work with multiple databases on managed vps hosting (create an instance of the class). Or why use a singleton for the User, if the user is only one. From the obvious advantages, I do see an opportunity to implement several methods in one line, like this $ class :: getInstance () -> method1 () -> method2 () -> method2 ().

Share your experience, who use singletons and for what tasks.

[Updated on: Mon, 13 February 2017 06:53]

Report message to a moderator

Previous Topic:Debugging Server Side Linux but using Windows machine
Next Topic:Debugger is not stopping at breakpoints
Goto Forum:
  


Current Time: Wed Apr 25 20:31:51 GMT 2018

Powered by FUDForum. Page generated in 0.01910 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software