Welcome Guest, Not a member yet? Register   Sign In
Where to put standard functions that reference lib/mod methods
#6

(08-11-2015, 11:07 AM)jLinux Wrote:
(08-11-2015, 07:39 AM)Narf Wrote: IMO, it's a sign of bad design when you start mixing procedural functions and OOP code in the way that you're trying to. If I ever needed anything similar, I'd just declare static methods in the class instead.
I kinda agree, but sometimes its easier to do something like...
echo "Your id is " . un_from_id; 
as opposed to 
echo "Your id is " . $this->Accounts_model->username_from_id('123'); 
every time. I thought that it was a no-no to add procedural functions, But ive seen it done quite a few times, including in WP, so oh well

I suggested static methods, you call those directly as className::methodName(). Smile

And you're going to see A LOT of crappy code from all kinds of sources, don't take that as a validation of bad practices ... especially WP is probably the worst source of inspiration in that regard.
Reply


Messages In This Thread
RE: Where to put standard functions that reference lib/mod methods - by Narf - 08-11-2015, 03:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB