GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

Writing Maintainable code

Ron Wabe Englisch 5,0Durchschnittliche Bewertung 5,0 von 5 (2 Bewertungen) 12 Karten

Karten in diesem Stapel (12)

  1. 1Define constant.A name used to refer to a fixed value.
    The value must be set when the code is written.
    It cannot be changed while the program is running.
  2. 2Define variableAn identifier name that refers to a particular memory location that is used to store data.
    The value of the data that is stored can be changed when the program is running.
  3. 3What is a global variable?Declared at the beginning of the program. It can then be used in all subroutines in the program.
  4. 4What is a local variable?Declared within a subroutine and can only be used in that subroutine.
  5. 5What is an identifier?The name given to a variable, constant or subroutine is called it's identifier.
  6. 6What is a reserved word/keyword?Words that have a specific purpose in a programming language.
    These CANNOT be used as identifiers.
  7. 7What are the differences between constants and variables?1. When a constant is declared it must be given an actual value, variables can be left empty initially.
    2. A constant must remain the same during the running of a program, a variable can change.
  8. 8What does 'initialising variables' mean?- Initialising means a variable is given a starting value.
    - Initialising variables makes the code easier to follow.
  9. 9How can you use constants to maintain a program?- Using a descriptive identifier for the constant makes the code clearer to read which makes it easier to maintain.
    - It is easier to remember the identifier than the value when writing the code.
    - If the value needs to be changed then you can change the value on the line where it is being declared and this updates the value throughout the program.
  10. 10When naming constants and variable, what should you do?1. Identifier names should describe the item identified.
    2. Declarations of variables/constants should be commented to explain their purpose.
    3. Standard conventions include using underscores.
    4. Keywords of the language cannot be used as the translator will produce a syntax error.
    5. Variables/constants should be declared as possible wherever possible.
  11. 11How can you lay out code to make it more maintainable?1. Organising code into modules.
    2. Using indentation to show control structures easily.
    3. Using white space to format the code into logical groups statements.
    4. Adding comments to describe what different parts of the code do.
  12. 12Why should programmers use these programming techniques?1. It enables a team of programmers to work together on a program and understand each others code.
    2. If everyone follows the same convention then all modules will match and other programmers can read it/ maintain it later on.
    3. Indentation shows the structure of the code e.g. where IF statements start and end.
    4. Meaningful identifiers make the code easier to understand.
    5. Code that is split into modules is easier to debug and read in general.
    6. Comments make it easier to trace the logic of the program and find where errors occur.

Informationen

Beschreibung
Dope , hella accurate awesome flash cards by yours truly
Erstellt von
Ron Wabe
Aufrufe
39
Bewertung
Durchschnittliche Bewertung 5,0 von 5 (2 Bewertungen)

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck