Computer Programming 1: Introduction to Computer Programming and Program Logic Formulation

Academic and Course Overview

  • Course Title: COMPUTER PROGRAMMING 1
  • Module: Week 2: Introduction to Computer Programming and Program Logic Formulation
  • Faculty Compiler: Asst. Prof. Jomariss B. Plan, MSIT (CCIS Faculty)
  • Academic Year: AY 2026-2027
  • Target Learning Outcome: At the end of the topic session, students must be able to understand and explain the fundamental concepts of programming, including language generations and the program development life cycle.

Fundamental Concepts of Programming

  • Definition: Programming is both an art and a science focused on instructing computers to perform specific tasks or solve problems.
  • Role in Modern Technology: In a technology-driven world, programming serves as an essential skill and the foundational tool that enables ideas to be transformed into reality.
  • Primary Applications: Programming is utilized to:
    • Develop software applications
    • Analyze complex data
    • Create websites
    • Control robotics
  • Core Mechanism: Programming involves writing instructions—commonly known as code—in a language that computers can interpret and execute.
  • Language Structure: Just as human languages possess distinct grammar rules and vocabulary, programming languages have their own syntax and semantics.
  • Popular Languages: Examples of widely used programming languages include Python, Java, JavaScript, and C++, each engineered for specific purposes and operational contexts.

Essential Personality Traits of a Programmer

Every new programmer must possess five core personality traits:

  1. Patience: Essential for working through complex logical problems and debugging errors.
  2. Courage: Necessary to approach intimidating technical challenges and unfamiliar problems.
  3. Passion: Drives continuous learning and dedication to mastering software development.
  4. Creativity: Required to formulate innovative software solutions and design user experiences.
  5. Logic: Needed to structure step-by-step procedures and reason through complex computational paths.

Core Programming Terminologies

  • Computer Programming / Software Development (Coding): The process by which developers create and design executable computer programs to accomplish specific tasks.
    • Core Included Activities:
    • Problem-solving
    • Algorithm design
    • Debugging
    • Required Developer Workflow:
    • Gain a clear, thorough understanding of the problem.
    • Break the problem down into smaller, manageable tasks.
    • Write code to implement the final solution.
  • Program: A set of instructions designed to perform a specific task or function on a computer.
    • Examples of Computer Programs:
    • Web browsers (e.g., Chrome) for navigating the internet
    • Spreadsheet applications (e.g., Microsoft Excel) for executing mathematical calculations
    • Mobile applications (e.g., fitness trackers or calendar utilities)
    • Chatbots and virtual assistants
    • Computer and mobile games
  • Algorithm: A step-by-step procedure or set of rules for solving a problem in programming.
    • Example: Search engines such as Google utilize algorithms to rank and retrieve information from massive datasets.
  • Application Programming Interface (API): A set of rules, protocols, and tools for building software applications.
    • Functionality: Defines how different software components interact and facilitates the integration of third-party services or data into an application, allowing developers to leverage external features without building them from scratch.
  • Database: A structured collection of data organized for efficient retrieval and manipulation by computer programs.
    • Acts as a central repository for archiving data to ensure easy access.
    • Relies on a Database Management System (DBMS) to facilitate data maintenance.
  • Syntax: The specific rules in a programming language that dictate how statements and expressions are formed using combinations of symbols, keywords, and other elements.
    • Specifies the exact format and structure required for a compiler or interpreter to correctly understand and parse the code.
  • Bug: An error, flaw, or unexpected behavior in a program that causes it to malfunction or yield incorrect results.
    • Results from coding mistakes.
    • Types of errors addressed during development include syntax errors, logic errors, runtime errors, and semantic errors.
  • Debugging: The process of identifying and resolving errors or bugs within a program.
    • Sequential Debugging Process:
    1. Run the program and observe any errors.
    2. Review the code and locate the precise problem.
    3. Inspect the values of variables.
    4. Modify the code to address and fix the issue.
  • Keyword: A word with a specific, reserved meaning used to define the structure and logic of a program.
    • Forms an integral part of a programming language's syntax and cannot be redefined or reused as an identifier.
    • Examples: if, else, while, for, float, class, and return.

Program Build and Execution Environments

  • Compilation: The process of converting human-readable source code into machine-readable code that a computer CPU can execute.
    • Performed by a compiler ahead of time prior to program execution.
    • Crucial execution step for languages such as C, C++, and Java.
  • Runtime: The operational period during which an executable program runs on a system following launch by a user or another process.
    • Key Operations During Runtime:
    • Program interaction with system resources and end-users
    • Dynamic memory allocation and management
    • CPU execution of program instructions
  • Build Time: The phase during which a program is constructed from source code into an executable format by compilers, linkers, or build tools.
    • Key Operations During Build Time:
    • Translation of source code into machine code or intermediate code
    • Inclusion and resolution of external dependencies
    • Assembly of the final software binary or package
  • Integrated Development Environment (IDE): A comprehensive software application utilized by programmers to write and manage software development projects.
    • Incorporates code editors, debuggers, compilers, and auxiliary tools within a unified interface.
    • Popular IDEs:
    • Visual Studio Code: A lightweight code editor.
    • Visual Studio: Designed for languages such as C# and C++.
    • Eclipse: Designed for languages such as Java and C++.
    • PyCharm: Designed specifically for Python.

Web Development Paradigms: Frontend vs. Backend

  • Frontend Development: Client-side development of a website or web application's user interface (UI) and user experience (UX).
    • Focuses on layout, visual presentation, and interactive features directly accessed by users inside web browsers.
    • Three Core Frontend Languages:
    1. HTML (Hypertext Markup Language): Establishes web page content such as headings, paragraphs, links, and images.
    2. CSS (Cascading Style Sheets): Controls visual presentation and layout, including colors, spacing, and fonts.
    3. JavaScript: Provides dynamic, interactive client-side functionality.
  • Backend Development: Server-side development of a web application.
    • Focuses on server logic, database connections, APIs, and background processes powering website functionality.
    • Core Backend Languages: Python, Java, PHP, and Ruby.

User Interface (UI) and User Experience (UX) Design

  • UI Design (User Interface Design): Refers to the visual and interactive elements of a website or application that users interact with directly.
    • Core Components: Layout, typography, color schemes, icons and images, buttons, and hyperlinks.
  • UX Design (User Experience Design): Refers to the overall end-to-end experience and quality of interaction a user has with a digital product.
    • Core Components: Accessibility, performance speed, and aesthetic usability.

Historical Generations of Programming Languages

Programming languages serve as the cornerstone of software engineering. They have evolved through five distinct historical generations:

  • First Generation (1GL: 1940 – 1956): Machine Language
  • Second Generation (2GL: 1956 – 1963): Assembly Language
  • Third Generation (3GL: 1964 – 1971): High-Level Language
  • Fourth Generation (4GL: 1971 – Present): Object-Oriented Language
  • Fifth Generation (5GL: Present & Beyond): Artificial Intelligence

Language Abstraction Levels: Low-Level vs. High-Level

  • Low-Level Languages:
    • Positioned closer to machine hardware, offering granular control over underlying system architecture.
    • More difficult to master than high-level languages because they demand deep hardware and architectural comprehension.
    • Require manual memory management, which is error-prone and time-consuming.
    • Machine Language (1GL):
    • The only programming language directly understood by computer hardware.
    • Composed of binary digit sequences (00s and 11s) or hexadecimal codes corresponding to physical hardware states (on\text{on} and off\text{off}).
    • Assembly Language (2GL):
    • One step above machine code in abstraction.
    • Utilizes mnemonic codes and symbols to represent low-level hardware instructions and memory addresses.
    • Specific to particular computer architectures; requires thorough understanding of hardware.
  • High-Level Languages (3GL and Beyond):
    • Provide greater ease of use due to high abstraction levels.
    • Allow programmers to focus on application logic and software design rather than CPU architecture and memory allocation.
    • Examples: Java, C#, PHP, HTML, CSS, JavaScript.

Source Code Translation: Compilers vs. Interpreters

  • Compiler:
    • Translates high-level source code into lower-level target code, such as assembly code, object code, or machine code (00 and 11 bits).
    • Translates the entire codebase ahead of time before the program is executed.
  • Interpreter:
    • Translates and executes high-level source code line-by-line dynamically while the program is running.

Advanced Programming Paradigms: OOP and AI Logic Languages

  • Object-Oriented Programming (OOP / 4GL):
    • Represents a fourth-generation advance over procedural 3GL languages.
    • Models software programs as collections of discrete objects containing data and executable structures.
    • Components of Objects:
    • Attributes: Data elements attached to the object.
    • Methods: Operational functions and logic attached to the object.
    • Benefits: Objects can be reused within the same application or across distinct systems, making OOP ideal for scaling complex software.
  • Fifth-Generation Languages (5GL / AI Logic Programming):
    • Primarily utilized in artificial intelligence research.
    • Rather than instructing a computer step-by-step on what actions to take, 5GL logic languages express sets of facts and rules.
    • The computer evaluates these facts and rules to make decisions independently.
    • Examples of Logic Languages: Prolog, Absys, Datalog, Alma-0.

Human Logic and Program Logic Formulation

  • Human Intelligence in Problem-Solving: Intelligence is a distinguishing feature of human beings. Basic intelligence entails solving daily problems and devising multi-step strategies.
    • Example Scenario: When withdrawing cash from a bank, an individual checks their account balance and calculates how much to withdraw while retaining the mandatory minimum balance. This sequential decision-making process illustrates basic intelligence.
  • Application to Programming: Resolving computational problems requires humans to break down complex tasks into an ordered, explicit sequence of logical steps.

Five Foundational Elements of Programming

Every computer program consists of five basic functional operations:

  1. Input: Receiving data and commands into the computer system.
  2. Output: Transferring calculated results and information out of the computer system.
  3. Arithmetic: Performing mathematical operations on numerical data.
  4. Conditional: Evaluating expressions to check if a condition is True or False to guide program control flow.
  5. Looping: Iterating through a block of instructions continuously until a specified condition is met.

The Software Development Life Cycle (SDLC) / Programming Cycle

The programming cycle guides software development systematically through seven distinct phases:

  1. Problem Definition and Analysis

    • Objective: Fully understand the problem or requirement that software must solve.
    • Key Activities:
      • Gather user and technical requirements from stakeholders.
      • Define software scope and core goals.
      • Conduct feasibility and resource analyses.
    • Outcome: A detailed requirements document defining software functionality.
  2. Planning and Design

    • Objective: Build a structural blueprint illustrating how the system will satisfy requirements.
    • Key Activities:
      • Design software and system architecture.
      • Construct Data Flow Diagrams (DFDs), flowcharts, and technical models.
      • Define User Interface (UI) layouts and User Experience (UX) wireframes.
    • Outcome: Formal design documentation, including flowcharts, pseudocode, wireframes, and technical specifications.
  3. Coding

    • Objective: Translate design documentation into functional, executable code.
    • Key Activities:
      • Write source code using designated programming languages.
      • Implement business logic and algorithms designed in Phase 2.
      • Perform unit testing on individual components.
    • Outcome: A functional software application delivered in source code format.
  4. Testing

    • Objective: Verify that software is defect-free and satisfies all requirement specifications.
    • Key Activities:
      • Conduct Unit Testing, Integration Testing, System Testing, and Acceptance Testing.
      • Identify, track, and fix bugs.
      • Validate software performance across expected operational scenarios.
    • Outcome: A verified and validated software application ready for deployment.
  5. Documentation

    • Objective: Produce comprehensive informational resources for developers, administrators, and end-users.
    • Key Activities:
      • Write user manuals, help documentation, and technical reference guides.
      • Embed inline code comments and explanations within source files.
      • Create system maintenance and troubleshooting documentation.
    • Outcome: Exhaustive documentation supporting operation, maintenance, and future development.
  6. Deployment

    • Objective: Release the software build into the production environment for active user access.
    • Key Activities:
      • Configure production server infrastructure.
      • Install and deploy software binaries.
      • Conduct user onboarding and technical training sessions.
    • Outcome: Operational software deployed and active in production.
  7. Maintenance

    • Objective: Maintain software stability, functional relevance, and security over time.
    • Key Activities:
      • Monitor performance and resolve operational issues.
      • Issue software updates, security patches, and bug fixes.
      • Develop new features based on ongoing user feedback.
    • Outcome: A continuously maintained, stable, and upgraded software product.

Course References and Learning Materials

  • Online Learning References:
    • W3Schools Java Portal: https://www.w3schools.com/java/
    • JavaTpoint Java Tutorial: https://www.javatpoint.com/java-tutorial
    • GeeksforGeeks Java Section: https://www.geeksforgeeks.org/java/
    • Programiz Java Programming: https://www.programiz.com/java-programming
    • BYJU'S (Difference Between Hardware and Software): https://byjus.com/free-ias-prep/difference-between-hardware-and-software/
  • E-Books and Textbooks:
    • Starting Out with Java (6th Edition) by Tony Gaddis
    • Java Education Development Initiative (JEDI)