Understanding Programming
Who Writes or Creates Applications?
Definition: A programmer is a professional who writes and creates software applications using one or more programming languages. Programmers are often referred to as Software Developers.
Examples & Use Cases:
- A web developer writes code in JavaScript, HTML, and CSS to create websites.
- A game developer uses C++ to build 3D games.
- A mobile app developer uses Swift or Kotlin to develop smartphone applications.
What is a Program?
Definition: A program is a structured set of instructions written in a specific sequence to perform a particular task or solve a problem.
Examples & Use Cases:
- A weather application fetching real-time data and displaying it.
- A calculator app executing arithmetic operations based on user input.
- A chatbot using AI to answer customer queries.
Sequence Organizer for Programmers
A flowchart is a visual representation of the sequence of steps in a program. It helps programmers plan and organize the logic of their program.
Example: Using RAPTOR, a flowcharting tool, to design an authentication system for logging into an account.
Use Cases:
- Designing a traffic light control system logic.
- Mapping the steps in an online order process.
Pseudocode
Definition: Pseudocode is a simplified, language-independent way of outlining a program’s logic before actual coding.
Example:
IF user enters correct password
THEN grant access
ELSE
Deny access
Use Cases:
- Drafting the logic for ATM transactions.
- Sketching the steps in a self-driving car’s decision-making process.
Categories of Programming Languages
1. Assembly Language
Definition: A low-level programming language that interacts directly with hardware.
Example:
- Writing firmware for embedded systems like washing machines and microcontrollers.
2. Compiled Programming Languages
Definition: High-level languages that require compilation into machine code before execution.
Examples: C++, C#, Java, COBOL, Pascal, Fortran, BASIC
Use Cases:
- C++ for game engines like Unreal Engine.
- Java for Android mobile applications.
- C# for Windows desktop applications.
3. Interpreted Programming Languages
Definition: Languages that execute code line-by-line at runtime without requiring compilation.
Examples: Python, JavaScript, Perl
Use Cases:
- JavaScript for dynamic websites.
- Python for AI and data analysis.
- Perl for text processing in UNIX.
Types of Interpreted Languages
- Scripting languages: Used for automating tasks (e.g., PowerShell, Linux Shell scripting).
- Scripted languages: Require an interpreter (e.g., JavaScript running in a browser).
- Markup languages: Used for text formatting and web design (e.g., HTML, XML).
Differences Between Compiled and Interpreted Languages
Task | Compiled | Interpreted |
Translation | Entire program at once | Line-by-line execution |
Execution Speed | Faster | Slower |
Debugging | Harder | Easier |
Example | C++ | Python |
Query Languages
Definition: Languages used to retrieve and manipulate data from databases.
Example:
- SQL (Structured Query Language)
Use Case:
- Fetching customer purchase records from an e-commerce database.
Object-Oriented Programming (OOP)
Definition: A programming paradigm based on objects containing identity, state, and behavior.
Examples: Java, C++, C#, Python, PHP, Ruby
Use Cases:
- Java for large-scale enterprise applications.
- Python for AI-based recommendation systems.
- C++ for game development.
Programming Concepts
Identifiers
Definition: Names used to identify program elements like variables and functions.
Variables
Definition: Stores a value that may change during execution.
Example:
age = 25
Use Case: Storing a user’s age in a profile.
Constants
Definition: Stores a value that cannot change.
Example:
#define PI 3.14159
Use Case: Using PI in a circle area calculation.
Containers
Definition: Store multiple values.
- Arrays (fixed size, same type)
- Vectors (dynamic size, mixed types)
Use Cases:
- Storing a list of student grades.
- Managing inventory stock in a warehouse.
Functions and Procedures
Functions
Reusable code that returns a value.
Example:
def add(x, y):
return x + y
Use Case: Performing mathematical calculations in an accounting system.
Procedures
Reusable code that does not return a value.
Use Case: Sending email notifications after user registration.
Objects
Definition: A collection of attributes (properties) and methods.
Example:
class Car:
def __init__(self, brand, model):
self.brand = brand
self.model = model
Use Case: Modeling real-world cars in a simulation.
Branching and Loops
Branching
Definition: Controls the program flow using if-else statements.
Example:
if score >= 50:
print(“Pass”)
else:
print(“Fail”)
Use Case: Determining if a student passes or fails an exam.
Loops
Definition: Repeats a task until a condition is met.
Example:
for i in range(5):
print(i)
Use Case: Displaying numbers from 0 to 4.
Operators
Comparison Operators:
- == (Equal to)
- != (Not equal to)
- <, >, <=, >= (Comparison)
Logical Operators:
- AND – Both conditions must be TRUE.
- OR – At least one condition must be TRUE.
- XOR – Only one condition must be TRUE.
Common Data Types
Data Type | Description | Example |
Char | Single character | ‘A’ |
String | Text | “Hello” |
Integer | Whole number | 10 |
Float | Decimal number | 3.14 |
Boolean | True/False | True |