Function that requires many parameters

Posted by user877329 on Programmers See other posts from Programmers or by user877329
Published on 2012-09-12T15:29:33Z Indexed on 2012/09/12 15:49 UTC
Read the original article Hit count: 218

Filed under:
|

I have a problem related to this:

Are there guidelines on how many parameters a function should accept?

In my case, I have a function that describes a rounded rectangle. The caller specifies

  • An integer which determines how the rectangle should be merged into previously created shapes
  • An Anchor, which is a point that is used for alignment (right, left, top, bottom etc). (0,-1) means that position (next parameter) describes the top, middle point of the rectangle.
  • The position of the rectangle
  • Width and height
  • Corner radius

Should I use Parameter Object pattern in this case? It is hard to see how these parameters are related

© Programmers or respective owner

Related posts about interfaces

Related posts about functions