Jump to content

objects/functions arguments like jquery or as3


fivestringsurf

Recommended Posts

I just wanted to get some feedback on this topic.

Ive written many php functions/classes in the past and some of the more complicated ones end up with many arguments...like

...
function my_fun($arg1, $arg2, $arg3, $arg4){
...

Lately I've had my head into many jQuery and ActionScript3 developments.  I love writing classes with those languages/frameworks (especially in as3) in which I simpy pass one argument (an object literal) which contains all the data necessary.  It seems like such a clean way to write modular classes and makes the class very "readable" later on.

 

I'm sure I can accomplish something similar to this using an associative array in php...but

I just wanted to hear some of you guy's (and girl's) thoughts on this.

 

let's hear it!

thanks for the response

yep that's what I've been playing around with...plus I think many php folks use separate methods for each setting...I guess you would call it a "setter"?  where as that design pattern hasn't looked quite the same, especially in jQuery plugins to be specific.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.