1 / 16

BPC.1 Basic Programming Concepts

BPC.1 Basic Programming Concepts. 1.1 Program development procedures 1.2 Problem analysis techniques 1.3 Algorithm design 1.4 Program debugging 1.5 Program documentation 1.6 Problem solving approaches 1.7 Structured programming 1.8 Good programming style.

sanjiv
Download Presentation

BPC.1 Basic Programming Concepts

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. BPC.1 Basic Programming Concepts 1.1 Program development procedures 1.2 Problem analysis techniques 1.3 Algorithm design 1.4 Program debugging 1.5 Program documentation 1.6 Problem solving approaches 1.7 Structured programming 1.8 Good programming style

  2. Program development procedures

  3. Program development procedures

  4. Problem Analysis • Concept of modularity • Divide the statements into logical groups called module. • Each module performs one or two tasks. • The modules are usually written in the form of sub-programs. • Stepwise refinement • Break down a problem into smaller parts (or modules) until it becomes manageable.

  5. Designing an algorithm • Algorithm • a set of ordered steps • Pseudocode is used to shorten the statement • There is NO syntax in writing algorithm • Pseudocode may include basic programming: 1. Using assignment statement e.g. A5, A = 5 or A := 5 means putting 5 into variable A 2. Using conditional statements, like • If...then...else...end if, represent different actions some conditions. 3. Using indentation to clarify the statements blocks.

  6. Using program flowchart to realise algorithm • Program flowchart • Graphical representation of instructions • Representing the logic of a single program • Can be converted into programming constructs: • branching • iteration structures

  7. E.g. 1 • Example 1 Assign different value to Y depending on the input value.

  8. E.g. 2 • Example 2 Calculate the sum of 1 + 2 + ... + 10. • Output is 55

  9. Debugging and Testing • Debugging • Finding out errors (bugs錯誤[蟲]) and • Removing them • Compare the output with the expected one • Testing • Verify that the program will process all data properly • Should use both • valid and invalid test data

  10. Programming Errors • 1. Syntax (語法) Errors • Violation of the grammatical rule of a programming language • e.g. Wrong spelling of some keywords • 2. Run-time (執行) Errors • Cause a program to terminate abnormally • e.g. Division-by-zero error, Out of memory error. • 3. Logical (邏輯) Errors • Caused by an incorrect algorithm • Producing an unexpected result, e.g. an average mark > 100 • May not be discovered until it is too late • So, programs should be well tested before use

  11. Documentation • Documentation • Written description about the solution to a problem • User manual • Instruct user how to operate the program effectively • Including: 1. Procedures in starting the program 2. Description of buttons/commands in the menu 3. Description of error messages and how to handle such errors 4. Description of defaults values 5. Sample procedures in finishing a task

  12. Documentation • Technical documentation • for programmers or technical people • providing information about how the solution is developed • Useful for maintenance and further development • Including: 1. Description of the problem 2. Algorithm 3. Program flowchart 4. Program listing with comments 5. List of files used 6. Test data 7. Sample output

  13. Different Ways to Solve a Problem • A. Packaged software vs Custom software • Packaged software • Pre-written software available for purchase • Less expensive • Company may need to adjust in order to use packaged software • Custom software • Written by IT department • Match the company’s requirements • But, more expensive and take a longer time to develop

  14. Different Ways to Solve a Problem • B. Planning vs Without Planning • Usually more than one logical solution • An easy one may solve the problem temporarily • But, when new problem arises, programs may be difficult to change • Programs should have careful planning before development • Otherwise, take much longer and more effort to change

  15. Structured programming • Sequence • Steps follow each other in a logical sequence. • Alternation • They may be if or case statements. • Iteration • They are while, for or repeat statements.

  16. Good programming style • Structured program • Modular design • Readable • Reusable • Reliable • Portable • Program documentation

More Related