Home
Independent
Programming
  1. Software Standards Specification
  2. Software Requirements Definition
  3. Software Best Practices
  4. Input Validation
  5. Output Validation
  6. Cookie Requirements
  7. Access Failure Error Checking
  8. Buffer Overflow
  9. Code Structure
  10. Software Functions
  11. Software Modules
  12. Requirements for Variables
  13. Software Code Comment Requirements
  14. Quality Code Requirements
  15. Software Code Review
  16. Software Code Testing Requirements
  17. Software Change Control

    Security Best Practices

  18. Secure Functional Requirements
  19. Account Creation
  20. Change Password
  21. Forgot Password
  22. Personal Question
  23. Contact Webmaster
  24. CAPTCHA Tests
  25. Answer Verification
Programming
Independent
Home

Software Functions

Software functions are an integral part of the program. Programs and their relationships to the program must be well designed in order for the program to be well organized and maintainable.

Rules for Functions

  • The function name should help indicate the function purpose.
  • Functions should perform only one task.
  • Functions should be as short as possible.
  • Functions should control changes to internal data by restricting access.
  • Each function must have an initial comment. Initial comments in the program should make the algorithm used in the function obvious. The initial comment should explain:
    • What its purpose or use is.
    • What arguments it requires or accepts and what their use is.
    • What value(s) the function returns.
    • What values or parts of the program the function may change.
    • Algorithms used.
    • Conditions which may cause the program to fail.
    • The creator of the function.
    • The date the function was created.
    • The version number of the function.
  • Comments in the code must be used frequently to ensure what is happening is easy to understand.
  • Compound conditional statements should be limited to avoid confusion.
  • When used in functions, the use of { and } should be on their own lines to demark blocks of code