Click here to Skip to main content
15,041,788 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have 2 functions in my application,both of them are doing the same thing but in different way. now i want to keep any one of can any one please suggest me how to find the proper one out of the 2 functions
Prasad_Kulkarni 23-Apr-12 7:24am
How would we come to know which one is proper without knowing what you've written in both functions?
Post code snippets of it.
enhzflep 23-Apr-12 7:25am
The question is incomplete and somewhat ridiculous!

How do you define 'the proper one'?
Sandeep Mewara 23-Apr-12 7:31am
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
subrata kumar Nayak 23-Apr-12 7:33am
can u suggest me any tool which will give the me the details of the execution of both functions so that i can choose one of them.i hv already tried fr profiler in visualstudio
Chandrasekharan P 23-Apr-12 7:37am
why not check the performance of each function and decide on which function to pick up.

Both of them (if correct) are 'the proper' one, unless you have:
  1. A target (speed, smaller code size, robustness, portability,...)
  2. A method to determine (that is measure) which one better fits with the target.
nv3 23-Apr-12 8:41am
Best possible answer for a question like that. 5ed!
CPallini 23-Apr-12 8:45am
Thank you.
In addition to what CPallini said how about keeping both in your code? If you have two implementations of a function you can write a set of tests that'll compare the results of the one you want to keep with the one you'd have otherwise discarded.

Another criteria (and possibly the most important one if you don't need to optimise) is how easy the functions are to read. Keep the one looks like the algorithm and ditch that looks like a spider's walked all over it.



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900