Module 1: Introduction to Computer Programming PDF

Document Details

Uploaded by Deleted User

Isabela State University

Roman Alex F. Lustro

Tags

computer programming programming languages system development introduction to computer

Summary

This document is a module on introduction to computer programming. It details concepts like computer programming, programming languages, and the phases of system development. It also covers different programming languages like BASIC, C, and Python.

Full Transcript

Module 1: Introduction to Computer Programming 1 MODULE 1: INTRODUCTION TO COMPUTER PROGRAMMING LEARNING OUTCOMES ▪ Understand the concept of computer programming. ▪ Compare Compiler vs Interpreter....

Module 1: Introduction to Computer Programming 1 MODULE 1: INTRODUCTION TO COMPUTER PROGRAMMING LEARNING OUTCOMES ▪ Understand the concept of computer programming. ▪ Compare Compiler vs Interpreter. ▪ Compare Machine language vs Assembly language vs High – level language. ▪ Enumerate the different programming language. ▪ Understand the phases of system development life cycle. Computer Program A program is a set of instructions following the rules of the chosen language. Without programs, computers are useless. A program is like a recipe. It contains a list of ingredients (called variables) and a list of directions (called statements) that tell the computer what to do with the variables. Programming Language A vocabulary and set of grammatical rules (syntax) for instructing a computer to perform specific tasks. Programming languages can be used to create computer programs. The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada, Pascal, and Python. You eventually need to convert your program into machine language so that the computer can understand it. There are two ways to do this: – Compile the program – Interpret the program Compile is to transform a program written in a high-level programming language from source code into object code. This can be done by using a tool called compiler. A compiler reads the whole source code and translates it into a complete machine code program to perform the required tasks which is output as a new file. Interpreter is a program that executes instructions written in a high-level language. An interpreter reads the source code one instruction or line at a time, converts this line into machine code and executes it. Computer Programming Computer programming is the process of writing, testing, debugging/troubleshooting, and maintaining the source code of computer programs. This source code is written in a programming language like C++, JAVA, Perl etc. A programmer is someone who writes computer program. Computer programmers write, test, and maintain programs or software that tell the computer what to do. What Skills are Required to Become a Programmer? Programming - Writing computer programs for various purposes. INFORMATION AND COMMUNICATION TECHNOLOGY DEPARTMENT Isabela State University – City of Ilagan Campus ROMAN ALEX F. LUSTRO, LPT, DIT [email protected] Module 1: Introduction to Computer Programming 2 Writing - Communicating effectively with others in writing as indicated by the needs of the audience. Reading Comprehension - Understanding written sentences and paragraphs in work-related documents. Critical Thinking - Using logic and analysis to identify the strengths and weaknesses of different approaches. Computers and Electronics - Knowledge of electric circuit boards, processors, chips, and computer hardware and software, including applications and programming. Mathematics - Knowledge of numbers, their operations, and interrelationships including arithmetic, algebra, geometry, calculus, statistics, and their applications. Oral Expression - The ability to communicate information and ideas in speaking so others will understand. Oral Comprehension - The ability to listen to and understand information and ideas presented through spoken words and sentences. Written Expression - The ability to communicate information and ideas in writing so others will understand. Written Comprehension - The ability to read and understand information and ideas presented in writing. Deductive Reasoning - The ability to apply general rules to specific problems to come up with logical answers. It involves deciding if an answer makes sense. Information Organization - Finding ways to structure or classify multiple pieces of information. Generations of Programming Language The first-generation languages, or 1GL, are low-level languages that are machine language. The second-generation languages, or 2GL, are also low-level languages that generally consist of assembly languages. The third-generation languages, or 3GL, are high-level languages such as C. The fourth-generation languages, or 4GL, are languages that consist of statements similar to statements in a human language. Fourth generation languages are commonly used in database programming and scripts. The fifth-generation languages, or 5GL, are programming languages that contain visual tools to help develop a program. A good example of a fifth-generation language is Visual Basic. Types of Programming Language There are three types of programming language: – Machine language (Low-level language) – Assembly language (Low-level language) – High-level language Low-level languages are closer to the language used by a computer, while high-level languages are closer to human languages. Machine Language Machine language is a collection of binary digits or bits that the computer reads and interprets. Machine languages are the only languages understood by computers. While easily understood by computers, machine languages are almost impossible for humans to use because they consist entirely of numbers. Example: INFORMATION AND COMMUNICATION TECHNOLOGY DEPARTMENT Isabela State University – City of Ilagan Campus ROMAN ALEX F. LUSTRO, LPT, DIT [email protected] Module 1: Introduction to Computer Programming 3 Let us say that an electric toothbrush has a processor and main memory. The processor can rotate the bristles left and right, and can check the on/off switch. The machine instructions are one byte long, and correspond to the following machine operations: Assembly Language A program written in assembly language consists of a series of instructions mnemonics that correspond to a stream of executable instructions, when translated by an assembler, that can be loaded into memory and executed. Assembly languages use keywords and symbols, much like English, to form a programming language but at the same time introduce a new problem. The problem is that the computer doesn't understand the assembly code, so we need a way to convert it to machine code, which the computer does understand. Assembly language programs are translated into machine language by a program called an assembler. Example: – Machine language : 10110000 01100001 – Assembly language : mov a1, #061h – Meaning: Move the hexadecimal value 61 (97 decimal) into the processor register named "a1". High Level Language High-level languages allow us to write computer code using instructions resembling everyday spoken language (for example: print, if, while) which are then translated into machine language to be executed. Programs written in a high-level language need to be translated into machine language before they can be executed. Some programming languages use a compiler to perform this translation and others use an interpreter. Examples of High-level Language: INFORMATION AND COMMUNICATION TECHNOLOGY DEPARTMENT Isabela State University – City of Ilagan Campus ROMAN ALEX F. LUSTRO, LPT, DIT [email protected] Module 1: Introduction to Computer Programming 4 ADA BASIC C COBOL C++ PASCAL JAVA PYTHON Comparison Examples of Programming Languages BASIC Short for Beginner's All-purpose Symbolic Instruction Code. Developed in the 1950s for teaching University students to program and provided with every self-respecting personal computer in the 1980s, BASIC has been the first programming language for many programmers. It is also the foundation for Visual Basic. Example: PRINT "Hello world!" Visual Basic A programming language and environment developed by Microsoft. Based on the BASIC language, Visual Basic was one of the first products to provide a graphical programming environment and a paint metaphor for developing user interfaces. Example: MsgBox "Hello, World!“ INFORMATION AND COMMUNICATION TECHNOLOGY DEPARTMENT Isabela State University – City of Ilagan Campus ROMAN ALEX F. LUSTRO, LPT, DIT [email protected] Module 1: Introduction to Computer Programming 5 C Developed by Dennis Ritchie at Bell Labs in the mid 1970s. C is much closer to assembly language than are most other high-level languages. The first major program written in C was the UNIX operating system. The low-level nature of C, however, can make the language difficult to use for some types of applications. Example: #include int main(void) { printf("hello, world\n"); return 0; } C++ A high-level programming language developed by Bjarne Stroustrup at Bell Labs. C++ adds object-oriented features to its predecessor, C. C++ is one of the most popular programming language for graphical applications, such as those that run in Windows and Macintosh environments. Example: #include int main() { std::cout

Use Quizgecko on...
Browser
Browser