Re: Experiments
Reply #2 –
Because I proposed it and I propose only cool things. nods in agreement with himself
Re: Experiments
Reply #4 –
And what problem are you hoping to solve by switching to oop? Or what will this let you do that you can't do now?
Re: Experiments
Reply #6 –
Thanks for mentioning me. Glad I saw this. Singletons aren't really good practice. Not saying that they can't be used, but generally you should try not to use them.
This is a Dependency Injection Container (DIC) and I think the best one out there is Pimple. It is small, light, and extensible. It also doesn't use any singletons.
Here's the problem with your example: what if you wanted to change the database there to something else? You'd have to rewrite it. If you injected the database object in to that class, you wouldn't have to rewrite anything. You would just inject a different database. Simple. You would use a database interface to ensure it won't break in the methods. Another problem with that class is, what if you want to extend it and add more properties and methods? You'd have to change what is instantiated in the bootstrap file. This is another case where Pimple, with its variables, works best.
Re: Experiments
Reply #10 –
You don't even have to think about switching the engines. Think about switching from a master to slave or you want to send some stuff to another server.