programming guidelines. sylistic guidelines meaningful names for identifiers identifiers identify...

of 22 /22

Author: adam-smith

Post on 17-Jan-2016




0 download

Embed Size (px)



  • SYLISTIC GUIDELINESMeaningful names for identifiersIdentifiers identify different parts of C++ programs.Identifiers should have meaningful names.Guidelines followed while dealing with identifiers-Assign meaningful names for identifiers.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.

  • Ensure Clarity of ExpressionsExpressions 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.

  • Use Comments & IndentationComments play very important role as they provide internal documentation of a program. Indentation makes the statements clear & readable.JAVA comments are given either by //or /*....*/brackets1.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.

  • The insertion of blank lines & blank spaces at appropriate spaces enhance the program readability.C++ provides free formatting styles.When program is formatting is done to make a program more readable, it is called prettyprinting.

  • Characteristics of a Good programEffective 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 programs responsibility.The output provided by the program should also be easily understandable and presentable.

  • 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 CodeReliable: 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.

  • STAGES OF PROGRAM DEVELOPMENT PROCESS1.Crack the problem2.Code the Algorithm3.Compile the program4.Execute the programIt is desirable to prune the possible errors in every stage of the program ,not at the run time only.

  • At 1st stage ,algorithms efficiency &correctness should be checked.At 2nd stage ,the algorithm should be translated into the program very carefully to avoid errors that may crop up.At 3rd stage the reported errors should be rectified.At the run time ,errors if any ,should be removed & 3rd & 4rth stage should e repeated to compile & execute the corrected version of the program.ROBSTNESSThe ability of a program, to recover following error & to continue operating within its environment, is Robustness.

  • The code that can handle exceptional data errors and operational errors is called Guard Code.TYPE OF ERRORSCompile time errorsErrors that occur during compiling-time ,are compile-time errors.

  • Syntax errorsSyntax refers to formal rules governing the construction of valid statements in a language.Semantics ErrorsSemantic errors occur when statements are not meaningful.Semantic refers to set of rules which give the meaningful of a statement. Run-time Errors Errors that occur during the execution of a program are run time errors. These are harder to detect errors .

  • Some run time errors stop the execution of the program , which is then called program crashed ,or abnormally terminated.Logical ErrorsLogical errors occur due to mistaken analysis of the program.

  • PROBLEM SOLVING METHADOLOGY AND TECHNIQUESThe steps to creating a working program are :1.Understand the problem well-under this we have to understand the problem well so as to figure out what is required or desired out of the purpose solution ?and hence to ascertain what it is that it is to be done.2.Analyse the problem : - identify minimum number of inputs required for output. - identify processing components

  • 3.Design the program by -deciding step by step solution, & breaking down solution into simple steps.The logical sequence of precise steps that solve a given problem , is called Algorithm .4.code of program by -identifying arithmetic & logical operations required for solution -using appropriate control structures such as conditional or looping control structure

  • Test and debug your program-rectifying the errors- Testing is the process of finding errors in a program ,and debugging is the process of correcting errors found during the testing process.6.complete your documentation: Documentation is extra information made available to enhance understandability and usability of the program.7.mantain your program: It involves modifying the programs to remove previously undetected errors , to enhance the program with different features or functionality ,or to keep the program up -to date as government regulations or company policies changed.

  • DOCUMENTATIONDocumentation 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 DOCUMENTATIONModules 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

  • 1. Complexity of the system2. Technical sophisticated of user3. People involved in development and use4. Expected life of documentationA User Documentation (or Manual) Should provide the following informationGeneral Description 2. Run flow & Description3. Logic Flow

  • 4. Program Testing5. File Description 6. Record Layouts7. Output Specification8. File Disposal9. Error Message10. Special run instructions11. Security consideration12. Restart and Recovery Procedures

  • 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

  • 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

  • 2. Useful for technical personnel not only during development, but also during operations and normal maintenance.3. Essential during abnormal or urgent maintenance4. Very helpful in initiating and training5. Enable trouble shooting when the application system breaks down6. Essential for internal and external control7. Ensures that all commitments and expectation are on record

  • PROGRAM MAINTENANCEi) Corrective maintenanceii) Adaptive maintenanceiii) Preventive maintenanceiv) Perfective maintenance.