well structured program - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

well structured program

rossifumirossifumi Posts: 2Member
What is meant by a well structured c program? Why is it important that a program should be well structured. Has anyone got any good links that can answer my questions ? Or can anyone answer them?
Many Thanks,

rossifumi

Comments

  • Ruud CoppensRuud Coppens Posts: 13Member
    A well structured program is a program which does not only work, but is readable for other programmers and easy to add new functionality to it, without changing the whole code.

    To structure your code in a good way you can use several simple rules
    - choose your names right (the name should already say where the function or variable is used for. (thus not t = 5, but for better idx = 5 which says that the variable is used for indexing)
    - do not make your functions to big. This makes them unreadable
    - do not use loops in loops in loops or the same with if statements.
    (this also makes the function unreadable) better make new small functions for them
    - when you programm with classes, structuring your programm is much more difficult, because really complex structures can be made with classes

    greetings ruud

    : What is meant by a well structured c program? Why is it important that a program should be well structured. Has anyone got any good links that can answer my questions ? Or can anyone answer them?
    : Many Thanks,
    :
    : rossifumi
    :



  • rossifumirossifumi Posts: 2Member
    Ruud, 1 more please, I have an exam coming up and I am working through some practice questions, hope you don't mind.

    'Why is it important that a program should be well structured'.

    Is this the same answer as in my first question?

    Many Thanks

    Rich



    : A well structured program is a program which does not only work, but is readable for other programmers and easy to add new functionality to it, without changing the whole code.
    :
    : To structure your code in a good way you can use several simple rules
    : - choose your names right (the name should already say where the function or variable is used for. (thus not t = 5, but for better idx = 5 which says that the variable is used for indexing)
    : - do not make your functions to big. This makes them unreadable
    : - do not use loops in loops in loops or the same with if statements.
    : (this also makes the function unreadable) better make new small functions for them
    : - when you programm with classes, structuring your programm is much more difficult, because really complex structures can be made with classes
    :
    : greetings ruud
    :
    : : What is meant by a well structured c program? Why is it important that a program should be well structured. Has anyone got any good links that can answer my questions ? Or can anyone answer them?
    : : Many Thanks,
    : :
    : : rossifumi
    : :
    :
    :
    :
    :

  • Ruud CoppensRuud Coppens Posts: 13Member
    the answer is that a programm should be well structured for a few reasons

    - a well structured program is easier to understand for people
    who reads the program for the first time
    - it costs less time to make changes to a well structured program
    (so at long time it is more efficient). Because the overview on the whole program is better.
    In a not well structured program this can be very hard

    At this moment I don't know more reasons. But it is just as all the other things in live. Why do we structure them? To become a better overview of the whole amount of information. And due to the better overview we do things faster and with less errors. (just think why you have a schedule for school)

    but what kind of school are you doing?

    : Ruud, 1 more please, I have an exam coming up and I am working through some practice questions, hope you don't mind.
    :
    : 'Why is it important that a program should be well structured'.
    :
    : Is this the same answer as in my first question?
    :
    : Many Thanks
    :
    : Rich
    :
    :
    :
    : : A well structured program is a program which does not only work, but is readable for other programmers and easy to add new functionality to it, without changing the whole code.
    : :
    : : To structure your code in a good way you can use several simple rules
    : : - choose your names right (the name should already say where the function or variable is used for. (thus not t = 5, but for better idx = 5 which says that the variable is used for indexing)
    : : - do not make your functions to big. This makes them unreadable
    : : - do not use loops in loops in loops or the same with if statements.
    : : (this also makes the function unreadable) better make new small functions for them
    : : - when you programm with classes, structuring your programm is much more difficult, because really complex structures can be made with classes
    : :
    : : greetings ruud
    : :
    : : : What is meant by a well structured c program? Why is it important that a program should be well structured. Has anyone got any good links that can answer my questions ? Or can anyone answer them?
    : : : Many Thanks,
    : : :
    : : : rossifumi
    : : :
    : :
    : :
    : :
    : :
    :
    :

  • Ruud CoppensRuud Coppens Posts: 13Member
    the answer is that a programm should be well structured for a few reasons

    - a well structured program is easier to understand for people
    who reads the program for the first time
    - it costs less time to make changes to a well structured program
    (so at long time it is more efficient). Because the overview on the whole program is better.
    In a not well structured program this can be very hard

    At this moment I don't know more reasons. But it is just as all the other things in live. Why do we structure them? To become a better overview of the whole amount of information. And due to the better overview we do things faster and with less errors. (just think why you have a schedule for school)

    but what kind of school are you doing?

    : Ruud, 1 more please, I have an exam coming up and I am working through some practice questions, hope you don't mind.
    :
    : 'Why is it important that a program should be well structured'.
    :
    : Is this the same answer as in my first question?
    :
    : Many Thanks
    :
    : Rich
    :
    :
    :
    : : A well structured program is a program which does not only work, but is readable for other programmers and easy to add new functionality to it, without changing the whole code.
    : :
    : : To structure your code in a good way you can use several simple rules
    : : - choose your names right (the name should already say where the function or variable is used for. (thus not t = 5, but for better idx = 5 which says that the variable is used for indexing)
    : : - do not make your functions to big. This makes them unreadable
    : : - do not use loops in loops in loops or the same with if statements.
    : : (this also makes the function unreadable) better make new small functions for them
    : : - when you programm with classes, structuring your programm is much more difficult, because really complex structures can be made with classes
    : :
    : : greetings ruud
    : :
    : : : What is meant by a well structured c program? Why is it important that a program should be well structured. Has anyone got any good links that can answer my questions ? Or can anyone answer them?
    : : : Many Thanks,
    : : :
    : : : rossifumi
    : : :
    : :
    : :
    : :
    : :
    :
    :

Sign In or Register to comment.