1 / 16

Hierarchical View of Software Construction

Hierarchical View of Software Construction. Statements Three Types of Statements Sequence Selection Iteration Modules (paragraph, procedure, subroutine, function) One or more statements combine to form a module Program One or more modules combine to form a program

keefe
Download Presentation

Hierarchical View of Software Construction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hierarchical View of Software Construction • Statements • Three Types of Statements • Sequence • Selection • Iteration • Modules (paragraph, procedure, subroutine, function) • One or more statements combine to form a module • Program • One or more modules combine to form a program • Sub-System or System • One or more programs combine to form a sub-system or system

  2. Two Software Evaluation Metrics Cohesion Coupling

  3. COHESION: The measure of strength of the interrelatedness of statements within a module • Functional • Informational • Communicational • Procedural • Temporal • Logical • Coincidental High (best) Low (worst)

  4. COHESION: The measure of strength of the interrelatedness of statements within a module • Functional - one action or goal • Informational - multiple independent actions on • the same data • Communicational - series of steps on same data • Procedural - series of steps for an action • Temporal - series of related actions related in time • Logical - series of related actions • Coincidental - multiple, unrelated actions High (best) Low (worst)

  5. Cohesion Generally, the smaller the module the greater the cohesion

  6. Coincidental Cohesion On Form Activate Event: SHOW screen 1.2 PRINT the ssn [global variable] in the SSN picture box Print the name [global variable] in the NAME picture box PRINT column headings ("COURSE ID TITLE LOCATION START TIME DAYS INSTRUCTOR" in the BIG Picture Box FINDFIRST record in the student-class table for the global SSN IF nomatch on student class table PRINT 'no classes' in the picture box ELSE SET counter to 0

  7. LOOP WHILE counter < 15 and nomatch on student-class table is FALSE FINDFIRST record on the class file for the COURSE ID and SECTION on the student class table IF nomatch on class table MSGBOX ("COURSE ID NOT ON THE CLASS TABLE -- should not happen---WHY??”) ELSE FINDFIRST record on the course file for the COURSE ID on the class file IF nomatch on the course file MSGBOX (“Course Id not on course table -- should not happen – why??) SET title to “not found” END IF FINDFIRST INSTRUCTOR SSN [from the class table] on the Instructor Table IF nomatch on the instructor file MSGBOX(“Instructor ssn not on the instructor file”) PRINT course-id, section, title, building, room, start time, days, instructor SSN in the picture box ELSE PRINT course-id, section, title, building, room, start time, days, instructor NAME in picture box END IF ENDIF FINDNEXT record on student class table for the global SSN INCREMENT counter by 1 END LOOP IF counter >= 15 MSGBOX ("picture box is too small to show all classes") END IF END IF

  8. Problems with the Previous Design The loop routine contains many actions or goals a. Obtain the information about the class from the class table b. Obtain the title from the course table c. Obtain the instructor name from the instructor table

  9. Stronger Cohesion • Make Smaller Modules • Make the loop a separate function • Break up the loop into smaller modules • Class information • Course information • Instructor information

  10. On Form Activate Event: SHOW screen 1.2 PRINT the ssn [global variable] in the SSN picture box PRINT the name [global variable] in the NAME picture box PRINT column headings ("COURSE ID LOCATION START TIME DAYS INSTRUCTOR" in the BIG Picture Box FINDFIRST SSN [global variable]in the student-class table IF nomatch on student class table PRINT 'no classes' in the picture box ELSE CALL looping routine ENDIF

  11. Looping Routine: SET counter to 0 LOOP WHILE counter < 15 and nomatch on student-class table is FALSE CALL class routine FINDNEXT SSN [global variable] on student cla INCREMENT counter by 1 END LOOP IF counter >= 15 MSGBOX ("picture box is too small to show all classes") ENDIF End Looping routine

  12. Class Routine FINDFIRST record on the class file for the COURSE ID and SECTION on the student class table IF nomatch on class table MSGBOX ("COURSE ID NOT ON THE CLASS TABLE”) ELSE CALL Course Routine CALL Instructor Routine ENDIF End Class Routine

  13. Instructor Routine FINDFIRST record on the instructor file for the INSTRUCTOR SSN on the class file IF nomatch on the instructor file MSGBOX(“Instructor ssn not on the instructor file”) PRINT course-id, section, building, room, start time, days, instructor SSN in the picture box ELSE PRINT course-id, section, building, room, start time, days, instructor NAME in picture box ENDIF End Instructor Routine

  14. Course Routine FINDFIRST record on the course file for the COURSE ID on the class file IF nomatch on the course file MSGBOX (“Course Id not on course table”) – why??) SET title to “not found” ENDIF End Course Routine

  15. COUPLING: The measure of strength of the connection between modules • Content • Common • Control • Stamp • Data • No Coupling High (worst) Low (best)

  16. COUPLING: The measure of strength of the connection between modules • Content - direct branch into middle of module • Common - global reference of variables • Control - control element being passed • Stamp - pass an entire data structure • Data - variables or fields only being passed • No Coupling High (worst) Low (best)

More Related