Why are configuration arrays acceptible parameters in PHP and Javascript?

Posted by RenderIn on Stack Overflow See other posts from Stack Overflow or by RenderIn
Published on 2010-04-20T16:48:52Z Indexed on 2010/04/20 16:53 UTC
Read the original article Hit count: 174

Filed under:
|
|
|

In most other OO languages it would be sacrilege to have each function receive a single associative array of Objects rather than enumerating each in the method signature. Why is it acceptable and commonly used in most popular frameworks for both of these languages to do this?

Is there some justification beyond wishing to have concise method signatures?

I do see a benefit in this -- that the API could remain unchanged as new, optional parameters are added. But Javascript and PHP already allow for optional parameters in their method signatures. If anything, it seems like Java or another OO language would benefit from this more... and yet I rarely see this pattern there.

What gives?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php