General Programming Notes - robbiehume/CS-Notes GitHub Wiki
-
Business logic: the logic created to satisfy the requirements of the user / customer
- Ex: customer can only withdraw X amount of money at a time
-
Application logic: all other logic
- Ex: clicking a button opens a page to make a withdraw
Feature | UTF-8 | ASCII |
---|---|---|
Character Set | Variable length: 1-4 bytes per character (Unicode); it's a superset of ASCII | 128 characters: Standard English letters, digits, symbols, and control characters |
Encoding Efficiency | Efficient for most languages; 1-4 bytes per character | Efficient for English; 1 byte per character (7-bit) |
Readability | High readability (supports all Unicode characters) | High readability for English; limited by 128-character set |
Use Cases | Web content, text files, modern software; universal standard for text encoding | Legacy systems, older protocols, some control characters in data transfer |
Decoding Complexity | Decoded natively by most systems and applications | Simple decoding; supported universally |
Example | "Hello world" remains "Hello world"; emojis like 😊 use multiple bytes | "Hello world" in ASCII is "Hello world" |
Feature | Base64 | Hexadecimal (Base16) |
---|---|---|
Character Set | 64 characters: A-Z, a-z, 0-9, +, / | 16 characters: 0-9, A-F |
Encoding Ratio | 4:3 ratio (increases size by ~33%) | 2:1 ratio (doubles the size) |
Space Efficiency | Less space-efficient than binary but more efficient than Hex (33% overhead) | Less space-efficient (100% overhead) |
Readability | Low readability (mix of letters, digits, symbols) | Medium readability (only digits and letters) |
Use Cases | Transmitting binary data over text-based protocols (HTTP, email), embedding data in web pages (data URLs), APIs | Debugging, representing binary data, cryptographic hashes |
Decoding Complexity | Requires Base64 decoding; moderate complexity | Simple decoding; can be done manually |
Padding | Uses = padding to ensure length is a multiple of 4 |
No padding required |
Supports Binary Data | Yes, converts binary data to ASCII | Yes, converts binary data to ASCII |
Example |
SGVsbG8gd29ybGQ= for "Hello world" |
48656C6C6F20776F726C64 for "Hello world" |
Feature | URL Encoding | HTML Encoding |
---|---|---|
Use Cases | Ensures safe transmission of special characters in URLs and web forms | Prevents XSS attacks and ensures correct display of special characters in web content |
Character Set | Percent encoding: 0-9, A-F for encoded characters | HTML entities: < , > , & , etc. |
Encoding Impact | Increases size based on encoded characters (e.g., space → %20 ) |
Slightly increases size due to encoded characters (e.g., < → < ) |
Readability | Low readability for URLs with many encoded characters like %20
|
Medium readability; encoded entities are human-readable but can clutter text |
Example | "Hello world" becomes Hello%20world in URL encoding |
<div>Hello & welcome!</div> becomes <div>Hello & welcome!</div>
|