0% found this document useful (0 votes)
4 views

Introduction to Programming 1

The document provides an introduction to computer programming, explaining the basic components of a computer, how it processes data using binary, and the concept of programming itself. It outlines the programming cycle, including problem-solving, design, coding, testing, and maintenance phases, while also discussing programming structures like sequential, selection, and repetition. Additionally, it emphasizes the importance of programming languages in communicating instructions to a computer and the steps involved in writing effective code.

Uploaded by

Ram Ram Cagoyong
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Introduction to Programming 1

The document provides an introduction to computer programming, explaining the basic components of a computer, how it processes data using binary, and the concept of programming itself. It outlines the programming cycle, including problem-solving, design, coding, testing, and maintenance phases, while also discussing programming structures like sequential, selection, and repetition. Additionally, it emphasizes the importance of programming languages in communicating instructions to a computer and the steps involved in writing effective code.

Uploaded by

Ram Ram Cagoyong
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

INTRODUCTION TO PROGRAMMING 1

Lesson 1: Define a Computer Computers use a binary system, which


and identify its basic consists of two digits: 0 and 1. Each bit
components represents a power of two Bytes -
group of 8 bits forms a byte, which can
What is a Computer & How it represent 256 different values (0-255).
works?
 A computer is an electronic 2. Data Representation
device that processes data, Stored in binary form (e.g.,
performing calculations and the decimal number 5 is 101
executing instructions to in binary). – Characters -
perform various tasks. Represented using encoding
The basic workflow of a schemes like ASCII or
Computer Unicode, where each
character corresponds to a
 Input specific binary value. -
- Data is entered via input Images, Audio, and Video
devices - These are converted into
(keyboard, mouse, etc.). binary data via encoding
methods, allowing for digital
 Processing storage and processing.
- The CPU processes the
input data according to 3. Processing Data
programmed instructions. The Central Processing Unit
interprets and executes
 Output binary instructions. It
-Processed information is performs arithmetic and
sent to output devices logical operations on binary
(monitor, printer). data. - Instruction Set - A
set of binary-coded
Input  Processing  instructions that the CPU
Output can execute.
How Computers work in Data
and Binary 4. Memory and Storage
Temporary storage for data
 Computers operate using and instructions that the
data and binary through CPU is currently processing.
the following processes - Storage Devices - Hard
drives and SSDs store binary
data permanently.
1. Binary System: - Binary
Digits (Bits)
5. Data Transfer: - Buses:
Data moves between
INTRODUCTION TO PROGRAMMING 1
components (CPU, memory, How Computers works in
storage) via data buses, memory, CPU, input, and output
which transmit binary
Computers operate through a
signals.
coordinated interaction between
the CPU, memory, and input/output
What is a Binary Number devices:
system?
 CPU (Central
 The binary number Processing Unit): - The
system is a base-2 CPU executes instructions
numeral system that from programs. It
utilizes only two symbols: performs calculations,
0 and 1. Unlike the logic operations, and
decimal system, which is controls other
base-10 and uses ten components. - It consists
digits (0-9), binary of the ALU (Arithmetic
represents values through Logic Unit) for
combinations of these two computations and the
digits. Each position in a control unit to manage
binary number instruction flow.
corresponds to a power of
2, starting from the  Memory*: - RAM
rightmost digit, which (Random Access
represents \(2^0\), the Memory):
next \(2^1\), and so on. - Temporary storage for
data and instructions that
the CPU needs while
What is Text in Binary? performing tasks. It is
volatile, meaning it loses
 Text in binary is the
data when powered off. -
representation of
Storage: Long-term data
characters using the
storage (like SSDs or
binary number system.
HDDs) that retains
Each character is encoded
information even when
into a binary format based
the computer is off.
on a specific character
encoding standard, the
 Input and Output
most common of which is
Input Devices: Tools like
ASCII (American
keyboards, mice, and
Standard Code for
scanners that allow users
Information Interchange).
to enter data into the
computer.
INTRODUCTION TO PROGRAMMING 1
the CPU processes
- Output Devices: these instructions,
Monitors, printers, and utilizing memory to
speakers that present store data and
processed data to the intermediate results.
user. The operating system
manages resources,
How Computers work in
allowing the program
Circuits and Logics
to interact with
 Computers work in hardware and other
circuits and logic by software. Programs
using transistors and can be compiled
logic gates to process (translated into
binary data (0s and machine code) or
1s), enabling interpreted (executed
operations such as line by line), enabling a
arithmetic and data wide range of
storage. functionalities from
simple calculations to
How Computers works inside complex applications.
and outside
 Computers process
data using a How do you represent
combination of information using electrical
hardware components wires
that work together to
 Information is
execute tasks, store
represented using
information, and
electrical wires
facilitate user
through binary signals,
interaction through
where two distinct
various input and
voltage levels
output devices.
correspond to the
How do Programs work on binary digits (0 and 1).
computer This is often achieved
by using a high voltage
 Programs are sets of to represent a "1" and
instructions written in a low voltage (or
a programming ground) to represent a
language that tell a "0." These signals can
computer how to be combined in various
perform specific tasks. ways, such as through
When a program runs, circuits, to encode
INTRODUCTION TO PROGRAMMING 1
more complex data, through a medium,
like numbers, such as air, water, or
characters, or solids. These vibrations
multimedia. This create pressure waves,
binary representation which our ears detect
forms the basis of and interpret as sound.
digital communication In programming, sound
and processing in can be represented
computers. digitally by sampling
these vibrations at
What is images in binary?
specific intervals,
 Images in binary refer converting them into a
to the digital series of numerical
representation of values that can be
visual information in a processed, stored, and
computer using binary played back by
code (0s and 1s). Each computers. This digital
image is composed of representation allows
pixels, with each for manipulation,
pixel's color typically synthesis, and
represented in the RGB playback of sound in
color model, where various applications,
red, green, and blue from music production
values range from 0 to to game development.
255 and are stored as
Lesson 2: Discuss the concept
8-bit binary numbers.
of programming
This binary data is
organized in various What is programming?
file formats (like JPEG
 It is planning,
or PNG) that dictate
scheduling, or
how the pixel
performing task
information and
additional metadata What is computer
are stored, enabling programming?
computers to display
and manipulate images  Computer
effectively. programming is the
process of designing
and writing
instructions in a
Sound as series of vibrations
programming language
 Sound is a series of to create software
vibrations that travel applications that
INTRODUCTION TO PROGRAMMING 1
perform specific tasks. Why computer programming is
It involves developing both art and science?
algorithms, coding,
 Computer
debugging, and testing
programming is often
to ensure that the
viewed as both an art
software functions
and a science due to its
correctly and
unique blend of logical
efficiently. Through
and creative elements.
programming, abstract
On the scientific side,
ideas and requirements
programming relies on
are transformed into
algorithms and data
functional programs
structures, employing
that can control
systematic problem-
hardware, process
solving techniques
data, and solve
similar to scientific
problems.
methods. Rigorous
Why computer programming? testing and validation
ensure that the code
 Computer
behaves as expected,
programming is the
reflecting the precision
process of designing
found in scientific
and writing
inquiry. Conversely,
instructions in a
programming also
programming language
demands a significant
to create software
level of creativity;
applications that
crafting elegant
perform specific tasks.
solutions and
It involves developing
innovative features
algorithms, coding,
requires a visionary
debugging, and testing
mindset. The
to ensure that the
aesthetics of code—
software functions
writing clean, readable
correctly and
scripts—parallels
efficiently. Through
artistic expression,
programming, abstract
emphasizing the
ideas and requirements
importance of style and
are transformed into
maintainability.
functional programs
Ultimately,
that can control
programming merges
hardware, process
the rigor of science
data, and solve
with the fluidity of art,
problems.
making it a
INTRODUCTION TO PROGRAMMING 1
multifaceted discipline  Implementation
that fosters both Phase: Once the
analytical thinking and problem-solving phase
creative problem- is complete, the
solving. solution is ready to be
implemented in the
Overview of computer
chosen programming
programming
language. The
What are the 2 phase processes programmer translates
of a computer programming? the designed algorithm
into actual code, taking
 Problem-Solving care to follow proper
Phase: This is the first syntax and utilizing
stage where the focus appropriate data
is on understanding structures and control
and defining the flows. This phase also
problem clearly. The involves testing the
programmer analyzes code to ensure it works
the requirements, as intended, debugging
breaks down the any errors, and
problem into smaller, refining the solution if
manageable parts, and necessary. The final
designs an algorithm product of the
or strategy to solve it. implementation phase
This phase often is a working program
involves creating a that meets the
flowchart or problem's
pseudocode, which requirements and
represents the logical performs efficiently.
steps needed to reach
a solution. The goal is What is a computer
to develop a clear and programming cycle?
efficient solution
 The computer
before actually writing
programming
any code. Essentially,
development cycle is a
this phase is about
systematic process used to
planning the approach,
create software, ensuring
considering edge
each stage of development is
cases, and ensuring
carefully planned and
the solution is logically
executed. It begins with
sound.
problem definition, where
the problem and the
INTRODUCTION TO PROGRAMMING 1
software’s goals are clearly revisiting earlier stages to
understood by gathering improve the software further.
requirements from users or
What is programming
stakeholders. Next is the
structures?
design phase, which
involves creating the  In the context of introductory
program’s structure, programming courses like
developing algorithms, and Programming 1,
selecting appropriate data programming structures are
structures. This step often fundamental concepts that
includes tools like flowcharts help students learn how to
and pseudocode to visualize write and organize code
the program’s logic. Once effectively. The primary
the design is complete, the structures typically covered
coding (implementation) include the sequential
phase starts, where structure, where statements
programmers translate the are executed one after
design into actual code using another in a linear sequence,
a programming language teaching students the basics
such as Python or Java. After of processing information
coding, the program straightforwardly. The
undergoes rigorous testing selection structure, or
to identify bugs and logical conditional statements,
errors. Any issues found are allows the program to make
addressed during the decisions based on specific
debugging stage, where conditions using constructs
developers fix problems and like if, else if, and else,
retest the program. Once the introducing students to
software is stable, it moves branching logic. The
to the deployment phase, repetition structure
making it available to users. enables the execution of a
Finally, the maintenance block of code multiple times,
phase follows, ensuring the essential for tasks requiring
software continues to repetition. Students learn
function properly by fixing about various types of loops,
bugs, adding new features, such as for loops and while
and adapting it to changing loops, which automate
environments. This cycle is repetitive tasks and minimize
often iterative, meaning that code duplication.
after deployment, new Additionally, students may be
updates or fixes may require introduced to functions,
which encapsulate code into
INTRODUCTION TO PROGRAMMING 1
reusable blocks, promoting types of applications and use
better organization and cases.
modular programming.
Writing code: General steps in
Mastering these
writing code
programming structures is
foundational for developing  Define the Problem: Clearly
problem-solving skills and understand and articulate the
writing effective code in any problem you are trying to solve.
programming language. This includes gathering
requirements and identifying the
What is programming
desired outcomes.
language?
 Plan the Solution: Outline a
 A programming language is
high-level solution by breaking
a formal set of rules and
down the problem into smaller,
syntax used to communicate
manageable components. This may
instructions to a computer. It
involve creating algorithms,
provides a means for
flowcharts, or pseudocode to
developers to write code that
visualize the steps needed to reach
specifies how the computer
the solution.
should perform tasks,
manipulate data, and  Choose a Programming
interact with other software Language: Select an appropriate
and hardware. Programming programming language based on
languages can vary in the project requirements, such as
abstraction levels, ranging performance needs, ease of use,
from low-level languages, and available libraries or
which are closer to machine frameworks.
code and hardware, to high-
level languages, which are  Write the Code: Begin coding
more user-friendly and closer based on the planned solution.
to human languages. Each Start by implementing the core
programming language has functionality, followed by
its own syntax and additional features. Ensure to
semantics, enabling follow best practices for coding,
programmers to express including proper naming
algorithms, control conventions and documentation.
structures, and data  Test the Code: After writing the
manipulations effectively. code, conduct tests to identify any
Popular programming bugs or issues. This can include
languages include Python, unit tests, integration tests, and
Java, C++, and JavaScript, system tests to ensure that the
each designed for different
INTRODUCTION TO PROGRAMMING 1
code behaves as expected in computer's hardware. Writing in
various scenarios. machine language is complex and
error-prone, as programmers must
 Debug and Refine: If any
remember specific binary codes for
errors are found during testing,
instructions, making it difficult to
debug the code to locate and fix
develop even simple programs.
these issues. Refine the code to
improve efficiency, readability, and  Assembly Language: To
maintainability. improve upon the challenges of
machine language, assembly
 Document the Code: Write
language was developed as a
documentation to explain how the
symbolic representation of
code works, including its functions,
machine code. It uses mnemonics
usage, and any necessary
and labels to represent
instructions. Good documentation
instructions, making it more
helps others (and future you)
human-readable. Each assembly
understand the code.
instruction corresponds to a
 Deploy the Code: Once the machine language instruction, but
code is tested and documented, programmers still need a detailed
deploy it to a production understanding of the hardware.
environment where users can
 High-Level Programming
access it. This may involve
Languages: The introduction of
installing software on servers or
high-level programming languages
making it available through
in the 1950s, such as Fortran and
applications.
COBOL, transformed programming
 Maintain and Update: After by allowing developers to write
deployment, monitor the code for code using more abstract concepts
any issues or user feedback. Be and syntax resembling natural
prepared to make updates, fix language. High-level languages are
bugs, and add new features as designed to be portable, enabling
needed. the same code to run on different
hardware platforms with minimal
modifications.
 Object-Oriented Languages:
Evolution of computer In the 1980s, object-oriented
programming languages programming (OOP) languages like
C++ and Java emerged,
 Machine Language: The emphasizing the organization of
earliest form of programming, code into objects that encapsulate
machine language consists of data and behavior. This approach
binary code (0s and 1s) that promotes reusability, modularity,
directly interacts with the and better modeling of real-world
INTRODUCTION TO PROGRAMMING 1
problems, making code easier to
maintain and extend.
End – uses computer
programming
End user- user of computer
programming

You might also like