in reply to Re^3: Best practices passing database handles, cgi objects, etc.
in thread Best practices passing database handles, cgi objects, etc.
I fail to see how your OO approach is any better; all it does is wrap some global variables inside a class.
That is how its better, its called encapsulation
You can have $foo and $bar both be of type Classname, with both being able to ->dance and ->sign
Its better in the same way subroutines are better than not subroutines ( goto )
Its also why Main(@ARGV); sub Main { } is better than MAIN: { } because you can only goto MAIN , its a label, its not a subroutine, you can't call it
Its better in that its : testable/mockable, reusable, not fragile Action at a distance (computer programming)
http://programmers.stackexchange.com/questions/148108/why-is-global-state-so-evil
You cannot have more than one instance of global state -- its global
Also, it's silly to store multiple blogs (with identical schemas, I presume?) across multiple databases.
So is everything you wrote :)
|
|---|