Preliminary Software Engineering
Unit 1 - Programming Fundamentals
Unit 1 - Programming Fundamentals
  • 1 - Programming Fundamentals
    • Programming Fundamentals Content
  • 2 - Python
    • Expected Python Knowledge
    • GitHub
    • Learning Python
    • Data Structures and File Management
      • Data Structures
        • Lists
        • Arrays
          • Single and Multi-Dimensional Arrays
        • Lists vs Arrays
          • Activities
        • Tuples
        • Sets
        • Dictionaries
          • Activities
      • File Handling
        • Loops, Lists, Dictionaries
        • Activities
  • 3 - Theory Content
    • Theory Content Explained
      • NESA Directional Verbs
      • Responding to Directional Verbs
  • 4 - Software Development and Management
    • Approaches to Software Development
      • Waterfall Model
      • Agile Model
      • Summary: Waterfall vs Agile
      • Activities
    • Software Development Steps
      • Sample Exam Question
      • Requirements Definition
        • Understanding the Need
        • Key Questions to Ask
        • Examples
        • Activities
        • Sample Exam Question
      • Determining Specifications
        • Functional Specifications
        • Non-Functional Specifications
        • Activities
      • Design
        • Top-Down Design Approach
        • Bottom-Up Design Approach
      • Development
        • Optimising Code
      • Integration
        • Example: Payment Program
        • Activity
        • Application Programming Interface (API)
          • Example: OpenWeather API
          • Example: WeatherAPI
          • Activity: Prepare Spells
      • Testing and Debugging
        • Test Data
          • Activities
        • Testing the System
          • Activities
        • Debugging
          • Types of Errors
            • Activities
          • Python Debugger
            • Activities
          • VS Code Debugger
            • Activities
      • Installation
        • Activities
        • Sample Exam Question
      • Maintenance
  • Charts and Algorithms
    • Example: IPO Charts and Pseudocode
      • Activities
    • Algorithms, Flowcharts, Pseudocode
      • Pseudocode Activities
      • Flowchart Activities
      • Sample Exam Questions
    • Structure Charts
      • Activities
      • Sample Exam Questions
    • Data Flow Diagrams
      • Activities
    • Data Dictionaries
      • Activities
    • Decision Trees
      • Activities
      • Sample Exam Questions
    • Gantt Chart
    • Class Diagrams
      • Sample Exam Question
    • Storyboards
      • Sample Exam Question
  • Testing and Debugging
    • Test Data
      • Activities
    • Testing the System
      • Activities
    • Debugging
      • Types of Errors
        • Activities
      • Python Debugger
        • Activities
      • VS Code Debugger
        • Activities
  • Computational Thinking
    • Decomposition
    • Abstraction
    • Activities
  • Version Control
    • Git
    • GitHub
    • Activities
  • Number Systems
    • Binary Systems
    • Hexadecimal Numbers
    • Using Two's Complement
    • Activities
  • 5 - Assessment Task 1
    • Data Science Project
      • Before we Start
        • Setting up GitHub Repository
        • Setting Up Markdown Documentation
      • Examples of API Usage
        • Starter Code: NASA Scenario
        • Starter Code: Spell Book
        • Starter: Pokédex Explorer
        • Starter Code: Weather App
        • Example: OpenWeather API
        • Example: WeatherAPI
        • Example: Prepare Spells
    • Task Guide
      • Requirements Definition
      • Determining Specifications
        • Use Cases
      • Design
        • Gantt Chart
        • Structure Chart
        • Algorithms
        • Data Dictionary
      • Development
        • Comments vs DocStrings
        • UI - main.py
        • Create Python Module
          • Example: NASA Module
          • Example: WeatherFetch Module
          • Example: SpellBook Module
      • Integration
        • Example: Pokedex
      • Testing and Debugging
        • Commit Changes
      • Installation
      • Maintenance
    • Submitting Your Task
Powered by GitBook
On this page
  1. Computational Thinking

Abstraction

Abstraction in software design is the practice of hiding unnecessary details and exposing only the essential features of a system. It helps simplify complex systems by focusing on what a component does rather than how it does it.

For example:

  • In Object-Oriented Programming (OOP), abstraction is achieved using classes and interfaces to define behaviors without revealing implementation details.

  • In DFDs, higher levels (like Level 0) show broad system functions, while deeper levels break them into detailed processes.

Abstraction improves clarity, maintainability, and scalability by reducing complexity and emphasizing key functionalities.

Example - User Authentication System

For example, when designing a user authentication system, you focus on what the system needs to achieve (e.g., verifying user credentials) rather than the intricate details of how passwords are stored and verified. By abstracting these details, you can streamline the development process and create a more efficient system.

  • The authenticate_user function focuses on the high-level goal of verifying user credentials without worrying about how this verification is done.

  • The function verify_credentials handles the process of checking if the provided credentials match the stored ones, but it abstracts away the details of how passwords are retrieved and compared.

  • get_stored_password and compare_passwords are further abstractions that hide the details of how passwords are retrieved from storage and how they are compared.

  • The main function represents the point where the authentication process is initiated, abstracting all the underlying complexity.

Define the high-level goal of the authentication system - the system needs to verify user credentials

def authenticate_user(username, password):
    # Call a function to verify the credentials
    if verify_credentials(username, password):
        return "Authentication Successful"
    else:
        return "Authentication Failed"

Abstract the details of how credentials are verified into a separate function.

def verify_credentials(username, password):
    # Call a function to retrieve the stored password for the user
    stored_password = get_stored_password(username)  
     
    # Call a function to compare the provided password with the stored password
    if compare_passwords(stored_password, password):
        return True
    else:
        return False

Abstract the retrieval of the stored password.

def get_stored_password(username):
    # (Details of how the password is retrieved from the database are hidden)
    return retrieved_password_from_database(username)

Abstract the comparison of passwords.

def compare_passwords(stored_password, provided_password):
    # (Details of how passwords are hashed and compared are hidden)
    return compare_hashes(stored_password, hash_password(provided_password))

High-level function that calls authenticate_user and handles the result

def main(): 
	username = input("Enter your username: ") 
	password = input("Enter your password: ") 
	result = authenticate_user(username, password) 
	print(result)
PreviousDecompositionNextActivities

Last updated 3 months ago