Programming Methodologies Tutorial PDF Version Quick Guide Resources Job Search Discussion When programs are developed to solve real-life problems like inventory management, payroll processing, student admissions, examination result processing, etc., they tend to be huge and complex. Programming Methodology is the approach to analyzing such complex problems by planning the software development and controlling the development process. In this tutorial, we will cover the top-down approach to programming, also called modular programming. We will also learn about requirement gathering, problem definition and identifying unique solution to the given problems. In addition, we will throw light on the best practices for code optimization. Audience This tutorial is designed for anyone who wants to learn about programming methodologies and how to use them to design solutions to a given problem. Prerequisites There are no prerequisites for this tutorial except a desire to learn how to write good programs. However, it would definitely help if the readers have some prior experience in writing codes in any programming language. Print Page Previous Next Advertisements ”;
Category: programming Methodologies
Understanding the Problem
Understanding the Problem ”; Previous Next A typical software development process follows these steps − Requirement gathering Problem definition System design Implementation Testing Documentation Training and support Maintenance The first two steps assist the team in understanding the problem, the most crucial first step towards getting a solution. Person responsible for gathering requirement, defining the problem and designing the system is called system analyst. Requirement Gathering Usually, clients or users are not able to clearly define their problems or requirements. They have a vague idea of what they want. So system developers need to gather client requirements to understand the problem that needs to be resolved, or what needs to be delivered. Detailed understanding of the problem is possible only by first understanding the business area for which the solution is being developed. Some key questions that help in understanding a business include − What is being done? How is it being done? What is the frequency of a task? What is the volume of decisions or transactions? What are the problems being encountered? Some techniques that help in gathering this information are − Interviews Questionnaires Studying existing system documents Analyzing business data System analysts needs to create clear and concise but thorough requirements document in order to identify SMART – specific, measurable, agreed upon, realistic and time-based – requirements. A failure to do so results in − Incomplete problem definition Incorrect program goals Re-work to deliver required outcome to client Increased costs Delayed delivery Due to the depth of information required, requirement gathering is also known as detailed investigation. Problem Definition After gathering requirements and analyzing them, problem statement must be stated clearly. Problem definition should unambiguously state what problem or problems need to be solved. Having a clear problem statement is necessary to − Define project scope Keep the team focused Keep the project on track Validate that desired outcome was achieved at the end of project Print Page Previous Next Advertisements ”;
Debugging
Programming Methodologies – Debugging ”; Previous Next Identifying and removing errors from a program or software is called debugging. Debugging is ideally part of testing process but in reality it is done at every step of programming. Coders should debug the smallest of their modules before moving on. This decreases the number of errors thrown up during the testing phase and reduces testing time and effort significantly. Let us look at the types of errors that can crop up in a program. Syntax Errors Syntax errors are the grammatical errors in a program. Every language has its own set of rules, like creating identifiers, writing expressions, etc. for writing programs. When these rules are violated, the errors are called syntax errors. Many modern integrated development environments can identify the syntax errors as you type your program. Else, it will be shown when you compile the program. Let us take an example − In this program, the variable prod has not been declared, which is thrown up by the compiler. Semantic Errors Semantic errors are also called logical errors. The statement has no syntax errors, so it will compile and run correctly. However, it will not give the desired output as the logic is not correct. Let us take an example. Look at line 13. Here programmer wants to check if the divisor is 0, to avoid division by 0. However, instead of using the comparing operator ==, assignment operator = has been used. Now every time the “if expression” will evaluate to true and program will give output as “You cannot divide by 0”. Definitely not what was intended!! Logical errors cannot be detected by any program; they have to be identified by the programmer herself when the desired output is not achieved. Runtime Errors Runtime errors are errors that occur while executing the program. This implies that the program has no syntax errors. Some of the most common run time errors your program may encounter are − Infinite loop Division by ”0” Wrong value entered by user (say, string instead of integer) Code Optimization Any method by which code is modified to improve its quality and efficiency is called code optimization. Code quality determines life span of code. If the code can be used and maintained for a long period of time, carried over from product to product, its quality is deemed to be high and it has a longer life. On the contrary, if a piece of code can be used and maintained only for short durations, say till a version is valid, it is deemed to be of low quality and has a short life. Reliability and speed of a code determines code efficiency. Code efficiency is an important factor in ensuring high performance of a software. There are two approaches to code optimization − Intuition based optimization (IBO) − Here the programmer tries to optimize the program based on her own skill and experience. This might work for small programs but fails miserably as complexity of the program grows. Evidence based optimization (EBO) − Here automated tools are used to find out performance bottlenecks and then relevant portions optimize accordingly. Every programming language has its own set of code optimization tools. For example, PMD, FindBug and Clover are used to optimize Java code. Code is optimized for execution time and memory consumption because time is scarce and memory expensive. There has to be a balance between the two. If time optimization increases load on memory or memory optimization makes the code slower, purpose of optimization will be lost. Execution Time Optimization Optimizing code for execution time is necessary to provide fast service to the users. Here are some tips for execution time optimization − Use commands that have built-in execution time optimization Use switch instead of if condition Minimize function calls within loop structures Optimize the data structures used in the program Memory Optimization As you know, data and instructions consume memory. When we say data, it also refers to interim data that is the result of expressions. We also need to keep a track of how many instructions are making up the program or the module we are trying to optimize. Here are some tips for memory optimization − Use commands that have built-in memory optimization Keep the use of variables that need to be stored in registers minimum Avoid declaring global variables inside loops that are executed many times Avoid using CPU intensive functions like sqrt() Print Page Previous Next Advertisements ”;
Program Documentation
Program Documentation ”; Previous Next Any written text, illustrations or video that describe a software or program to its users is called program or software document. User can be anyone from a programmer, system analyst and administrator to end user. At various stages of development multiple documents may be created for different users. In fact, software documentation is a critical process in the overall software development process. In modular programming documentation becomes even more important because different modules of the software are developed by different teams. If anyone other than the development team wants to or needs to understand a module, good and detailed documentation will make the task easier. These are some guidelines for creating the documents − Documentation should be from the point of view of the reader Document should be unambiguous There should be no repetition Industry standards should be used Documents should always be updated Any outdated document should be phased out after due recording of the phase out Advantages of Documentation These are some of the advantages of providing program documentation − Keeps track of all parts of a software or program Maintenance is easier Programmers other than the developer can understand all aspects of software Improves overall quality of the software Assists in user training Ensures knowledge de-centralization, cutting costs and effort if people leave the system abruptly Example Documents A software can have many types of documents associated with it. Some of the important ones include − User manual − It describes instructions and procedures for end users to use the different features of the software. Operational manual − It lists and describes all the operations being carried out and their inter-dependencies. Design Document − It gives an overview of the software and describes design elements in detail. It documents details like data flow diagrams, entity relationship diagrams, etc. Requirements Document − It has a list of all the requirements of the system as well as an analysis of viability of the requirements. It can have user cases, reallife scenarios, etc. Technical Documentation − It is a documentation of actual programming components like algorithms, flowcharts, program codes, functional modules, etc. Testing Document − It records test plan, test cases, validation plan, verification plan, test results, etc. Testing is one phase of software development that needs intensive documentation. List of Known Bugs − Every software has bugs or errors that cannot be removed because either they were discovered very late or are harmless or will take more effort and time than necessary to rectify. These bugs are listed with program documentation so that they may be removed at a later date. Also they help the users, implementers and maintenance people if the bug is activated. Print Page Previous Next Advertisements ”;