Loading...
Loading...
Compare original and translation side by side
TeamCreateTeamCreatemodules/core/services/modules/core/interfaces/modules/core/modules/core/services/modules/core/interfaces/modules/core/| Layer | Location | Max Lines |
|---|---|---|
| Controllers | | 50 |
| Services | | 100 |
| Repositories | | 100 |
| Interfaces | | 30 |
| Models/DTOs | | 50 |
| Shared | | - |
src/modules/[feature]/| 层级 | 位置 | 最大行数 |
|---|---|---|
| 控制器 | | 50 |
| 服务 | | 100 |
| 仓库 | | 100 |
| 接口 | | 30 |
| 模型/DTO | | 50 |
| 共享代码 | | - |
src/modules/[feature]/| Rule | Value |
|---|---|
| File limit | 100 lines (split at 90) |
| Controllers | < 50 lines, delegate to services |
| Interfaces | |
| Javadoc | Every public method documented |
| Records | Use for DTOs (Java 16+) |
| Sealed | Use for restricted hierarchies (Java 17+) |
| 规则 | 要求 |
|---|---|
| 文件行数限制 | 100行(90行时拆分) |
| 控制器 | <50行,委托给服务处理 |
| 接口 | 仅允许放在 |
| Javadoc | 每个公共方法都必须编写文档 |
| Records | 用于DTO(Java 16+) |
| Sealed | 用于受限层级结构(Java 17+) |
| Topic | Reference | When to consult |
|---|---|---|
| SOLID Overview | solid-principles.md | Quick reference |
| SRP | single-responsibility.md | Fat classes |
| OCP | open-closed.md | Adding providers |
| LSP | liskov-substitution.md | Contracts |
| ISP | interface-segregation.md | Fat interfaces |
| DIP | dependency-inversion.md | Injection |
| Architecture | architecture-patterns.md | Modular patterns |
| 主题 | 参考文档 | 查阅时机 |
|---|---|---|
| SOLID总览 | solid-principles.md | 快速参考 |
| 单一职责原则(SRP) | single-responsibility.md | 处理臃肿类时 |
| 开闭原则(OCP) | open-closed.md | 添加提供者时 |
| 里氏替换原则(LSP) | liskov-substitution.md | 处理契约时 |
| 接口隔离原则(ISP) | interface-segregation.md | 处理臃肿接口时 |
| 依赖倒置原则(DIP) | dependency-inversion.md | 处理注入时 |
| 架构 | architecture-patterns.md | 处理模块化模式时 |
| Template | When to use |
|---|---|
| module.md | Feature module structure |
| service.md | Business logic service |
| interface.md | Contract definition |
| repository.md | Data access layer |
| error.md | Custom exceptions |
| test.md | Unit tests with mocks |
| 模板 | 使用场景 |
|---|---|
| module.md | 功能模块结构 |
| service.md | 业务逻辑服务 |
| interface.md | 契约定义 |
| repository.md | 数据访问层 |
| error.md | 自定义异常 |
| test.md | 带Mock的单元测试 |
| Anti-Pattern | Fix |
|---|---|
| Files > 100 lines | Split at 90 |
| Interfaces in impl files | Move to |
| Use dependency injection |
Flat | Use |
| God classes | Split by responsibility |
| 反模式 | 修复方案 |
|---|---|
| 文件行数>100行 | 在90行时拆分 |
| 接口放在实现文件中 | 移至 |
服务中使用 | 使用依赖注入 |
扁平的 | 使用 |
| 上帝类 | 按职责拆分 |