- Business Logic** = “What your app DOES”
- The rules and processes of your application
- What makes your app unique and valuable
- Would be the same regardless of where you store data (file, database, memory)
- Storage Logic = “HOW data is saved/loaded”
- Technical details of reading/writing data
- File operations, database queries, serialization
- Could be replaced with different storage methods
Ask yourself:
- “Would this code change if I switched from files to a database?”
- If YES → Storage Logic
- If NO → Business Logic
- “Is this about the rules of my application or about saving data?”
- Rules → Business Logic
- Saving → Storage Logic
Keywords that hint at Storage Logic:
FileInputStream
,ObjectOutputStream
saveAll()
,getUsers()
,readFromFile()
- File paths, serialization, I/O operations
Keywords that hint at Business Logic:
- Validation (
if name is empty
) - Business rules (
user can only join once
) - Calculations (
calculate user score
) - Workflows (
send notification after update
)
과제의 저장 로직
-
saveAll
-
getChannels/getUsers/getMessages
-
구조 정리
- Service
- Repository