Programming Concepts and Software Development Process

Overview of Programming

  • Definition of a Computer
    • A device that processes data, performs computations, and executes logical operations.
    • Operates under program instructions without human intervention.

Programming Language

  • Definition: A structured format of symbols allowing programmers to direct a computer in performing predefined tasks.
  • Purpose: A powerful tool used for building programs and software.

Advantages of Programming Languages

  • Speed: Programs execute faster than manual operations.
  • Adaptability: More flexible in adapting to various systems.
  • Human-Like Syntax: Some languages resemble human language, facilitating understanding.

Characteristics of a Quality Program

  1. Readability

    • Should be understandable, including adequate comments and documentation.
    • Use conventions for variable naming and code indentation.
  2. Modularity

    • Divide problems into sub-problems for logical assembly and resolution.
  3. Efficiency

    • Operate faster with smaller program sizes.
  4. Robustness

    • Capable of handling unexpected situations gracefully without crashing or entering infinite loops.
  5. Usability

    • Correctness and compliance with end-user requirements.

Types of Programming

Procedural/Structured versus Object-Oriented Programming

  • Procedural Programming

    • Uses global data and functions.
    • Structure:
    • Functions operate on global data.
  • Object-Oriented Programming

    • Encapsulates data in objects with related functions.
    • Structure:
    • Local data with related functions associated with objects.

Program Planning and Design

  • Critical stages in addressing programming problems:
    1. Analysis: Defining the problem and specifying requirements.
    2. Designing solutions: Developing the outline of your solution.
    3. Coding: Writing the program with proper documentation.
    4. Testing: Ensuring the program functions as intended.
    5. Maintenance: Updating and fixing issues over time.

Steps to Problem-Solving

  1. Specify Program Requirements
  2. Analyze the Problem
  3. Select Overall Solution
  4. Design Algorithms
  5. Write the Program (Coding)
  6. Test the Program
  7. Maintain the Program

Algorithms

  • Definition: Sequence of steps necessary to solve a problem.

Presentation of Algorithms

  • Structure Chart

    • Breakdown of modules needed to solve a problem.
  • Pseudo-codes

    • Semi-formal, English-like representation aiding program logic construction.
    • Advantages: simplicity and effectiveness.
  • Flow-charts

    • Graphical depiction using symbols and shapes to convey process sequences and algorithms.

Flow-charting Symbols

  • Types of symbols used in flow charts:
    • Terminator: Start/End points.
    • Process: Instructions and computations.
    • Decision: Branching points.
    • Connectors: Link different parts of flowcharts.
    • Input/Output: Data in/out points.
    • Loop: Repeating processes.
    • Direction of Flow: Arrows indicating the flow direction.

Example: Flow-chart

  1. Start
  2. Read Inputs: price and quantity sold.
  3. Calculate: Sales = Price x Quantity
  4. Display: Sales amount.
  5. End

Sample Coding Example

package testingl;
import java.util.Scanner;

public class CalculateSales {
    public static void main(String[] args) {
        double price, sales;
        int quantity;
        Scanner input = new Scanner(System.in);
        System.out.print("Enter price: ");
        price = input.nextDouble();
        System.out.print("Enter quantity: ");
        quantity = input.nextInt();
        sales = price * quantity;
        System.out.print("Amount of sales is: " + sales);
    }
}

Software Development Process

  1. Requirements Specification: Understanding and documenting detailed software needs through user-designer interaction.
  2. System Analysis: Analyzing data flow for the system's input/output and modeling behavior.
  3. System Design: Decomposing problems into manageable components and clarifying relationships between classes and interfaces.
  4. Input Process Output (IPO): Essential analysis and design framework focused on input, process, output.
  5. Implementation: Translating designs into programs, writing for each component, and integrating.
  6. Testing: Validating the code against requirements, typically performed by an independent team.
  7. Deployment: Making the software available for use post-testing, such as installation.
  8. Maintenance: Ongoing updates and improvements to ensure the product's effectiveness in a changing environment.