{
  "format": "ai-knowledge-map/tutorial-v1",
  "canonical": "https://ai-knowledge-map.com/en/software/ai-coding/coding-foundations/",
  "language": "en",
  "title": "Chapter 1 Traditional programming",
  "summary": "Follow five programming stages, from defining a problem and gathering information to designing, coding and checking results. Learn what environments, program structure, Git, testing and debugging do.",
  "questions": [
    {
      "question": "What stages are involved in completing a programming task?",
      "answer": "The five stages are defining the problem, gathering information, designing the method and structure, writing and running code, and checking and improving results.",
      "sections": [
        {
          "id": "coding-foundations-overview",
          "title": "The core stages of programming",
          "url": "https://ai-knowledge-map.com/en/software/ai-coding/coding-foundations/#coding-foundations-overview"
        }
      ]
    },
    {
      "question": "What problems do environments, program structure, Git, testing and debugging solve?",
      "answer": "The runtime executes code, program structure organizes logic, Git records versions, tests check results, and debugging helps locate errors.",
      "sections": [
        {
          "id": "coding-foundations-section-1",
          "title": "Important techniques at a glance",
          "url": "https://ai-knowledge-map.com/en/software/ai-coding/coding-foundations/#coding-foundations-section-1"
        }
      ]
    },
    {
      "question": "Which programming foundations should I understand before using AI coding tools?",
      "answer": "Understand how a task becomes a program, where it runs and how to check results. These foundations help you judge whether AI-assisted changes meet the goal.",
      "sections": [
        {
          "id": "coding-foundations-overview",
          "title": "The core stages of programming",
          "url": "https://ai-knowledge-map.com/en/software/ai-coding/coding-foundations/#coding-foundations-overview"
        },
        {
          "id": "coding-foundations-section-1",
          "title": "Important techniques at a glance",
          "url": "https://ai-knowledge-map.com/en/software/ai-coding/coding-foundations/#coding-foundations-section-1"
        }
      ]
    }
  ],
  "scope": "Summary and short answers are derived from the canonical chapter. Original source labels, setup details, version context and testing limitations are retained in the complete sections below. This is a public reading format, not an independent review or test result.",
  "sources": [],
  "sections": [
    {
      "id": "coding-foundations-overview",
      "title": "The core stages of programming",
      "url": "https://ai-knowledge-map.com/en/software/ai-coding/coding-foundations/#coding-foundations-overview",
      "html": "<p>Programming means expressing rules for processing information and performing actions in code, so that a computer can carry out a task. The task might be calculating statistics for a set of grades, processing images in batches, or making an interactive program. In this chapter, traditional programming means working primarily by organizing and writing the code yourself: a programmer analyzes the problem, designs the approach and code structure, uses tools to implement it, and then checks and revises the program based on what happens when it runs.</p>\n<p>This process has five core stages: clarify the problem; gather information; design the approach and program structure; write and run the program step by step; and verify results, locate errors and improve the program. You will move between these stages repeatedly. Running the program may reveal missing information, checking it may uncover unclear rules, and making a change may require adjusting the code structure.</p>\n<p>Along the way, you gradually learn techniques that support this work. Runtime environments and dependency management help make a program runnable. Functions and modules help organize code. Git saves versions and lets you compare them. Tests and logs help check behavior and find problems. Choose techniques to fit the task: when changing an existing project, you can start by reading its tests; when a program has a performance problem, measure and analyze it.</p>\n<p>The table below groups these techniques by stage. Short introductions follow. Start by understanding what problem each technique solves and what role it plays in programming.</p>\n<table class=\"d-table\"><thead><tr><th>Core stage</th><th>Important techniques</th></tr></thead><tbody><tr><td>Clarify the problem</td><td></td></tr><tr><td>Gather information</td><td>Read existing tests; runtime environments and language versions; package managers; dependency manifests and lockfiles; virtual environments; configuration files.</td></tr><tr><td>Design the approach and program structure</td><td>Conditions and loops; functions, parameters and return values; module boundaries and program interfaces; data cleaning; code comments and function documentation.</td></tr><tr><td>Write and run the program step by step</td><td>Code editors and IDEs; Git version control.</td></tr><tr><td>Verify results, locate errors and improve the program</td><td>Regression testing; debug output and logs; refactoring; performance profiling.</td></tr></tbody></table>"
    },
    {
      "id": "coding-foundations-section-1",
      "title": "Important techniques at a glance",
      "url": "https://ai-knowledge-map.com/en/software/ai-coding/coding-foundations/#coding-foundations-section-1",
      "html": "<p><strong>1 Read existing tests</strong></p>\n<p>Read the checks already written for a project to understand what they check, what inputs they use and what results they expect. Running them helps you find out whether the program currently meets its existing requirements. Existing tests can also miss things.</p>\n<p><strong>2 Runtime environments and language versions</strong></p>\n<p>A program needs a suitable software environment and language version to run. Checking these requirements helps prevent problems caused by version differences or missing components.</p>\n<p><strong>3 Package managers</strong></p>\n<p>Tools that install, update and remove code libraries. They also handle dependencies between libraries, reducing the work of finding and installing related components by hand.</p>\n<p><strong>4 Dependency manifests and lockfiles</strong></p>\n<p>A dependency manifest declares the libraries a project needs and the version ranges it allows. A lockfile records the specific dependency versions resolved by the tool. Together, they help recreate the required dependencies at another time or on another device.</p>\n<p><strong>5 Virtual environments</strong></p>\n<p>A virtual environment isolates a project&#39;s dependencies. Different projects can use different versions of a library, reducing the chance that installing or updating something for one project will affect another.</p>\n<p><strong>6 Configuration files</strong></p>\n<p>Files that keep program settings in one place, such as file locations, processing options and operating modes. The program reads these settings as it works. Changing the configuration lets a user adjust the corresponding behavior.</p>\n<p><strong>7 Conditions and loops</strong></p>\n<p>Conditions let a program choose an action based on the situation, such as deciding whether a grade is a passing grade. Loops repeat a process, such as checking each grade in a set.</p>\n<p><strong>8 Functions, parameters and return values</strong></p>\n<p>A function organizes a piece of work into code that can be called. Parameters carry information into the function, and a return value is the result it sends back. These help break a task into smaller parts and reuse an implementation.</p>\n<p><strong>9 Module boundaries and program interfaces</strong></p>\n<p>Modules group related code together. Interfaces define how parts call one another, what they receive and what they produce. Clear responsibilities and connections make a program easier to understand and change.</p>\n<p><strong>10 Data cleaning</strong></p>\n<p>Check and handle missing, duplicate, inconsistently formatted or invalid data so that later processing can use data that meets the task&#39;s requirements. Whether to correct, fill in, flag or exclude something depends on the task&#39;s rules.</p>\n<p><strong>11 Code comments and function documentation</strong></p>\n<p>Explain the purpose of nearby code, any necessary reasoning and how to use it. Function documentation can also explain parameters, return values and limitations, helping you and others understand the code.</p>\n<p><strong>12 Code editors and IDEs</strong></p>\n<p>A code editor is used to write and change code. An IDE, or integrated development environment, usually also brings together tools for running programs, navigating code and managing projects, so you can perform several programming tasks in one place.</p>\n<p><strong>13 Git version control</strong></p>\n<p>Check file status and differences, select a set of changes, and save them as a commit with a description. Earlier versions, diffs and commit messages help explain how the code developed and which change introduced a problem. You can also compare versions, undo changes or restore saved content, giving you a way back as you continue working.</p>\n<p><strong>14 Regression testing</strong></p>\n<p>After changing a program, check its existing features and previously fixed problems again to make sure the change has not broken them. Keep important checks so you can repeat them after later changes.</p>\n<p><strong>15 Debug output and logs</strong></p>\n<p>Record which part of the program ran, what it processed and what intermediate results it produced. This makes the execution easier to observe and helps locate problems. Temporary output is useful for immediate inspection; logs support ongoing recording, filtering and later investigation.</p>\n<p><strong>16 Refactoring</strong></p>\n<p>Adjust the code structure while preserving its expected behavior, for example by splitting an overly long function or reducing duplicate implementations. Check the program after refactoring to make sure the restructuring has not broken existing features.</p>\n<p><strong>17 Performance profiling</strong></p>\n<p>Measure execution time, memory use and other resource consumption to find actual bottlenecks before deciding how to optimize. The task&#39;s performance requirements should determine whether optimization is needed and what it should achieve.</p>"
    }
  ]
}
