Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Large C++ function

Reply
Thread Tools

Large C++ function

 
 
nilavya
Guest
Posts: n/a
 
      12-06-2005
Hi,

I have an application for GUI.
I have got too many functions for display and one main and really huge
function for maintaining the state of the GUI. Now I dont know about
how the size of the function will affect the execution. The function
incorporates a nested switch case logic i.e. based on one state and the
event from GUI, I display accordingly on the gUI. can anyone help me to
know if a C++ function of around 3000Lines really affects the
execution.

Thanks,
With Regards,
Bhagat Nirav K.

 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      12-06-2005
* nilavya:
> can anyone help me to
> know if a C++ function of around 3000Lines really affects the
> execution.


The size of a function does not affect the program's execution, but it
does mean the code is unmaintenable.

Split it up.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
 
Reply With Quote
 
 
 
 
yuvalif@gmail.com
Guest
Posts: n/a
 
      12-06-2005
I don't think the size of a function has any performance implications,
however, it has huge (literally...) maintenance implications, and even
worst, it makes your function untestable.
In other words, the probability of creating bugs while modifying the
function is high, and the probability of discovering them is low.
I suggest you take a look in the "State Machine" DP (GOF book, or any
other), its one of the more usefull ones.

Yuval.

 
Reply With Quote
 
nilavya
Guest
Posts: n/a
 
      12-06-2005

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I don't think the size of a function has any performance implications,
> however, it has huge (literally...) maintenance implications, and even
> worst, it makes your function untestable.
> In other words, the probability of creating bugs while modifying the
> function is high, and the probability of discovering them is low.
> I suggest you take a look in the "State Machine" DP (GOF book, or any
> other), its one of the more usefull ones.
>
> Yuval.



HI,

thanks for the reply.
Can you tell me where can i find "State machine" DP ?? is it an e-book
or some other link. ?

Thanks,
With Regards,
Bhagat Nirav K.

 
Reply With Quote
 
yuvalif@gmail.com
Guest
Posts: n/a
 
      12-06-2005
State Machine is a Design Pattern (DP). I don't know of any online DP
book, but the most classic one is: "Design Patterns: Elements of
Reusable Object-Oriented Software/Erich Gamma" written by four people,
hence, called GOF (Gang Of Four).

Yuval.

 
Reply With Quote
 
nilavya
Guest
Posts: n/a
 
      12-06-2005
Okey...

Got it and I have got that Book.
I thought about that ..but then...
Anyways..
Thanks for pointing out..

With Regards,
Bhagat Nirav K.

 
Reply With Quote
 
Csaba
Guest
Posts: n/a
 
      12-13-2005
"nilavya" <(E-Mail Removed)> wrote in news:1133856483.673056.293090
@z14g2000cwz.googlegroups.com:

> Hi,
>
> I have an application for GUI.
> I have got too many functions for display and one main and really huge
> function for maintaining the state of the GUI. Now I dont know about
> how the size of the function will affect the execution. The function
> incorporates a nested switch case logic i.e. based on one state and the
> event from GUI, I display accordingly on the gUI. can anyone help me to
> know if a C++ function of around 3000Lines really affects the
> execution.
>


It may not affect execution, but it sure affects maintainability (and not
in a positve way, I can assure you!).


--
Life is complex, with real and imaginary parts.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
median of large data set (from large file) friend.05@gmail.com Perl Misc 5 04-02-2009 04:06 AM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
[Urgent] Is there a size limit on returning a large dataset or a large typed array from web service? Ketchup ASP .Net Web Services 1 05-25-2004 10:11 AM
Passing a C++ object's member function to a C function expecing a function pointer! James Vanns C++ 7 01-21-2004 02:39 AM
Backing Up Large Files..Or A Large Amount Of Files Scott D. Weber For Unuathorized Thoughts Inc. Computer Support 1 09-19-2003 07:28 PM



Advertisments