4 introduction to programming structure

2,427 views

Published on

Published in: Technology, Education
1 Comment
3 Likes
Statistics
Notes
  • Thank you
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,427
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
128
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

4 introduction to programming structure

  1. 1. Data Structures and Algorithms Pointers for Structuring a Program 1. Use Modules 2. Use the four logic structures a. Sequential Structure b. Decision Structure c. Loop Structure d. Case Structure 3. Eliminate the rewriting of identical processes by using modules 4. Use techniques to improve readability, including the four logic structures, proper naming of variables, internal documentation, and proper indentationIntroduction to Programming Structure *Property of STI Page 1 of 11
  2. 2. Data Structures and Algorithms Cohesion and CouplingCohesion @ relates to the functional independence of the module and to the performance of a single “task” within the moduleCoupling @ allows modules to be connected by an interface, which enables the programmer to transfer data from one module to another.Introduction to Programming Structure *Property of STI Page 2 of 11
  3. 3. Data Structures and Algorithms ModulesRules in Designing Modules 1. Each module is an entity itself. 2. Each module has a single function. 3. Each module is short enough to be easily read and modified. 4. The length of a module is governed by its function and the number of instructions to be executed to perform that function. 5. A module is developed to control the order of processing.Introduction to Programming Structure *Property of STI Page 3 of 11
  4. 4. Data Structures and Algorithms Modules Types of Modules 1. Control Module 2. Initialization Module 3. Process Data Module a. Calculation Modules b. Print Modules c. Read and Data Validation Modules 4. Wrap-up module 5. Event Modules (OO-Paradigm)Introduction to Programming Structure *Property of STI Page 4 of 11
  5. 5. Data Structures and Algorithms Local and Global VariablesLocal Variables@ may be used only by the module itselfGlobal Variables@ they are global to the program as they can be seen by all modulesIntroduction to Programming Structure *Property of STI Page 5 of 11
  6. 6. Data Structures and Algorithms ParametersParameters @ local variables that are passed or sent from one module to another. Parameters are another way of facilitating coupling that allows the communication of data between modulesCalling Module @ the module that processes another moduleCalled Module @ the module being processedIntroduction to Programming Structure *Property of STI Page 6 of 11
  7. 7. Data Structures and Algorithms ParametersActual parameter listing @ the list of parameters that follows the module name being processed in the calling moduleFormal Parameter Listing @ the list of parameters that follow the module name at the beginning of the moduleIntroduction to Programming Structure *Property of STI Page 7 of 11
  8. 8. Data Structures and Algorithms Parameters Types of parameter passing a Call by value a Call by referenceIntroduction to Programming Structure *Property of STI Page 8 of 11
  9. 9. Data Structures and Algorithms ParametersIntroduction to Programming Structure *Property of STI Page 9 of 11
  10. 10. Data Structures and Algorithms ParametersIntroduction to Programming Structure *Property of STI Page 10 of 11
  11. 11. Data Structures and Algorithms Variable Names and Data Dictionary The Four Logic Structures • Sequential • Decision • Loop • CaseIntroduction to Programming Structure *Property of STI Page 11 of 11

×