Computer science is more than just programming. It's the study of computation, information processing, and the design of computer systems. Understanding the fundamentals helps you become a better developer.
What is Computer Science?
Computer science is the study of algorithms, data structures, and the principles underlying computation. It bridges mathematics, engineering, and problem-solving.
Key Areas of CS
- Algorithms: Step-by-step procedures for solving problems
- Data Structures: Ways to organize and store data
- Programming Languages: Tools to express computations
- Computer Architecture: How hardware works
- Operating Systems: Software that manages hardware
- Networks: Communication between computers
- Databases: Storing and retrieving data
- AI/Machine Learning: Making computers "intelligent"
Binary & Data Representation
Computers only understand 1s and 0s (binary). Everything - numbers, text, images, sounds - must be converted to binary.
Binary Numbers
Decimal (Base 10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10...
Binary (Base 2): 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010...
Converting binary to decimal:
1011 = (1×2³) + (0×2²) + (1×2¹) + (1×2⁰)
= 8 + 0 + 2 + 1
= 11
Converting decimal to binary:
13 ÷ 2 = 6 remainder 1
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
13 in binary = 1101 (read remainders bottom-up) Data Units
| Unit | Size | Example |
|---|---|---|
| Bit | 1 or 0 | Single binary digit |
| Byte | 8 bits | One character |
| Kilobyte (KB) | ~1,000 bytes | Short text document |
| Megabyte (MB) | ~1,000 KB | MP3 song |
| Gigabyte (GB) | ~1,000 MB | HD movie |
| Terabyte (TB) | ~1,000 GB | Large hard drive |
Text Encoding
ASCII: Maps characters to numbers (0-127)
'A' = 65 = 01000001
'a' = 97 = 01100001
'0' = 48 = 00110000
UTF-8: Extends ASCII for all languages and emojis
'😀' = 128512 = 11110000 10011111 10011000 10000000 Computer Architecture
Understanding how computers work at the hardware level.
Main Components
- CPU (Central Processing Unit): The "brain" - executes instructions
- RAM (Random Access Memory): Fast, temporary storage
- Storage (SSD/HDD): Permanent data storage
- GPU (Graphics Processing Unit): Parallel processing
- Motherboard: Connects all components
How the CPU Works
The Fetch-Decode-Execute Cycle:
1. FETCH: Get instruction from memory
CPU reads instruction at memory address
2. DECODE: Interpret the instruction
"ADD R1, R2" means add registers 1 and 2
3. EXECUTE: Perform the operation
ALU (Arithmetic Logic Unit) does the math
4. STORE: Save the result
Write back to register or memory
This cycle happens billions of times per second! Memory Hierarchy
Speed (fastest to slowest) | Size (smallest to largest)
CPU Registers ← Fastest, tiny (bytes)
L1 Cache ← Very fast, small (KB)
L2/L3 Cache ← Fast, larger (MB)
RAM ← Moderate, sizeable (GB)
SSD ← Slower, large (TB)
HDD ← Slowest, very large (TB) Operating Systems
The OS is software that manages hardware and provides services to applications.
OS Responsibilities
- Process Management: Run multiple programs simultaneously
- Memory Management: Allocate RAM to programs
- File System: Organize and store files
- Device Drivers: Interface with hardware
- Security: User permissions and access control
- User Interface: GUI or command line
Common Operating Systems
- Windows: Most common desktop OS
- macOS: Apple's desktop OS (Unix-based)
- Linux: Open-source, powers most servers
- Android/iOS: Mobile operating systems
Processes vs Threads
Process:
- Independent program execution
- Has its own memory space
- More overhead to create
- Better isolation
Thread:
- Lightweight unit within a process
- Shares memory with other threads
- Less overhead
- Faster communication
Example: A web browser
- Main process manages the application
- Each tab might be a separate process (isolation)
- Within a tab, threads handle: rendering, networking, JavaScript Networking Basics
How computers communicate with each other.
IP Addresses
IPv4: 192.168.1.100 (4 numbers, 0-255 each)
IPv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Special addresses:
127.0.0.1 - Localhost (your own computer)
192.168.x.x - Private network
8.8.8.8 - Google's DNS server The OSI Model (Simplified)
| Layer | Purpose | Example |
|---|---|---|
| Application | User-facing protocols | HTTP, SMTP, FTP |
| Transport | Reliable delivery | TCP, UDP |
| Network | Routing between networks | IP |
| Data Link | Local network delivery | Ethernet, WiFi |
| Physical | Actual cables/signals | Wires, radio waves |
TCP vs UDP
- TCP: Reliable, ordered delivery. Used for web, email, file transfer.
- UDP: Fast but unreliable. Used for video streaming, gaming, VoIP.
Computational Thinking
A problem-solving approach that computer scientists use.
Four Key Concepts
- Decomposition: Break complex problems into smaller parts
- Pattern Recognition: Find similarities and trends
- Abstraction: Focus on important details, ignore the rest
- Algorithm Design: Create step-by-step solutions
Example: Planning a Trip
Decomposition:
- Book flights
- Reserve hotel
- Plan daily activities
- Pack luggage
Pattern Recognition:
- Similar to previous trips
- Morning activities, afternoon rest, evening dinner
Abstraction:
- Don't need to know how planes fly
- Focus on departure/arrival times
Algorithm:
1. Choose destination
2. Set budget
3. Search flights within budget
4. Compare hotels near attractions
5. Book both
6. Create daily itinerary Next Steps
Now that you understand the basics, dive deeper into specific areas:
- Programming Fundamentals - Learn to code
- Data Structures - Organize data efficiently
- Algorithms - Solve problems systematically
- Web Development - Build websites and apps