IT231 IT and Applications

IT and ApplicationsUnit 412 min read

Programming & Software Development: Languages, Tools & Lifecycle

Unit 4 of IT and Applications covers programming language types (procedural, OOP, scripting), software development methodologies (waterfall, agile), and real-world applications in Nepalese tech (eSewa’s payment systems, Daraz’s order queues). Includes syntax examples, lifecycle diagrams, and security considerations for

TAKEAWAYS:

  • Programming languages are classified by generation (1GL–4GL) and paradigm (procedural vs. object-oriented), with syntax rules dictating how code is written and executed.
  • Software development follows structured methodologies (waterfall, agile, spiral) that balance cost, time, and quality—critical for projects like Ncell’s app updates.
  • Debugging tools (e.g., IDEs like PyCharm) and version control (Git) are essential for collaborative development, as used by open-source teams behind Linux or Kathmandu’s traffic management systems.
  • Algorithms (step-by-step problem-solving logic) and flowcharts map real-world processes like Daraz’s order fulfillment or NTC’s network routing.
  • Security in programming (input validation, encryption) protects systems like eSewa’s transactions from SQL injection or data breaches.
  • Software lifecycle models (e.g., waterfall vs. agile) determine project success—agile’s iterative approach fits startups like Pathao, while waterfall suits regulated systems like NEPSE’s trading platforms.

1. Programming Languages: Types, Syntax, and Applications

Programming languages are the instructions computers follow to perform tasks. They vary by generation (1GL to 4GL) and paradigm (procedural, object-oriented, scripting). Nepal’s tech sector uses these in apps like eSewa (Python for backend APIs) and Khalti (JavaScript for frontend).

1.1 Classification by Generation

Generation Language Examples Key Feature Real-World Use in Nepal
1GL Machine Code (Binary) Direct CPU instructions (0s and 1s) Used in embedded systems (e.g., NTC’s routers)
2GL Assembly (e.g., x86) Mnemonic codes (e.g., MOV, ADD) Legacy banking systems (e.g., NMB’s core servers)
3GL C, Java, Python High-level syntax (variables, loops) eSewa’s payment gateway (Python), Daraz’s backend (Java)
4GL SQL, MATLAB Focus on problem-solving (e.g., queries) NEPSE’s stock data analysis (SQL)

1.2 Classification by Paradigm

Programming paradigms define how problems are solved. Nepal’s software industry uses:

  • Procedural: Step-by-step instructions (e.g., C in NTC’s network scripts).
  • Object-Oriented (OOP): Data + methods as "objects" (e.g., Java in Khalti’s user profiles).
  • Scripting: Lightweight tasks (e.g., Python in Pathao’s ride-matching logic).
classDiagram
    class Procedural {
        +Functions as subroutines
        +Top-down execution
        +Example: C (NTC scripts)
    }
    class OOP {
        +Objects (data + methods)
        +Inheritance, polymorphism
        +Example: Java (Khalti app)
    }
    class Scripting {
        +Interpreted, dynamic
        +Example: Python (eSewa APIs)
    }
    Procedural --> "Uses" Scripting : "For automation"
    OOP --> "Extends" Procedural : "Modularity"

Worked Example: Calculating Loan Interest (Nepal’s Banks) Banks like NMB use procedural programming (C/C++) to calculate compound interest for loans. Here’s a Python snippet (3GL, procedural) for monthly interest:

principal = 100000  # Loan amount
rate = 0.08 / 12     # 8% annual, monthly
months = 12
for i in range(months):
    interest = principal * rate
    print(f"Month {i+1} Interest: {interest:.2f}")

Output:

Month 1 Interest: 666.67
Month 2 Interest: 666.67  # (Assuming fixed principal for simplicity)

Real-World Tie: NMB’s loan systems use similar logic but with OOP (Java/C#) to handle thousands of users simultaneously.


2. Software Development Methodologies

Methodologies are frameworks to plan, develop, and maintain software. Nepal’s tech companies choose based on project needs:

  • Waterfall: Linear, phase-by-phase (used in NEPSE’s trading system for regulatory compliance).
  • Agile: Iterative, flexible (used by Pathao for rapid app updates).
  • Spiral: Risk-driven (used in NTC’s network upgrades).

2.1 Waterfall Model

flowchart TD
    A["Requirements"] --> B["Design"]
    B --> C["Implementation"]
    C --> D["Testing"]
    D --> E["Deployment"]
    E --> F["Maintenance"]

Pros/Cons:

Pros Cons
Clear milestones Inflexible (changes hard)
Good for small, stable projects Late testing can miss errors
Used in: NEPSE’s trading rules Avoid for: Pathao’s dynamic features

Worked Example: NTC’s Network Upgrade NTC uses waterfall for its fiber-optic expansion in Kathmandu:

  1. Requirements: Cover 50 new wards.
  2. Design: Map existing cables (see below).
  3. Implementation: Lay cables in phases.
  4. Testing: Check bandwidth in each ward.
  5. Deployment: Roll out to users.

2.2 Agile Methodology

Agile breaks projects into sprints (2–4 weeks). Pathao uses it to:

  • Release new features (e.g., "Cash on Delivery") every 3 weeks.
  • Gather user feedback (e.g., rider complaints) to prioritize fixes.
flowchart LR
    A["Backlog"] --> B["Sprint 1<br/>2 weeks"]
    B --> C{"Review<br/>Retrospective"}
    C -->|"Improvements"| D["Sprint 2"]
    D --> E["Release<br/>e.g., New Payment Gateway"]

Pros/Cons:

Pros Cons
Flexible to changes Requires active stakeholder input
Early testing reduces risks Documentation can lag
Used in: Pathao, Daraz Avoid for: NEPSE’s audited systems

3. Software Development Lifecycle (SDLC)

SDLC is the process from idea to maintenance. Nepal’s eSewa follows:

  1. Planning: Define scope (e.g., "Add UPI payments").
  2. Analysis: Study user needs (e.g., 80% users want UPI).
  3. Design: Create system architecture (see below).
  4. Implementation: Write code (Python for APIs).
  5. Testing: QA checks for bugs (e.g., failed transactions).
  6. Deployment: Roll out to 10% users first.
  7. Maintenance: Fix issues (e.g., UPI downtime during Diwali).

3.1 Phases Explained

Phase Activity Nepal Example
Planning Budget, timeline, resources eSewa allocates ₹5M for UPI integration
Analysis User stories, requirements Survey shows 60% users want UPI
Design UI/UX, database schema Wireframes for UPI PIN entry screen
Implementation Coding (Python/Java) Backend API to connect to NPCI (India)
Testing Unit, integration, user testing Test with 50 beta users before launch
Deployment Rollout to production Gradual release to 5 districts first
Maintenance Bug fixes, updates Patch for Diwali transaction spikes

4. Algorithms and Flowcharts

Algorithms are step-by-step instructions to solve problems. Nepal’s Daraz uses them for:

  • Order processing: Prioritize same-day deliveries.
  • Inventory management: Alert when stock is low.

4.1 Example: Daraz’s Delivery Priority Algorithm

flowchart TD
    A["Start"] --> B{"Order Time<br/>Before 2 PM?"}
    B -->|"Yes"| C["Label 'Same-Day'"]
    B -->|"No"| D["Label 'Next-Day'"]
    C --> E["Notify Rider"]
    D --> F["Schedule for Tomorrow"]

Worked Example: Kathmandu Traffic Route Optimization The Kathmandu Metropolitan City uses algorithms to:

  1. Collect data: Traffic cameras at 10 intersections.
  2. Analyze: Identify bottlenecks (e.g., Thapathali junction).
  3. Optimize: Adjust signal timings dynamically.

5. Debugging and Tools

Debugging finds and fixes errors (bugs) in code. Nepal’s developers use:

  • IDE Tools: PyCharm (Python), Eclipse (Java).
  • Version Control: Git (used by Ncell’s app team).
  • Testing Frameworks: JUnit (Java), Pytest (Python).

5.1 Common Errors and Fixes

Error Type Example Fix Nepal Example
Syntax Error Missing ; in Java Add semicolon Khalti’s Java backend crashes
Logic Error Loan calculator gives wrong interest Rewrite formula NMB’s interest miscalculation
Runtime Error Division by zero Add input validation eSewa’s API fails on invalid UPI ID
Semantic Error Wrong sorting order Review algorithm Daraz’s product search returns wrong results

6. Security in Programming

Security prevents unauthorized access or data breaches. Nepal’s eSewa and Khalti use:

  • Input Validation: Reject SQL injection attempts.
  • Encryption: Secure transactions (AES-256).
  • Access Control: Role-based permissions (e.g., admin vs. user).

Worked Example: SQL Injection Attack Prevention Vulnerable Code (Python with SQL):

user_input = "admin' --"
query = f"SELECT * FROM users WHERE username = '{user_input}'"

Attack: Bypasses login by commenting out the password check. Fix (Parameterized Query):

import sqlite3
conn = sqlite3.connect("database.db")
cursor = conn.cursor()
cursor.execute("SELECT * FROM users WHERE username = ?", (user_input,))

7. Real-World Applications in Nepal

Company/App Technology Used How This Unit Applies
eSewa Python (Django), PostgreSQL OOP for user profiles, SDLC for updates
Khalti JavaScript (React), Node.js Agile sprints for new payment methods
Daraz Java, Spring Boot Algorithms for order routing, waterfall for stable features
Ncell Kotlin (Android), Git Version control for app updates, debugging for crashes
NTC C (Network scripts), Waterfall Procedural programming for router configurations
NEPSE SQL, Waterfall Database queries for stock data, strict testing
Pathao Python (Backend), Agile Real-time ride-matching algorithms, iterative updates

Exam Tip

  1. Define Clearly:

    • "Programming language" = Set of instructions + syntax to write software.
    • "Software" = Programs + documentation (e.g., eSewa’s app + user guide).
  2. Compare Methodologies:

    • Waterfall = Sequential (use for NEPSE).
    • Agile = Iterative (use for Pathao).
    • Spiral = Risk-focused (use for NTC upgrades).
  3. Code Snippets:

    • Always show one example (e.g., Python for interest calculation).
    • Highlight keywords (e.g., for, if, def).
  4. Flowcharts:

    • Draw one per question (e.g., Daraz’s order priority).
    • Label all steps clearly.
  5. Security:

    • Mention input validation and encryption for payment systems (eSewa/Khalti).
    • Example: "SQL injection can be prevented using parameterized queries."
  6. Real-World Links:

    • Tie every concept to a Nepalese company:
      • OOP → Khalti’s user profiles.
      • Agile → Pathao’s weekly updates.
      • Algorithms → Daraz’s delivery routing.

Final Checklist for Full Marks: ✅ Definitions (programming language, SDLC phases). ✅ Classifications (generations, paradigms, methodologies). ✅ Worked Examples (loan interest, Daraz algorithm, SQL injection fix). ✅ Visuals (4+ diagrams: generations table, waterfall flowchart, eSewa architecture, traffic signals). ✅ Nepalese Context (eSewa, Khalti, Daraz, NTC, NEPSE). ✅ Exam Tips (compare methodologies, show code snippets, link to real systems).

Based on the TU BBM syllabus for IT and Applications (IT231), unit 4.

Discussion

Loading…