An Introduction to Programming Fundamentals: From History to Algorithms

1. A Brief History of Computing

The journey of modern programming began long before silicon chips. Key historical figures include Blaise Pascal (1623-1662), known for his mechanical calculator, and Charles Babbage (1792-1871), who designed the analytical engine. Ada Lovelace (1815-1852) is also recognized in this history, often cited regarding the early conceptualization of computing logic. Early data input methods included physical punch cards.

Blaise Pascal
Blaise Pascal
(1623 – 1662)
Charles Babbage
Charles Babbage
(1792 – 1871)
Ada Lovelace
Ada Lovelace
(1815 – 1852)

2. What is a Computer Program?

A computer program is an ordered sequence of instructions written in a programming language that tells a computer to perform a specific task. It is a component of software, existing alongside documentation, licenses, and user manuals.

Key Characteristics of a Program

To be considered high-quality, a program should possess the following attributes:

  • Portability: The ability to run on different operating systems with minimal or no modification.
  • Readability: Written in a way that allows other programmers to read and understand the logic easily.
  • Efficiency: Effective use of system resources such as CPU, memory, and disk space.
  • Structural: Organized into blocks that can be written and executed independently.
  • Flexibility: Designed to adapt to changes without requiring a complete rewrite.
  • Generality: Capable of operating with a wide range of data or tasks.
  • Documentation: Includes technical documents and designs to facilitate future work by other developers.

3. How Programs Are Executed

Programs exist in different forms depending on the observer:

  • For Humans: Source code.
  • For Machines: Machine instructions (machine code).
  • For Programs: Intermediate code (byte code).

Compilation vs. Interpretation

There are two main approaches to translating source code into executable instructions:

  • Ahead Of Time (AOT) Compilation: Used by languages like C, C++, and Golang. A Compiler translates source code directly into machine code, which the OS then loads and executes via the CPU.
  • Interpretation / Just In Time (JIT): Used by languages like Java, Python, and PHP. Source code is compiled into Bytecode. An Interpreter (Virtual Machine) reads and executes this bytecode line-by-line.
Ahead Of Time compilation
Just In Time compilation

4. Programming Languages and Tools

Programming (coding) is the act of writing ordered instructions for a computer. A Programming Language is the set of commands used by humans to communicate these instructions. These languages are characterized by being concise, precise, and context-free.

Generations of Languages

  • Generation I: Manual interaction where humans mimicked machine tasks.
  • Generation II (Assembly): A 1-to-1 mapping between language commands and machine instructions. It is machine-dependent and uses an Assembler for translation.
  • Generation III (High-Level): Uses abstract concepts closer to human language and is largely machine-independent. A single high-level command corresponds to multiple machine instructions.
Languages Generation

Development Environment

Developers utilize a suite of tools including Editors, Version Control Systems, Compilers, Linkers, and Debuggers. An Integrated Development Environment (IDE) like Visual Studio, Xcode, or IntelliJ IDEA packages these tools together. While convenient and friendly, IDEs can be resource-heavy and less flexible than using individual tools.

5. Algorithms

An Algorithm is a finite, ordered set of clear and actionable steps to solve a problem.

Characteristics of an Algorithm

  • Finiteness: Must stop after a finite number of steps.
  • Definiteness: Steps are clear and unambiguous.
  • Correctness: The same input always produces the same output.
  • Universality: Applicable to any problem within the specific class being considered.

Representation

Algorithms can be represented via:

  • Natural Language.
  • Flow Charts.
  • Pseudocode.
  • Program Code.

Algorithm Complexity

Algorithms are evaluated based on the resources required: Time and Space (memory). Inefficient algorithms can negatively impact system performance or render real-time applications useless.

Big O Notation is used to classify algorithms based on how their execution time grows relative to the input size (n):

  • Constant: O(C)
  • Logarithmic: O(log(n))
  • Linear: O(n)
  • Polynomial: O(n2),O(n3)
  • Exponential: O(2n)
  • Factorial: O(n!)

Leave a Reply

Your email address will not be published. Required fields are marked *