Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Introduction to

Computer Programming
Lesson 1
NEIL A. MUTIA, MIT
What is Computer Programming?

 Programming is giving a set of instructions to a computer to


execute a specific task.

 Programming is the process of taking an algorithm and encoding


it into a notation, a programming language, so that it can be
executed by a computer.

 Programming is the mental process of thinking up instructions to


give to a machine (like a computer).

 Programming is the process of giving machines a set of


instructions that describe how a program should be
carried out.
What is Computer Programming?
 Analogy of Computer Programming

If you’ve ever cooked using a recipe before, you can think


of yourself as the computer and the recipe’s author as the
program and the author as a programmer. The recipe author
provides you with a set of instructions which you read and then
follow. The more complex the instructions, the more complex the
result!
What is Computer Programming?

 Programming can be compared to any task that requires step by step


instruction to be followed. Just like cooking.
 Procedures when cooking the Adobo
Computer Programming Terminologies
 Computer Programmer -The person who created a computer program.
 Computer Program - The set of instructions given to the computer to be
executed. Also known as Algorithm.
 Codes - Each line of instruction inside the computer program
 Programming Language - is a vocabulary and set of grammatical rules for
instructing a computer or computing device to perform specific tasks.
 Example: Java, C++, C, Ruby, Python, etc.
 Compiler - a special program that processes statements written in a particular
programming language and turns them into machine language or "code" that a
computer's processor uses.
 Bugs – Computer Program Errors.
 Text Editor / Integrated Development Environment– Software application used
by programmers to write computer programs
Computer Programming Terminologies
 Debugging – finding the errors in the program
 Compiling – telling the computer to convert the codes to machine language.
 Run or Execute the program – telling the computer to perform what is the
intended task of the program
 Syntax - refers to the rules that define the structure of a language.
Computer Programming Products
 Calculator
 Smartphones
 Smart TV
 Point of Sale System
 Websites
 Phone Applications
 Automatic/High Tech Cars
 Computer Programs
 Computer boxes in vehicles/motorcycles
 Satellites
 And many more..
Computer Programming Sample Salary
The Java Virtual Machine
 Machine language consists of very simple instructions that can be executed
directly by the CPU of a computer.
 Almost all programs, though, are written in high-level programming languages
such as Java, Pascal, or C++.
 A program written in a high-level language cannot be run directly on any
computer.
The Java Virtual Machine
 It has to be translated into machine language. This translation can be done by a
program called a compiler.
 Once the translation is done, the machine-language program can be run any
number of times, but of course it can only be run on one type of computer.
 If the program is to run on another type of computer it has to be re-translated,
using a different compiler, into the appropriate machine language.
The Java Virtual Machine
 There is an alternative to compiling a high-level language program. Instead of
using a compiler, which translates the program all at once, you can use an
interpreter, which translates it instruction-by-instruction, as necessary.
 The designers of Java chose to use a combination of compilation and
interpretation.
 Programs written in Java are compiled into machine language, but it is a
machine language for a computer that doesn’t really exist. This so-called
“virtual” computer is known as the Java virtual machine.
 The machine language for the Java virtual machine is called Java bytecode.
The Java Virtual Machine
Fundamental Building Blocks of Programs
 There are two basic aspects of programming: data and
instructions.
 To work with data, you need to understand variables and types.
 A variable is just a memory location (or several locations treated as a unit)
that has been given a name so that it can be easily referred to and used in a
program.
 a variable has a type that indicates what sort of data it can hold.
Examples of variable types
Integers – hold whole numbers (positive and negative numbers) ( -2, -1, 0, 1,
2)
Double - holds a real or decimal based number. (-2, 5, 2.5, 0.33)
Character – holds only one character ( A, c, Z, -, ! )
String – holds multiple characters. ( words or phrase or sentences )
Fundamental Building Blocks of Programs
 To work with instructions, you need to understand control
structures and subroutines
 Control structures are special instructions that can change the
flow of control.
 There are two basic types of control structure:
 Loops, which allow a sequence of instructions to be repeated over and
over, and
 Branches (Conditions), which allow the computer to decide between two
or more different courses of action by testing conditions that occur as the
program is running.
Program Example
Beginners for Programming Must Learn
the following:
 Flowcharts - A flowchart is a diagrammatic representation of an algorithm.
A flowchart can be helpful for both writing programs and explaining the program to
others.
Beginners for Programming Must Learn
the following:
 Pseudocode - In computer field, pseudocode is a plain language description of the
steps in an algorithm or another system
 Pseudocode example:
 Start
 Input numbers for variable a & b
 Get the sum of a & b
 Print the sum
 End
Beginners for Programming Must Learn
the following:
 Entry Level Programs – a simple programs that execute simple process.
Things needed to perform programming
 The Java Virtual Environment – enables the java program to run/execute on a
computer. JDK installer is needed and must be installed in a computer

 Text Editor – enables the programmer to types the codes.


Assignment 1
 Create an essay about what you understand from this discussion.
You can discuss each of the topics presented as long as it is from
your own words. Discussion must be at least 300 words. Send it in
our Google Classroom. Please observe correct spellings and
grammars. Thank you.

You might also like