0Pricing
Mojo Academy · レッスン

パブリックAPIと構成

公開する要素を決めます

「パブリックAPIと構成」はCoddyKit上の無料Mojo Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMojo Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Mojo Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

What You Show Matters

A good library is judged by its surface. Deciding what to expose shapes how easy your API is to use. 🚪

Your Public API

The functions and types other code is meant to call form your public API. It is the promise you keep to users.

Internals Stay Hidden

Helper code that supports your API but is not meant for callers is internal. Hiding it keeps your surface small.

Smaller Surface, Less Risk

The fewer names you expose, the easier the library is to learn and the more freely you can change internals later.

Re-export From __init__

A package's __init__.mojo can import key names so users reach them straight from the package, not deep files.

from .core import add, subtract

A Clean Front Door

By gathering imports in __init__, you give callers one clear entry point instead of long, fragile module paths.

from mypkg import add

Hide the Layout

Users import from the package, not its files. That lets you rearrange inner modules without breaking their code.

Name Things Clearly

Public names should be self-explanatory. A clear, stable name is part of the contract you do not want to change.

Document the Surface

Add a docstring to each public function and type. Good docs tell callers how to use the API correctly.

fn add(a: Int, b: Int) -> Int:
    """Return the sum of a and b."""
    return a + b

Stable Promises

Treat your public API as a contract. Changing it can break users, so keep it small and think before you grow it.

Design From Outside In

Picture how a caller wants to use your library first, then build the internals to serve that clean experience. 🎨

Quick Check

Let us think about keeping an API easy to maintain.

Recap

Expose a small, clear public API, re-export key names in __init__, hide internals, and document what you share. 🎯

よくある質問

「パブリックAPIと構成」レッスンは無料ですか?

はい。「パブリックAPIと構成」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Mojo Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Mojo Academyコースには全4レッスンが含まれています。

「パブリックAPIと構成」で何を学びますか?

公開する要素を決めます ブラウザで直接実行するハンズオンコードでMojo Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Mojo Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのMojo Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「パブリックAPIと構成」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このMojo Academyレッスンでコードを書いて実行できますか?

はい。すべてのMojo Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. モジュールとインポート
  2. .mojopkgの構築
  3. パブリックAPIと構成
  4. プロジェクト構成のベストプラクティス
← Mojo Academyに戻る