Large C++ function

Discussion in 'C++' started by nilavya, Dec 6, 2005.

  1. nilavya

    nilavya Guest

    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.
    nilavya, Dec 6, 2005
    #1
    1. Advertising

  2. * 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?
    Alf P. Steinbach, Dec 6, 2005
    #2
    1. Advertising

  3. nilavya

    Guest

    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.
    , Dec 6, 2005
    #3
  4. nilavya

    nilavya Guest

    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.
    nilavya, Dec 6, 2005
    #4
  5. nilavya

    Guest

    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.
    , Dec 6, 2005
    #5
  6. nilavya

    nilavya Guest

    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.
    nilavya, Dec 6, 2005
    #6
  7. nilavya

    Csaba Guest

    "nilavya" <> 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.
    Csaba, Dec 13, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adam Smith
    Replies:
    1
    Views:
    309
    Adam Smith
    Apr 21, 2004
  2. Edvard Majakari
    Replies:
    6
    Views:
    343
    Peter Otten
    Feb 18, 2004
  3. nilavya
    Replies:
    3
    Views:
    276
    technator
    Nov 23, 2005
  4. Ketchup
    Replies:
    1
    Views:
    240
    Jan Tielens
    May 25, 2004
  5. Replies:
    5
    Views:
    870
    Xho Jingleheimerschmidt
    Apr 2, 2009
Loading...

Share This Page