Files
Final/CLASS_DIAGRAM.md

98 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Диаграмма классов Universal Git Analyzer OOP
## Основные классы
```text
UniversalGitAnalyzerApp
├── storage: StorageManager
├── git_analyzer: GitAnalyzer
├── current_user
├── current_repo
├── current_index
└── current_data
StorageManager
├── data_file
├── register_user(login, password)
├── check_user(login, password)
├── get_repositories(login)
├── add_repository(login, link)
└── delete_repository(login, link)
UserProfile
├── login
├── password_hash
├── repositories
└── to_dict()
GitAnalyzer
├── languages
├── ignore_dirs
├── normalize_link(link)
├── clone_repo(link)
├── get_commits(repo_dir)
├── get_visible_branches_at_commit(repo_dir, selected_commit)
├── analyze_files_for_branches(repo_dir, selected_commit)
├── analyze_repository(link, selected_index)
└── format_analysis(data)
RepositoryInfo
├── link
├── repo_name
├── default_branch
├── branches
├── commits
├── total_files
└── total_lines
CommitInfo
├── hash
├── short
├── author
├── date
├── timestamp
└── message
BranchInfo
├── name
├── ref
├── total_files
└── total_lines
```
## Связи
```text
UniversalGitAnalyzerApp --> StorageManager
UniversalGitAnalyzerApp --> GitAnalyzer
StorageManager --> UserProfile
GitAnalyzer --> RepositoryInfo
RepositoryInfo --> CommitInfo
RepositoryInfo --> BranchInfo
```
## Объекты системы во время работы
Пример объектов, которые появляются при запуске:
```text
app = UniversalGitAnalyzerApp()
storage = StorageManager()
git_analyzer = GitAnalyzer()
user = UserProfile("egor", password_hash, repositories)
repository = RepositoryInfo(link, repo_name, default_branch, branches, commits)
commit = CommitInfo(hash, short, author, date, timestamp, message)
branch = BranchInfo(name, ref, total_files, total_lines)
```
## Что сказать на защите
В OOP-версии приложение разделено на классы:
- `UniversalGitAnalyzerApp` отвечает за интерфейс.
- `StorageManager` отвечает за локальное хранение пользователей и ссылок.
- `GitAnalyzer` отвечает за анализ Git-репозитория.
- `UserProfile`, `RepositoryInfo`, `CommitInfo`, `BranchInfo` являются объектами предметной области.
То есть система теперь представлена не набором отдельных функций, а объектами, у каждого из которых есть своя зона ответственности.