You are on page 1of 60

What is coMputer program?

Some examples of computer programs:


• Operating system.
• A web browser like Mozilla Firefox and 
Apple Safari can be used to view web pageson the 
Internet.  
• Video games are computer programs
1.OPERATING SYSTEM (OS)
– An operating system (or OS) is a group of 
computer programs, device drivers, kernels, and
other software that let people interact with a 
computer. It manages computer hardware and
software resources. It provides common services
for computer programs. An OS can be small (like 
MenuetOS), or large (like Microsoft Windows).
Different operating systems can be used for
different purposes. Some are used for everyday
things like on a personal computer. Others are 
mobile operating systems or are used for
specialized work.
Ex.
2.Web Browser.
-A web browser is a computer programapplication
for reading pages of the World Wide Web. Since the
late 1990s, most personal computers and mobile
phones and other mobile devices have a browser.
Ex.
3. Video Games
- Video games are electronic games played on a
video screen (normally a television, a built-in
screen when played on a handheld machine, or a
computer.
Ex.
Hardware and software
interaction: code, machine code
What is software

• Computer software, or simply software, is a collection of data


 or computer instructions that tell the computer how to work.

• Types of Software
• System Software
-is to control and manage the operations of a computer
hardware
-It is general purpose software
-is software designed to provide a platform for other software
Types of system software

• Operating System-
-Microsoft Window
- iOS

• Utility Programs- a program for carrying out a


routine function.
-Antivirus
-file manager
Application software
-is used to perform various application on the computer
-people use application software according to their
needs

• Commonly used Application software are as follow


Word processor like Ms.Word
Spreadsheet like M.S Exel
Database software like oracle data base and M.S
Access
Hardware
-Computer Hardware is the collection of all the parts you can
physically touch

• Hardware can be further

Classified as:
• Input device
-Keyboard and mouse
• Processing device
-Cpu or the central processing unit
• Output device
-Monitor and Printer
• And we have a internal and external Hardware
• Some example of Internal hardware is
-Ram(Ran Access Memory)
-Hardrive
-CPU
• External Hardware
-speaker
-printer
-mouse
Understanding How Hardware and Software Interact

• Inputting is the process of using an input


device to enter a data

Example Input H.W – (keyboard) –process data


S.w-Ms.word- output H.w(printer)

Scanner-photoshop- monitor
What is code

• -a system of words, letters, figures, or other


symbols substituted for other words, letters,
etc.
• -program instructions
Machine code

• a computer programming language consisting


of binary or hexadecimal instructions which a
computer can respond to directly.
• A computer program is a list 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.

What is PROGRAMING LANGUAGE?


-Programming language- is a language which the
computer understands. It is just like any other language
with its own syntax and constructs. The programmer uses
it to make the computer follow his/her instructions.
• EXAMPLE OF PROGRAMMING LANGUAGE?
- C AND C++, JAVA, JAVA SCRIPT, PHYTON, RUBY
etc.
Compiler and Interpreter
Compiler
• The language processor that reads the
complete source program written in
high level language as a whole in one
go and translates it into an equivalent
program in machine language is called
as a Compiler.
Example: C, C++, C#, Java
Interpreter
• The translation of single statement of source program into
machine code is done by language processor and executes
it immediately before moving on to the next line is called
an interpreter. If there is an error in the statement, the
interpreter terminates its translating process at that
statement and displays an error message. The interpreter
moves on to the next line for execution only after removal
of the error. An Interpreter directly executes instructions
written in a programming or scripting language without
previously converting them to an object code or machine
code.
Example: Perl, Python and Matlab.
Differences:
• A compiler is a program which coverts the
entire source code of a programming
language into executable machine code for a
CPU.

• Interpreter takes a source program and runs


it line by line, translating each line as it
comes to it.
• Compiler takes large amount of time to
analyze the entire source code but the
overall execution time of the program is
comparatively faster.

• Interpreter takes less amount of time to


analyze the source code but the overall
execution time of the program is slower.
Planning a program
Four steps of planning a computer pRogram
• Identify the problem- What problem does your
program solve?
• Identify the user- Who’s going to use your program?
• Determine the target computer- Which computer do
people need to run your program?
• Determine your programming skill- Are you going to
write the entire thing yourself or get help from
others?
In this chapter you will learn about:
• Programs must be planned before they are written
• Algorithm
• Flowchart
• Pseudocode
• Plan the logic of a computer program
• Commonly used tools for program planning and their
use
Purpose of program planning
• To write a correct program, a programmer must write
each and every instruction in the correct sequence
• Logic (instruction sequence) of a program can be very
complex
• Hence, programs must be planned before they are
written to ensure program instructions are:
>Appropriate for the problem
>In the correct sequence
algorithm

• Refers to the logic of a


program and a step-by-
step description of how
to arrive at the solution
of a given problem
• In order to qualify as an
algorithm, a sequence
of instructions
Representations of algorithm
• As programs
• As flowcharts
• As pseudocodes

When an algorithm is represented in the form of a


programming language, it becomes a program
Flowchart
• Flowchart is a pictorial
representation of an
algorithm
• Uses symbols (boxes of
different shapes) that have
standardized meanings to
denote different types of
instructions
• Actual instructions are
written within the boxes
• Process of drawing a
flowchart for an algorithm
is called flowcharting
Flowchart
Advantages Limitations
• Better communication • Flowcharts are very
• Proper program time consuming and
documentation laborious to draw
• Efficient coding • There are no standards
• Systematic debugging determining the amount
of detail that should be
• Systematic testing
included in a flowchart
Pseudocode
• A program planning
tool where program
logic is written in an
ordinary natural
language using a
structure that resembles
computer instructions
• Because it emphasizes
the design of the
program pseudocode is
also called PROGRAM
DESIGN LANGUAGE
(PDL)
Basic logic instructions
1. Sequence logic,
2. Selection logic, and
3. Iteration (or looping) logic

Programs structured by using only these three logic


structures are called Structured programs, and
the technique of writing such programs is known as
Structured programming
Pseudocode
Advantages Limitations
• Converting a • For a beginner, it is
pseudocode to a more difficult to follow
programming is much the logic of or write the
more easier than pseudocode, as
converting a flowchart compared to
to a programming flowcharting
language
INTRODUCTION TO WEB
PROGRAMMING
Web programming
• Web programming - refers to the
writing, markup and coding involved
in Web development.

• Web development  - is the work involved


in developing a web site for the internet.
The web today
Client - server
Client
• Web browser (Chrome, Firefox, Internet
Explorer, etc)
• Computer, Phones, and tablets.
• Presentation of the web page
• Receives users input and the client sends that
to the server
Server

• “The cloud”- some computers or server that are


located somewhere in the world that keeping the
files, photos, and other information of the user.
• Database – a data structure that stores organized
information.
• Data validation – to check data sent to the server,
ensuring incorrect or malicious data is rejected.
Basic web programming
• HTML
• CSS
• JAVASCRIPT
HTML
• HyperTxt Markup Language
• The visual apperance of a website
• “Web Browser Language”
Css
• Cascading Style Sheets
• Define how to display HTML elements
• CSS – is used to control the style and layout of
multiple web pages.
Three ways to insert css
1. External style sheet - is a separate file where you can declare
all the styles that you want to use on your website. You then link to the
external style sheet from all your HTML pages.

2. Internal style sheets - is used to add a unique style


for a single document.
3. Inline style sheet - is a term that refers to style sheet information
being applied to the current element.
EXAMPLE OF
EXTERNAL STYLE
SHEET
1. Create the style sheet

Type CSS code into a plain text file, and


save with a .css extension (for
example, styles.css).
2. Link to the
Style Sheet from
the HTML
Documents

Add the following code between the 


<head></head> tags of all HTML
documents that you want to reference the
external style sheet. This code uses the
HTML <link> element to link to the
external style sheet.
Example of internal
style sheet
when you embed style
sheet information into an
HTML document using
the <style> element. You
do this by embedding the
style sheet information
within <style></style>
 tags in the head of your
document.
 to use the following
code, simply place it
between the 
<head></head> tags of
your HTML document:
Example of inline style Sheets
• applying the style against all
instances of an element (say the 
<p> tag), you only apply the style
to the instance you want the style
to apply to.
• In the code, we've added CSS by
using inline styles. You can tell
because we've added the styles to
the <p> tag using
the style attribute..
Javascript
• is a dynamic computer programming
language.
• Invented/Developed by Brendan Eich.
• JavaScript enables interactive web pages and
is an essential part of web applications.
3 languages that web developers must learn:

1. HTML takes care of the content of the web


pages.
2. CSS to specify the layout of the web pages.
3. JAVASCRIPT to program the behavior of web
paged.
Web server
• Refers to either the software or the hardware,
that helps to deliver web contents that can be
accessed through internet.

You might also like