SG M1.pdf
Document Details
Tags
Full Transcript
STUDY GUIDE WHAT IS PROGRAMMING? Programming is a multistep process for creating a program. It is a way of giving computers instructions about what they should do next. These instructions are known as code. WHY PROGRAMMING? Programming is impor...
STUDY GUIDE WHAT IS PROGRAMMING? Programming is a multistep process for creating a program. It is a way of giving computers instructions about what they should do next. These instructions are known as code. WHY PROGRAMMING? Programming is important for learning to innovate, create eco-friendly solutions for global problems. Programming is important for speeding up the input and output processes in a machine. Programming is important to automate, collect, manage, calculate, analyze the processing of data and information accurately. COMPUTER PROGRAMMING TERMS COMPUTER PROGRAM A computer program is a list or sequence of instructions that tell a computer what to do. Everything a computer does is done by using a computer program. A computer program is written in a programming language. PROGRAMMING LANGUAGE A programming language (PL) is a type of written language that tells computers what to do in order to work. Programming languages are used to make all the computer programs or software. Each PL has its own grammar called syntax. It consists of rules governing the structure and content of the statement that should be followed. A programmer writes source code using a programming language to create programs. SOURCE CODE Source code is a well-written set of instructions and statements to develop a program. Source code can be written in low-level or high-level language. Source code must be translated to machine language (binary form) using a language translator. LANGUAGE TRANSLATORS Assembler translates a program written from an assembly language to a low-level language. Interpreter translates each statement or one line at a time and executed immediately after translation. Example: JavaScript, Python, Ruby Compiler translates all statements at one time. It provides all the error messages – called diagnostics- at once. Example: C, C++, Java LOW-LEVEL vs HIGH-LEVEL LANGUAGE Low-level Language uses instructions tied directly to one type of computer. often cryptic and not human-readable. Examples: machine language, assembly language MACHINE LANGUAGE Within a computer, all data is represented by microscopic electronic switches that can be either OFF or ON. OFF switch is designated by a 0. ON switch is designated by a 1. Example: 0100 0001 = capital ‘A’ ASSEMBLY LANGUAGE A programming language with symbolic names for opcodes, and decimals or labels for memory addresses Example: ADD 1, 2 MUL 2, 3 PROGRAMMING PARADIGM A programming paradigm is a style, or “way,” of programming to solve problem using some programming language. It is an approach or method to solve a problem using tools and techniques that are available to us following some approach. It is also a way to classify programming languages based on their features. PROCEDURE-ORIENTED PROGRAM Procedure-oriented program, the programmer concentrates on the major tasks that the program needs to perform. The programmer must instruct the computer every step of the way, from the start of the task to its completion. Example: In a payroll program, the program typically performs several tasks, such as inputting the employee data, calculating the gross pay, taxes, net pay, and outputting a paycheck. OBJECT-ORIENTED PROGRAM Object-oriented program requires the programmer to focus on the objects that the program can use to accomplish its goal. The objects can take on many different forms. Example: In Windows-based program, it typically use objects such as check boxes, list boxes, and buttons. PROGRAM DEVELOPMENT LIFE CYCLE When we want to develop a program using any programming language, we follow a sequence of steps. These steps are called phases in program development. The program development life cycle is a set of steps or phases that are used to develop a program in any programming language. STEPS IN PROGRAM DEVELOPMENT 1. Requirement Analysis 2. System Design 3. Coding or Writing The Program 4. Testing and Debugging 5. Documentation and Maintenance 1. REQUIREMENT ANALYSIS Requirement is a description of what a system should do. It involves the collection of information and the definition of the characteristics or features of the desired system. Problem Analysis requires performing the following steps: Define the problem and the users. Determine the desired outputs. Determine the input to achieve the desired outputs. Determine the processes involve. Check the feasibility of implementing the program. Document the analysis. 2. SYSTEM DESIGN The program design process describes the algorithm for the solution of the problem. An algorithm is the step-by-step sequence of instructions that describe how data will be processed to produce the desired output. To formulate the algorithm, a programmer may choose between pseudocodes or flowcharts. Pseudocode is an algorithm written in normal Human language statements to describe the logic and processing flow. Flowchart is a visual representation of the sequence of steps and decisions needed to perform a process. Each step in the sequence is noted within a diagram shape. Steps are linked by connecting lines and directional arrows. 3. CODING The actual writing of the program based on the design specifications (coding). Construction requires performing the following steps: Select the appropriate programming language. Follow the syntax. 4. TESTING AND DEBUGGING Program testing involves running various tests, such as desk checking and debugging – called alpha testing, and then running actual or real data to make sure the program works. Testing and debugging requires the following steps: 1. Perform desk-checking 2. Debug the program 3. Run real data Beta Testing is performed by real users of the software application in a real environment. TESTING AND DEBUGGING 1. Desk checking is manually testing the solution design to make sure that it is free of errors and that the logic works. 2. Debugging means detecting, locating, and removing all errors in a computer program. Types of Errors Syntax Error is the most common error and incorrect use of programming language statements. Run-time Error is a software error that occurs while a program is being executed. Logical Error is a mistake in a program's source code that results in incorrect or unexpected behavior. 3. Run real data 5. DOCUMENTATION & MAINTENANCE When the program is finalized, its documentation is prepared. Documentation is a written detailed description of the programming cycle and specific facts about the program. Also, it includes necessary instructions on the use and maintenance of the program/software (product). Maintenance is any activity designed to keep programs error-free, up-to-date and in good working condition.