passing a lot of  parameters to the methods?

Posted on 2012-08-17
Last Modified: 2012-08-20

I have this application which takes in a lot of input parameters does calculations.
All these methods I have are calculations.
Some of those parameters are array. The number of parameters ranges from 4-20.

1) What's starndard as far as passing parameters?

2) so i am trying to create classes and pass the class objects instead?

Any advise  or suggestion about passing the parameters to the methods?
Question by:dkim18
    LVL 49

    Assisted Solution

    by:Julian Hansen
    Using an object to pass parameters is in my opinion the better way to go - it is far more extensible if you need to change in the future and allows you to chain calls from one function to the other without having to deal with messy parameters lists - or change them if things change in the future.
    LVL 40

    Accepted Solution

    It depends on what you exactly intends to do.

    Creating a class as suggested is very often the best way to go. But it can lead to deployment headaches if the method is in a dll shared by more that on application.

    There are alternatives that are sometimes easier to implement and can also make things easier in some update scenarios. Look up Optional Parameters and ParamArray in online help. Office VBA has been built that way and has been living for many many version over more than 20 years.

    The class is probably the first option to consider. But you should not disregard the alternatives. The use of one over the others is dependant on what you intend to do now and how you expect the application to evolve in future versions.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now