Programming Tip of the Day – Too many parameters

Avoid passing too many parameters to a method.  If you are forced to pass too many parameters, you are either missing a structure or an object.


For eg.


StoreStudentData(int rollnum, string firstname, string lastname, string class, string section, string[] marks)



can be defined better as

struct StudentInfo


int rollnum;

string firstname;

string lastname;

string class;

double[] marks;


StoreStudentInfo(studinfo) //Here studinfo is a struct variable, which can hold these values.



Advantage is all parameters are contained in a group (using struct) and this can be easily extended to an array of students also.


Programming Tip of the Day is brought to you by GUVI.  It is a collection of commonly known, yet commonly made mistakes by developers from time to time.

If you want to get programming tips by GUVI on a regular basis, Subscribe to GUVI Blogs by entering your email id in the “FOLLOW BLOG BY EMAIL” section.

Contact Form

By clicking 'Submit' you Agree to Guvi Terms & Conditions.

Our Learners Work at

Our Popular Course

Share this post

Author Bio


Our Live Classes

Learn Javascript, HTML, CSS, Java, Data Structure, MongoDB & more
Learn Python, Machine Learning, NLP, Tableau, PowerBI & more
Learn Selenium, Python, Java, Jenkins, Jmeter, API Testing & more
Learn Networking, Security Testing, IAM, Access Management & more

Hey wait, Don’t miss New Updates from GUVI!

Get Your Course Now

Related Articles