0 like 0 dislike
33 views
in Computer Science by (1.0m points)
What is the purpose of function argument?

1 Answer

0 like 0 dislike
by (1.0m points)
I assume that by argument you don't mean ‘a heated dicussion’. An argument is a means of providing information to a function that can change the output (potentially). When you write a function you have to think about the domain (inputs) and range (outputs). The more complex the operations inside the more information you may need to provide. I will provide an example from a recent project.

I was given a text file containing 3D points generated by a robot. I was tasked with turning these points into a 2D map. The request also included that the results be returned progressively, which meant I needed to process the information in pieces.

I now had a bare bones idea of what the customer wanted, but I only have limited access to them and they are proficient in technical aspects, but not in this area. I can’t go and ask them for every detail because they may not know enough about the problem space to answer well. So that means (for me at least) anytime there is a choice about how to design and build the 2D map, I must provide options.

So I know from previous experiences with image processing that there will be lots of choices. With lots of choices, I don't anticipate to create functions with 5,000 arguments, so I create a structure to encapsulate all of my options.

Arguments allow the developer to adjust the output(s) generated by a function. It allows the function to be more generic and be applied to a broader set of related problems and deliver consistent solutions.
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

3.2k users

Free Hit Counters
...