- Published on
KembaraXtra-Computer Science - Programming Without an Operating System
Core Concept: Direct Hardware Access
Core Concept: Direct Hardware Access
- Definition: In a system without an operating system (OS), software (like a game) directly interacts with the hardware. There's no intermediary layer managing resources or providing services.
- Examples: Atari 2600, Nintendo Entertainment System (NES), Sega Genesis
- How they worked:
- Game code resided on a cartridge.
- Inserting the cartridge and turning on the console started the game.
- The console executed the game's code directly, with no OS intervention.
- Only one program (the game) ran at a time.
- Switching games required turning off the system, swapping cartridges, and turning it back on.
- Total Control: The game developer was responsible for:
- Game logic
- Initializing the system (setting up hardware components)
- Controlling video hardware
- Reading controller inputs
- Managing all hardware interactions
- Hardware Specificity: Deep understanding of the target console's hardware was crucial. Different consoles had significantly different hardware designs.
- Challenges:
- Porting to different consoles required rewriting substantial portions of code due to hardware differences.
- Redundant code: Every game cartridge needed code for basic tasks (hardware initialization, etc.), leading to duplicated effort across different developers and games.
- Maximum Performance: Knowing the exact hardware specifications allowed developers to optimize their code to squeeze the maximum possible performance from the system.
- Stable environment: The hardware design was consistent during the manufacturing years, which allowed developers to target their code to that specific hardware
- Porting: It was hard to port the games, so they often had to rewrite a substantial portion of their code.
- Duplicated work: Every game cartridge had to include similar code to accomplish fundamental tasks, such as initializing the hardware.
- Published on
- Published on
KembaraXtra-Computer Science - Compiled vs. Interpreted Languages
I. Core Concepts
I. Core Concepts
- Source Code: Human-readable program instructions written by developers.
- Machine Language: Instructions that a CPU can directly execute.
- Compilation: The process of translating source code into machine code (or an intermediate form).
- Interpretation: The process of reading and executing source code instructions line by line (or bytecode).
- Definition: Languages where source code is converted into machine code before runtime.
- Process:
- Developer writes source code (e.g., in C).
- Compiler translates the source code into an executable file (binary).
- End user runs the executable file directly.
- Example: C (using gcc compiler)
- Advantages:
- Fast execution speed because the code is already in machine language.
- Disadvantages:
- Platform-dependent: Executables are specific to the architecture they were compiled for.
- Requires a compilation step during development.
- Definition: Languages where source code is executed line by line by an interpreter during runtime.
- Process:
- Developer writes source code (e.g., in Python).
- End user runs the source code using an interpreter.
- The interpreter reads and executes the code.
- Example: Python
- Advantages:
- Platform-independent: As long as an interpreter exists for a platform, the code can run.
- No compilation step required for the end user.
- Disadvantages:
- Slower execution speed due to the overhead of interpretation.
- Requires the user to have an appropriate interpreter installed.
- Definition: A combination of compilation and interpretation, using an intermediate language called bytecode.
- Process:
- Developer writes source code.
- Compiler translates source code into bytecode.
- A virtual machine (VM) executes the bytecode.
- Bytecode:
- Similar to machine code but designed for a virtual machine, not a specific CPU.
- Virtual Machine (VM):
- A software platform that provides a virtual CPU and execution environment.
- Abstracts away the details of the underlying hardware and OS.
- Examples:
- Java (Java bytecode runs on the Java Virtual Machine - JVM).
- C# (CIL or Common Intermediate Language runs on the .NET Common Language Runtime - CLR).
- Python (CPython implementation compiles to bytecode internally).
- Advantages:
- Combines platform independence (like interpreted languages) with some of the performance benefits of compiled code.
- Disadvantages:
- Still requires a VM to run.
- Execution is generally slower than native compiled code.
- Published on
KembaraXtra-Computer Science- Object-Oriented Programming (OOP)
I. Paradigms in Programming
myAccount.deposit(25) # Increases myAccount's balance by 25
Key Concept: myAccount is an object (instance of BankAccount). deposit() is a method called on that specific object, modifying its balance field.
I. Paradigms in Programming
- Programming languages support different approaches to programming called paradigms.
- Examples:
- Procedural Programming
- Functional Programming
- Object-Oriented Programming (OOP)
- Languages can support multiple paradigms.
- Definition: A programming paradigm where code and data are grouped together into objects.
- Objects: Logical groupings of data and functionality, designed to model real-world concepts.
- Class-Based Approach: Common in OOP languages.
- Class: A blueprint for an object. Defines the structure and behavior of a type of object.
- Object: An instance of a class. A concrete realization of the class blueprint.
- Methods: Functions defined within a class. They define the actions that an object can perform.
- Fields: Variables declared within a class. They store the data associated with an object.
- Instance Variables (Python): Fields that have different values for each object (instance) of the class. Each object has its own unique value for these fields.
- Class Variables (Python): Fields that have the same value across all objects (instances) of the class. These variables are shared by all objects of the class.
- Class: BankAccount (a blueprint)
- Fields:
- balance (instance variable - each account has a unique balance)
- holder's name (instance variable - each account has a unique name)
- Methods:
- withdraw()
- deposit()
- Fields:
- Objects: Specific bank accounts created from the BankAccount class (instances). These are real accounts with specific names and balances.
- Interaction: We can use the withdraw or deposit methods to modify the balance field of specific bank account objects.
myAccount.deposit(25) # Increases myAccount's balance by 25
Key Concept: myAccount is an object (instance of BankAccount). deposit() is a method called on that specific object, modifying its balance field.
- Published on
- Published on
- Published on
- Published on
Computer Science- The Internet of Things (IoT)
1. Introduction to IoT
1. Introduction to IoT
- Traditional Internet Model: Servers provide services, and users interact with them via devices like PCs, laptops, and smartphones.
- IoT Definition: Extending internet connectivity to everyday devices (speakers, TVs, thermostats, cars, etc.).
- Driving Forces:
- Decreasing costs and size of electronic components.
- Widespread Wi-Fi and cellular internet access.
- Consumer demand for "smarter" devices.
- Growth of cloud computing (as IoT devices often rely on web services).
- Applications:
- Consumers: "Smart homes" (monitoring and controlling appliances).
- Business: Manufacturing, healthcare, transportation, etc.
- Security:
- IoT devices often have weak security measures.
- Compromised devices can be used as entry points into secure networks.
- They can also be used to launch remote attacks.
- Consumers often overlook security when connecting devices.
- Privacy:
- IoT devices collect data, which is often sent to cloud services.
- Concerns about how organizations handle personal data.
- Risk of data breaches, even with well-intentioned organizations.
- Devices like smart speakers pose risks of accidentally recording private conversations.
- Trade-off between convenience and privacy.
- Reliance on Cloud Services:
- Functionality can be limited or lost if the internet connection is down.
- Manufacturer may eventually discontinue service, rendering the device useless.
- Published on
Computer Science - Virtual Reality (VR) and Augmented Reality (AR)
I. Introduction
V. XR Development
I. Introduction
- VR and AR are technologies that change how we interact with computers.
- XR is a general term referring to VR and AR technologies.
- Definition: Immerses the user in a 3D virtual space, usually with a headset.
- Interaction: Users interact with virtual objects using:
- Gaze
- Voice commands
- Handheld controllers
- History:
- Attempts have been made for decades, but became mainstream in the 2010s.
- Google Cardboard (2014): Popularized VR due to its low cost and accessibility.
- Concept: Headset made from cardboard, lenses, and a smartphone.
- How it Works:
- Apps render content for each eye on separate halves of the smartphone screen.
- Uses the smartphone's gyroscope to track head movement.
- 3 Degrees of Freedom (3DoF):
- Tracks head movement (looking around).
- Cannot track physical movement in space (moving around).
- Supports basic one-button input.
- Impact: Introduced VR to a wide audience.
- 3DoF: Tracks rotational movement (looking around).
- 6 Degrees of Freedom (6DoF): Tracks both rotational and positional movement (moving around in space).
- More immersive experience.
- VR headsets and controllers can have either 3DoF or 6DoF.
- 6DoF controllers enable natural interactions in VR.
- Smartphone-based: (Samsung Gear VR, Google Daydream)
- PC-connected: (Oculus Rift, HTC Vive, Windows Mixed Reality)
- Provide the highest graphical fidelity.
- Most expensive due to the cost of the PC.
- Standalone: (Oculus Go, Oculus Quest, Lenovo Mirage Solo)
- Do not require a smartphone or PC.
- Definition: Overlays virtual elements onto the real world.
- Implementation:
- Mobile Devices: Uses the rear-facing camera to observe the real world and overlays virtual elements.
- Dedicated Devices: (Google Glass, Magic Leap, Microsoft HoloLens) Worn on the head and superimpose computer-generated graphics.
- Advanced AR: Software understands physical elements, allowing virtual elements to interact with the environment.
- Interaction: Users interact using voice commands or hand tracking.
V. XR Development
- Platforms: VR and AR technologies are platforms for software developers.
- Game Engines: Many VR developers use game engines like Unity and Unreal.
- Familiar to game developers.
- Facilitate building software for multiple VR platforms.
- Web Development: WebVR and WebXR (JavaScript APIs)
- WebVR: Focused on VR specifically (older).
- WebXR: Supports both AR and VR (newer).
- Published on