f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
186 lines
5.7 KiB
Markdown
186 lines
5.7 KiB
Markdown
---
|
|
id: wiki-2026-0508-introduction-to-programming
|
|
title: Introduction to Programming
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [Programming 101, Learn to Code, AI-augmented Programming Intro]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.9
|
|
verification_status: applied
|
|
tags: [programming, education, fundamentals, ai-pair-programming, learning]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: python
|
|
framework: cli
|
|
---
|
|
|
|
# Introduction to Programming
|
|
|
|
## 매 한 줄
|
|
> **"매 코딩 입문은 변수에서 시작해 함수에서 끝나지 않는다 — 2026 은 LLM 과 함께 추론하는 법을 배운다"**. 변수/제어흐름/함수/자료구조의 고전적 fundamentals 위에, 버전관리/테스트/AI pair programming/디버깅 워크플로가 입문 커리큘럼의 핵심 축이 되었다.
|
|
|
|
## 매 핵심
|
|
|
|
### 매 입문 6 축
|
|
1. **표현 (expressions)**: 값, 타입, 연산자.
|
|
2. **상태 (state)**: 변수, 가변/불변.
|
|
3. **제어 (control)**: if, for, while, match, 예외.
|
|
4. **추상 (abstraction)**: 함수, 모듈, 클래스.
|
|
5. **자료구조 (data)**: list/dict/set, immutable, IO.
|
|
6. **메타 (meta)**: VCS, 테스트, 디버깅, AI 페어.
|
|
|
|
### 매 2026 추천 첫 언어
|
|
- **Python**: 가장 친화적, ML/스크립트/웹 모두.
|
|
- **JavaScript/TypeScript**: 웹 즉시, browser console 실행.
|
|
- **Go**: 단순 + 컴파일 + 동시성 입문.
|
|
- **Rust**: 시스템 + 안전 — 입문 두 번째 언어로 추천.
|
|
|
|
### 매 학습 워크플로 (현대)
|
|
- VS Code + Copilot/Cursor → 코드 작성.
|
|
- Git + GitHub → 첫날부터 commit.
|
|
- pytest / vitest → 첫 함수부터 테스트.
|
|
- LLM chat → 개념 설명 / rubber duck / 디버깅 도우미.
|
|
- 작은 project (≤ 100 LOC) → 매주 1 개.
|
|
|
|
### 매 응용
|
|
1. CLI 도구 (파일 정리, API 호출).
|
|
2. 웹 스크래퍼 / 자동화.
|
|
3. 간단 웹앱 (Flask/FastAPI/Next.js).
|
|
4. 데이터 분석 (pandas, polars).
|
|
|
|
## 💻 패턴
|
|
|
|
### 1. Hello, World + 입출력 (Python)
|
|
```python
|
|
name = input("이름? ")
|
|
print(f"안녕, {name}!")
|
|
```
|
|
|
|
### 2. 변수, 타입, 캐스팅
|
|
```python
|
|
age_str = "30"
|
|
age = int(age_str) # str -> int
|
|
ratio = age / 7 # int / int -> float
|
|
print(type(age), type(ratio)) # <class 'int'> <class 'float'>
|
|
```
|
|
|
|
### 3. 제어 흐름 (match)
|
|
```python
|
|
def grade(score: int) -> str:
|
|
match score:
|
|
case s if s >= 90: return "A"
|
|
case s if s >= 80: return "B"
|
|
case s if s >= 70: return "C"
|
|
case _: return "F"
|
|
```
|
|
|
|
### 4. 함수 + 타입힌트 + 독스트링
|
|
```python
|
|
def average(nums: list[float]) -> float:
|
|
"""nums 평균을 반환. 빈 리스트면 0.0."""
|
|
if not nums:
|
|
return 0.0
|
|
return sum(nums) / len(nums)
|
|
```
|
|
|
|
### 5. list / dict / comprehension
|
|
```python
|
|
words = ["apple", "banana", "cherry"]
|
|
upper = [w.upper() for w in words if "a" in w]
|
|
counts = {w: len(w) for w in words}
|
|
unique_letters = {c for w in words for c in w}
|
|
```
|
|
|
|
### 6. 파일 IO + with
|
|
```python
|
|
from pathlib import Path
|
|
path = Path("notes.txt")
|
|
path.write_text("hello\nworld\n", encoding="utf-8")
|
|
for line in path.read_text(encoding="utf-8").splitlines():
|
|
print(">>", line)
|
|
```
|
|
|
|
### 7. 첫 테스트 (pytest)
|
|
```python
|
|
# test_average.py
|
|
from solution import average
|
|
def test_empty(): assert average([]) == 0.0
|
|
def test_basic(): assert average([1, 2, 3]) == 2.0
|
|
def test_floats(): assert abs(average([0.1, 0.2]) - 0.15) < 1e-9
|
|
```
|
|
```bash
|
|
pip install pytest && pytest -q
|
|
```
|
|
|
|
### 8. Git 첫 사이클
|
|
```bash
|
|
git init
|
|
git add .
|
|
git commit -m "feat: hello world"
|
|
git branch -M main
|
|
gh repo create my-first --public --source=. --push
|
|
```
|
|
|
|
### 9. CLI 만들기 (argparse)
|
|
```python
|
|
import argparse
|
|
def main():
|
|
p = argparse.ArgumentParser()
|
|
p.add_argument("name")
|
|
p.add_argument("--shout", action="store_true")
|
|
args = p.parse_args()
|
|
msg = f"hello, {args.name}"
|
|
print(msg.upper() if args.shout else msg)
|
|
if __name__ == "__main__":
|
|
main()
|
|
```
|
|
|
|
### 10. AI pair-programming workflow (.cursorrules / 사람 측)
|
|
```markdown
|
|
# 학습용 rules
|
|
- 새 개념은 먼저 설명 요청 → 코드는 그 다음
|
|
- LLM 이 준 코드는 한 줄씩 읽고 주석 직접 달기
|
|
- 막히면 rubber-duck 질문 형식으로 정리 후 LLM 에게
|
|
- 매 PR 단위 작은 commit, 메시지는 conventional
|
|
```
|
|
|
|
## 매 결정 기준
|
|
| 상황 | Approach |
|
|
|---|---|
|
|
| 0 base, 빠른 결과 원함 | Python + Replit/Cursor |
|
|
| 웹 즉시 보고 싶음 | JavaScript + browser devtools |
|
|
| 시스템 / 성능 흥미 | Go 또는 Rust |
|
|
| ML 지향 | Python + Jupyter |
|
|
| 게임/모바일 | C# (Unity) 또는 Swift/Kotlin |
|
|
|
|
**기본값**: 입문 1 개월 = Python + Git + pytest + Cursor/Copilot, 1주 1 mini-project.
|
|
|
|
## 🔗 Graph
|
|
- 응용: [[Data-Analysis]]
|
|
- Adjacent: [[Debugging]] · [[Pair-Programming]]
|
|
|
|
## 🤖 LLM 활용
|
|
**언제**: 개념 설명 (다양한 비유), 에러메시지 해석, rubber-duck 질문 정리, 작은 단위 코드 리뷰, 학습 로드맵 생성.
|
|
**언제 X**: 답을 그대로 복붙 — 학습 효과 0. 반드시 한 줄씩 이해하고 직접 재작성.
|
|
|
|
## ❌ 안티패턴
|
|
- **튜토리얼 hell**: 코스만 보고 코드 안 짬 — 매주 1 작은 프로젝트가 필수.
|
|
- **버전관리 미사용**: 손실 위험 + 협업 불가 — Day 1 부터 git.
|
|
- **테스트는 나중에**: 첫 함수부터 1 테스트.
|
|
- **AI 답 복붙**: 본인이 못 설명하면 commit 금지.
|
|
- **너무 큰 첫 프로젝트**: ≤ 100 LOC scope, 점진 확장.
|
|
|
|
## 🧪 검증 / 중복
|
|
- Verified (Python docs 3.13, MDN JS Guide, Software Carpentry curriculum 2026).
|
|
- 신뢰도 A.
|
|
|
|
## 🕓 Changelog
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | Manual cleanup — fundamentals + AI 페어 워크플로 패턴 |
|