---
title: "Methods:Multiple parameters/structure?"  
description: "Methods:Multiple parameters/structure?"  
author: "Anonymous User"  
published: 2015-12-10  
updated: 2015-12-13  
canonical: https://www.mindstick.com/forum/33717/methods-multiple-parameters-structure  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 2 minutes  

---

# Methods:Multiple parameters/structure?

I have [notice](https://yourviews.mindstick.com/story/4562/happy-independence-day-2024-things-to-notice) by looking sample [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) in [iOS](https://www.mindstick.com/articles/12222/core-data-and-how-to-use-it-in-ios-objective-c), the [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) [design](https://www.mindstick.com/articles/12279/interior-design-and-furniture-store-wordpress-theme) structures [instead of](https://www.mindstick.com/articles/330/triggers-in-sql-server) [multiple parameters](https://www.mindstick.com/forum/160547/how-to-pass-multiple-parameters-in-url-dot-net-core-api).\
Why is that? As far as ease of use, I personally prefer the latter, but as far as performance goes, is there one [better choice](https://answers.mindstick.com/qa/97753/which-is-a-better-choice-netflix-or-hbo) than the other?

```
[pencilObj drawPoint:Point3Make(7,9,20)][pencilObj drawPointAtX:7 Y:15 Z:25]
```

## Replies

### Reply by Tarun Kumar

Here are following guidelines to decide parameter structure (apple does not recommend or prefer passing [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) parameters vs a structure/object):\
- Use individuals parameters or objects when it makes sense in the particular scenario.\
- Pass objects/structures when it makes sense for the method to understand many/all members of the object.\
- Pass objects/structures when you want to validate some rules on the relationship between the various members of the object. This allows you to ensure the consumer of your method constructs a valid object prior to calling your method (thus eliminating the need of the method to validate these conditions).\
- Pass individual arguments when it is clear the method makes sense and only needs certain elements rather than the entire object\
- Using a variation on your example, a paint method that takes two coordinates (X and Y) would benefit from taking a Point object rather than two variables, X and Y.\
- A method retrieveOrderByIdAndName would best be designed by taking the single id and name parameter rather than some container object.


---

Original Source: https://www.mindstick.com/forum/33717/methods-multiple-parameters-structure

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
