작은 공개 API 설계
외부에 공개할 것과 내부에 유지할 것을 결정합니다
작은 공개 API 설계은(는) CoddyKit의 무료 Kotlin Multiplatform Academy 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Kotlin Multiplatform Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Kotlin Multiplatform Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
What a Public API Is
Your module's public API is the set of functions and types other code is allowed to call. It is the front door both apps walk through.
Small Surface Wins
A small surface area means fewer things to learn and fewer things to break. Expose only what callers truly need, nothing more. 🎯
Start From the Use Case
Design backwards: write the call site you wish you had first. Let that ideal usage shape what your public functions look like.
// Imagine this is how both apps will call you
val text = greeter.greet("Maya")Expose Intent, Hide Steps
A good API shows the intent and hides the steps. Callers say what they want, not how the work gets done inside.
Name Things Clearly
Clear names are half your API. A method called priceWithTax tells the whole story without any extra docs to read.
fun priceWithTax(base: Double, rate: Double): Double {
return base + base * rate
}Prefer Simple Inputs
Take plain, obvious inputs like strings and numbers. Simple parameters make your API easy to call from both Android and iOS.
Return Useful Types
Return shared data classes instead of loose values. A typed result is self-describing and far harder to misuse.
data class Quote(val total: Double, val currency: String)Hide the Helpers
Internal helpers and rough edges should stay private. Only the entry points a caller actually uses belong in the public API.
Easy to Add, Hard to Remove
Every public thing is a promise. It is easy to add new API later, but removing it can break callers, so expose less up front.
Stay Platform-Neutral
Keep the API platform-neutral. If a signature mentions Android or iOS types, it cannot serve both apps from shared code.
Design for the Reader
The best APIs read like a sentence at the call site. Optimize for the caller, not for whoever wrote the implementation.
Quick Check
Let's test your API design instincts.
Recap
A great public API is small, clearly named, and shaped by real use cases. Expose intent, hide steps, and both teams will love it. 🎉
자주 묻는 질문
“작은 공개 API 설계” 강의는 무료인가요?
네 — “작은 공개 API 설계” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Kotlin Multiplatform Academy 강의 전체를 잠금 해제할 수 있습니다. Kotlin Multiplatform Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
“작은 공개 API 설계”에서 뭘 배우나요?
외부에 공개할 것과 내부에 유지할 것을 결정합니다 브라우저에서 직접 실행하는 실습 코드로 Kotlin Multiplatform Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Kotlin Multiplatform Academy을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Kotlin Multiplatform Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.
“작은 공개 API 설계” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Kotlin Multiplatform Academy 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Kotlin Multiplatform Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 작은 공개 API 설계
- internal과 public 가시성
- 모듈 내부의 패키지 구성
- 두 팀을 위한 API 문서화