170 likes | 379 Views
PROGRAMMING METHODOLOGY. STYLISTIC GUI DELINES Meaningful Names for Identifiers . Guidelines followed while dealing with identifiers. 1. Assign meaningful names for all identifiers viz. Variables, function and procedures, etc. 2. Do not use similar looking names e.g., manage, manager.
E N D
PROGRAMMING METHODOLOGY STYLISTIC GUI DELINES Meaningful Names for Identifiers. Guidelines followed while dealing with identifiers. 1. Assign meaningful names for all identifiers viz. Variables, function and procedures, etc. 2. Do not use similar looking names e.g., manage, manager. 3. Always assign names to scalar constants when it helps in clarity and readability
Ensure clarity of expressions Guidelines followed while dealing with clarity of expressions. 1. Avoid programming tricks whose intent will not be obvious to a reader. 2. Never sacrifice clarity of expressions even if changed (but unclear) expressions may get you minor gain in machine execution time. 3. Use standard functions in expressions to enhance readability
Use comments and Indentation 1. Always insert prologues: - the comment in the beginning of a program. 2. Insert explanatory comments whenever applicable since they explain the role and purpose of other identifiers and statements. 3. Use comments to help identify {...} pairs greatly and enhance program understanding 4. Always indent statements to highlight nesting of groups of control statements. Insert Blank Lines and Blank Spaces-The blank lines are inserted to separate declaration blocks, comment boxes, procedures and functions etc. Normally, blank lines are inserted to separate declaration block, comment boxes, procedures and function etc. Normally, blank lines are inserted before label, const, type, ver. declarations.
Statement formatting style- c++ is one of those languages which provides use of free formating style program to print odd number from 100 to1 with statement in free formatting style #include<iostream.h> int main() {for (int i=99;i>0;i--) if(i%2) cout<<i<<' '; return 0 ; } Defination -- when programming formatting is done to make a program more redable,it is called prettyprinting. Program to print odd no from 100 to 1 #include<iostream.h> int main() { for(inti=99;i>0;i--) cout<<i<<' '; return 0 ; }
characteristics of a good program 1) Effective and efficient- the program produces correct result and it is faster 2) User friendly– the program should be user friendly the user should not concerned about what is happening inside program 3) Self documenting code– a good programmer self – documenting code 4) Reliable-- the program should reliable i.e., it must be handle unexpected situation like wrong data or no data the programmer should display proper error message 5) Portable– the program should be portable i.e, it should be run on different platform
Stages of program development process 1) Crack the problem– in the first stage the program is cracked and an algorithm is formulated which gives the solution for the problem 2) code the algorithm– in this stage the program is translated into program using some programming language 3) Compile the program– after feeding the program next stage is to compile it 4) Execute the program – after compilation f an error free program , the program is executed ROBUSTNESS – The ability of a program, to recover following an error and to continue operating within its environment , is called robustness. The code which can handle exception data error and operational error is called guard code.
TYPE OF ERRORS Compile-time errors Syntax erroroccur when rules of a programminglanguage are misused i.e., when a grammatical rule of C++ is violated. Syntax refers to formal rules governing the construction of valid statements in a language. Semantics erroroccurs when statements are not meaningful. Semantics refers to the set of rules which give the meaning of a statement. Run-Time errors Errors that occur during the execution of a program are run-time errors. Logical Errors Something, even if you don’t encounter any error during compile-time and run-time, your program does not provide the correct result. This is because of the programmer’s mistaken analysis of the problem he or she is trying to solve. Such errors are logical errors.
DOCUMENTATION Documentation refers to written descriptions, specification, design, code and comment, internal 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 documentation modules are generally to as manuals. The aggregation of modules and their detail would depend upon: Complexity of system Technical sophistication of user People involved in development and use Expected life of documentation
USER DOCUMENTATION There are many types of user: the manager who supervises the operation of a computer application or receives its printed reports; the manager or end user who may directly use an application through a computer terminal; a clerk who prepares input for a computer and may even use its output. A user documentation (or manual) should provide the following information General descriptions Output specifications Run flow and description File disposal Logic flow Error messages Program testing's Special run instructions File descriptions (if any) Security considerations Record layouts Restart and Recovery procedures
General Description Run flow The program will prompt the user for inputting three numbers by flashing following message: Enter three numbers The user is supposed to enter three numbers in front of the message: Output Specifications The program gives the biggest of the three numbers by flashing the following message: The biggest of the three numbers is 9
Error Messages The program may display following errors shown in two categories: Category 1 Syntax errors Unknown identifier “;” Expected Mixed-up ifs and else's Category 2 Run-time errors Incompatible values Special Run Instructions To run this program, (1)Change to directory BC by typing following command: C > CD BC (2) Type the following command to open the program C > BC Max (3) Press ctrl + F9 to run the program.
Security Conditions Please do not work on the program on Sundays and other holidays. Restart and Recovery Procedure If an error of category 1 is flashing, please contact your programmer. If error of category 2 is displayed then restart the program and type numeric values between range 1.0E-38 to 1.0E+38.
Programmer’s Documentation (technical documentation) The technical documentation must always be provided so as to ensure smooth, easy and right maintenance for the systems. The technical documentation is of two types: External documentation Internal documentation The external documentationof a program consists of the written information that is outside the body of the source code. In addition to the detailed specifications the external documentation may include the history of the program’s development and subsequent modification, the top-down design,” diagram of the program’s structures, and user’s manuals. The internal documentationincludes comments, self documenting code and program formatting (prettyprinting). The goal of all these features is to make the program readable, understandable, and easily modifiable. Self documentingcode is the source code that uses meaningful names for constants, variables, and subprogram identifier to clarify their meaning in the program. Prettyprinting refers to program formatting to make a program more readable.
Uses of Documentation Facilitates communication about an application between the technical development personal and non-technical users. Useful for technical personnel not only during development, but also during operation and normal maintenance. Essential during abnormal or urgent maintenance. Very helpful in initiating and training. Enables trouble shooting when the application system break down. Helps corporate management understand the system sufficiently to make decisions and to appreciate its financial and resource implications. Essential for both internal and external control. Ensures that all commitments and expectations are on record. Provides a package that will contain the information needed to change the system in case environment or management’s needs alter. Prevents system dislocation and cost that might otherwise occur if knowledge of the system were centered in a few individuals who resigned, relocated, or were subsequently reassigned other duties.
PROGRAM MAINTENANCE Program maintenance refers to the modification of a program, after it has been completed, in order to meet changing requirement or to take care of error that show up. There could be four kinds of maintenance: Corrective Maintenance. When a program after completion, is put to operations, some error might show up because of some unexpected situation, untested areas. Such error are fixed up and this type of maintenance, which is done to correct the errors Adaptive Maintenance. Changes in the environment in which an information system operates may also lead to systems maintenance. Preventive Maintenance. If possible error could be anticipated before they actually occur, the maintenance could be done to avoid them and the system down time can be saved. Perfective Maintenance. In this rapidly changing world, information technology is the fastest growing area. In information technology world, no technology has proved permanent.