Introduction to Programming - Programming Fundamentals | Lecture Notes - YNetStudyHub
Unlock Premium - notes, past papers & AI tutoring for as low as KSh 29/month. Subscribe Now →
Programming Fundamentals

Introduction to Programming

2 mins read 384 words Topic 1 of 9
Study with AI Tutor Learn 2× faster Instant Q&A Quiz practice
Launch AI Lesson
Text Size:
PDF Save

An overview of what programming is, its importance, different programming languages, and the basic concepts involved in programming.

Introduction to Programming – Quick Reference Notes


1. What Is Programming?

  • Definition: The process of designing, writing, testing, and maintaining code that tells a computer how to perform tasks.
  • Goal: Transform a problem or requirement into a set of precise, executable instructions.

2. Core Concepts

Concept Description Typical Example
Algorithm Step‑by‑step procedure to solve a problem. Sorting a list of numbers.
Syntax Formal rules that define how code must be written. if (x > 0) { … } in C‑style languages.
Semantics Meaning of syntactically correct statements. x = x + 1 increments x.
Variable Named storage location for data that can change. int count = 0;
Data Type Classification of values (e.g., integer, string, boolean). float, char, bool.
Control Flow Structures that dictate the order of execution. if/else, for, while.
Function / Procedure Reusable block of code that performs a specific task. def add(a, b): return a + b
Library / API Pre‑written code that provides additional functionality. math.sqrt(), java.util.ArrayList.
Debugging Finding and fixing errors (bugs) in code. Using breakpoints, print statements.
Compilation / Interpretation Translating source code to executable form. gcc (compile), Python REPL (interpret).

3. Programming Paradigms

Paradigm Key Idea Typical Languages
Procedural Code organized as a sequence of instructions and procedures. C, Pascal
Object‑Oriented (OO) Data and behavior are bundled into objects; emphasizes inheritance & polymorphism. Java, Python, C++
Functional Computation expressed as evaluation of pure functions; avoids mutable state. Haskell, Lisp, Scala
Declarative Describe what should be done, not how; includes SQL, HTML, Prolog.
Event‑Driven Flow controlled by events (user actions, messages). JavaScript (browser), C# (GUI)

4. Basic Program Structure (Example in Python)

# 1. Import modules (libraries)
import math

# 2. Define constants
PI = math.pi

# 3. Define functions
def area_of_circle(radius):
    """Return the area of a circle given its radius."""
    return PI * radius ** 2

# 4. Main execution block
if __name__ == "__main__":
    r = float(input("Enter radius: "))
    print(f"Area = {area_of_circle(r):.2f}")

Typical sections

  1. Imports – bring in external code.
  2. Constants – values that never change.
  3. Functions / Classes – reusable logic.
  4. Entry point – code that runs when the script starts.

5. Writing Your First Program (Pseudo‑Steps)

  1. Understand the problem – what input, what output, any constraints?
  2. Design an algorithm – outline steps in plain language or flowchart.
  3. Choose a language – consider environment, libraries, learning curve.
  4. Translate algorithm to code –
Topic Concept Map
Ask AI Tutor 24/7 Live

Click any prompt to explore this topic interactively with your AI Tutor:

Explain in simple terms Give me 3 practice exam questions Summarize key principles in 5 points
Unit Syllabus 9 Topics
Introduction to Programming
Variables and Data Types
Upgrade
Operators and Expressions
Upgrade
Control Structures
Upgrade
Functions and Methods
Upgrade
Arrays and Lists
Upgrade
Object-Oriented Programming
Upgrade
File Handling
Upgrade
Debugging and Troubleshooting
Upgrade