Presentation is loading. Please wait.

Presentation is loading. Please wait.

CHAPTER:14 Programming Methodology Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.

Similar presentations


Presentation on theme: "CHAPTER:14 Programming Methodology Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND."— Presentation transcript:

1 CHAPTER:14 Programming Methodology Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND

2 Objective  In this presentation you will learn about the various guidelines regarding development of a good program.  Understanding goodness of a program  Steps to develop a Program.  Errors classification and understanding  Program Testing  Documentation

3 SYLISTIC GUIDELINES  Meaningful names for identifiers Identifiers identify different parts of C++ programs. Identifiers should have meaningful names.  Guidelines followed while dealing with identifiers- Assign meaningful names for identifiers. That is Variable, Class and Methods. Do not use similar looking names e. g.,manage,manager. Always assign names to scalar constants (created with final keyword) as it helps in clarity & readability.

4  Ensure Clarity of Expressions: Expression in the program should be written clearly. Proper parenthesis may be used to enhance the clarity of the expression. Expressions carry out the specified actions. Avoid programming tricks whose intent will not be obvious to a reader. Never sacrifice clarity of expressions even if changed (but unclear) expressions may get you minor gain in machine execution time. Use standard methods in to enhance readability e.g.,use Math.sqrt () to calculate square root rather than writing your own logic for it.

5  Use Comments & Indentation  Comments play very important role as they provide internal documentation of a program. Indentation makes the statements clear & readable.  C++ comments are given either by //or /*....*/brackets 1.Always insert prologues, the comment in the beginning of a program. 2.Insert explanatory comments where ever applicable. 3.Use comments to help identify {…}pairs greatly & enhance program understanding. 4.Always indent statements to highlight nesting of groups of control statements.

6 => The insertion of blank lines & blank spaces: Blank lines can inserted before the declaration of blocks, comment lines, method’s prototype etc. It increases readability. Space must be given before and after an operator to make it more readability.. =>C++ provides free formatting styles: Program should be pretty typed i.e. All the statement must be written in separate lines. So that program may be readable and understandable. When program is formatting is done to make a program more readable, it is called pretty printing.

7  Characteristics of a Good program: A good Program not only efficiently solves the given problem but also it should be presentable. The following features are expected for its goodness-  Effective and efficient: The program produces correct results and is faster, taking into account the memory constraints  User Friendly: The program should be user friendly. The user should not be concerned about what is happening inside the program.  The user should be only responsible for providing the input data values and rest everything be the program’s responsibility.  The output provided by the program should also be easily understandable and presentable.

8  Self-Documenting Code: A good program must have self-documenting code. The source code that uses meaningful names for constants, variables and subprogram identifiers to clarity their meaning in the program is called Self-Documenting Code  Reliable: The program should be reliable i.e. it must be able to handle unexpected situation like wrong data or no data. The program should display proper error messages.  Portable: The program should be portable i.e. It should be able to run on different platforms.

9 STAGES OF PROGRAM DEVELOPMENT PROCESS: A program development problem is a step by step process where each stage contributes to building of an effective and efficient program. => There are four stages in program development process as given below: 1.Crack the problem: The problem is cracked and an algorithm is formulated which gives the solution for the problem. 2.Code the Algorithm: The algorithm should be translated into the program(source code)carefully to avoid errors that may crop up. 3.Compile the program: It is a process to convert the source code into the object code and reported errors should be rectified 4.Execute the program: At the run time,errors if any,should be removed & 3rd stage should be repeated to compile & finally execute the corrected version of the program.

10  ROBSTNESS The ability of a program, to recover following error & to continue operating within its environment, is Robustness.  GUARD CODE: The code that can handle exceptional data errors and operational errors is called Guard Code.

11 Types of errors in the program An error or ‘Bug’ is anything in the program code that prevents a program to run in correct manner.  compile-time errors: An Errors that occur during compiling-time,are known as compile- time errors.

12  Syntax Error: It is occurred when rules of the programming language are not followed. It is most common due to spelling errors in the Keywords and methods.  Semantic Error: It is occurred when a statement written is not meaningful. Ex. X + Y = Z  Logical Error: When Program does not give correct result due to mistake in the calculation or use of operators etc. These errors are most difficult to trace in a big sized program.  Run Time Error: This error occurred at Run-Time and it is due to incompatible Data Types used, divide by zero in the expression etc. which may cause the termination of program execution abnormally.

13  Run time errors are also called exceptions, and handling such errors in the application is called exception handling  Exception : Unexpected situation or unexpected error, during program execution is known as Exception.  Exception Handling: Way of handling anomalous situation in a program-run, is known as Exception Handling Advantages: 1. Exception Handling separates error-handling code from normal code. 2. It clarifies the code and enhances readability. 3. It makes for clear, robust, fault-tolerant programs

14 PROBLEM SOLVING METHADOLOGY AND TECHNIQUES The following steps are taken while designing a program- 1. Understanding the Problem 2. Analyzing the Problem 3. Designing the Program 4. Coding the Program 5. Testing & Debugging The Program 6. Documentation 7. Maintenance of the Program

15 1.Understand the problem: You must recognize the need of program. Try to explore ‘WHAT’ component in the problem 2.Analyse the problem :After determining the need, carefully analyze the problem to get an effective solution. Try to explore the inputs to get required output. 3. Design the program: In this step ‘HOW’ component is explored. Try to find out the best sequence of steps (Algorithm) to solve the problem. A big problem can be broken in to smaller portion to get effective solution. -The logical sequence of precise steps that solve a given problem, is called Algorithm.

16 4.Coding of Program: The translate your solution into Programming Language. While translating you need to identify the control structure, arithmetic and logical calculations to be used. An IDE (eg. NetBeans) can be used to code the Program. 5.Test & Debug the program: Once a Program has been coded, it can be executed and find out the errors (Syntactical & Logical), if any. The errors also termed as ‘bugs’. Testing is the process of finding errors in a program,and debugging is the process of correcting errors found during the testing process.

17 6.complete your documentation: Documentation helps to others to understand the program. Details of the program including its source code, Input/Output screen and its operating instructions are recorded and compiled in the form of booklet. 7.Maintenance of the Program Maintenance is required To modify the program, To remove the undetected errors or To enhance the program functionality To keep the program up-to-date with its environment.

18 =>DOCUMENTATION: Documentation refers to written descriptions,specifications, design, code and comment, internal and external to a program, which make a program more understandable, readable and more easily modifiable. MODULES OF DOCUMENTATION: Modules make information easily accessible to the specific user for which they were prepared and they reduce the costs of production and maintenance. The aggregation of modules and their details would depend upon

19 1. Complexity of the system 2. Technical sophisticated of user 3. People involved in development and use 4. Expected life of documentation =>A User Documentation (or Manual) Should provide the following information 1.General Description 2. Run flow & Description 3. Logic Flow

20 4. Program Testing 5. File Description 6. Record Layouts 7. Output Specification 8. File Disposal 9. Error Message 10. Special run instructions 11. Security consideration 12. Restart and Recovery Procedures

21 =>Programmer ‘s Documentation (Technical Documentation ) : It Provides the technical part of the documentation. It also provide to insure smooth, easy and right maintenance for the system. =>There are two type of Technical Documentation 1. External Documentation 2. Internal Documentation

22 => The Eternal Documentation of a program consists of a written information that is outside the body of the source code. that is History, modification design,User manual of a program. =>Internal Documentation: It includes comments, self Documentation code and program formatting. =>Uses of Documentation: 1. Facilitates communication about an application between the technical development personnel and the non-technical users

23 2. Useful for technical personnel not only during development, but also during operations and normal maintenance. 3. Essential during abnormal or urgent maintenance 4. Very helpful in initiating and training 5. Enable trouble shooting when the application system breaks down 6. Essential for internal and external control 7. Ensures that all commitments and expectation are on record

24 The documentation module (also called Manual) may be following types as per their contents.  User Manual: Describes how to use the program and contains all the I/O screens and operating instruction for its user.  Operation Manual: Describes the various steps to perform a specific task using the system.  Program Manual: It contains the Source code of the program for reference purpose. It is required during program Maintenance.  System Manual: It contains overall specification, results of all the program development stages etc.

25 Program Maintenance: Program maintenance refers to the modification of a program, in order to meet changing requirements or to take care of undetected errors. The following types of Maintenance may occur:  Corrective Maintenance: It is required to correct the errors which were undetected during the design of the program.  Adaptive Maintenance: Change in user’s need or program environment may occur and program must be changed to adapt such changes. This change in the program is called Adaptive Maintenance.

26  Preventive Maintenance: Sometimes you could anticipate the errors before they actually occur. Preventive Maintenance is carried out to avoid such errors.  Perfective Maintenance: To cope with changing world i.e. changes in the technology, you should tune your system to keep it up-to-date. Due to arrival of new technology and facilities, the program is updated to make it perfect in respect of new technological need.

27


Download ppt "CHAPTER:14 Programming Methodology Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND."

Similar presentations


Ads by Google