Large Function, is it burden ?

N

nilavya

HI,

I have an application and trying to figure out the cause for one of the
problem.

I have a large function in my main class, which in turn calls another
function which too has many line of code and many switch,cases. I doubt
that duty this functions my application freezes. Is it that a large
function will occupy more memory...??? If I am wrong please help
me...or atleast can you provide me with the exact fundamentals of
Function calls and their memory footprints while execution..

thanks,
With regards,
Bhagat nirav K.
 
N

n2xssvv g02gfr12930

nilavya said:
HI,

I have an application and trying to figure out the cause for one of the
problem.

I have a large function in my main class, which in turn calls another
function which too has many line of code and many switch,cases. I doubt
that duty this functions my application freezes. Is it that a large
function will occupy more memory...??? If I am wrong please help
me...or atleast can you provide me with the exact fundamentals of
Function calls and their memory footprints while execution..

thanks,
With regards,
Bhagat nirav K.

The larger the function, the more code it requires, hence it will
require more memory. Now the problem with large functions is they are
difficult to understand and hence difficult to debug. Personally I find
anything more than 2 pages of code for a function is difficult to
understand, let alone maintain. Hence I tend to have more smaller
functions which will have the extra call and return code overhead,
(which is not normally excessive), but are easier to understand and debug.

JB
 
M

Mike Wahler

nilavya said:
HI,

I have an application and trying to figure out the cause for one of the
problem.

I have a large function in my main class, which in turn calls another
function which too has many line of code and many switch,cases. I doubt
that duty this functions my application freezes. Is it that a large
function will occupy more memory...??? If I am wrong please help
me...or atleast can you provide me with the exact fundamentals of
Function calls and their memory footprints while execution..

The memory footprint of a function would not itself be the
cause of your program 'freezing', rather some logical error
in your code. Start the coffee pot and the debugger.

-Mike
 
T

technator

The complexity of function increases as number of if-then statements/
switch-case statements increase. The function becomes less testable and
hence prone to errors if it is really large.

The memory footprint would depend on your code rather than size of the
function.

~Technator
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top