Lessons

Crystal · Expert

Crystal · Expert. Ten lessons. Open-book quizzes. Lesson 1 free.

10 lessons · The Host · Lesson 1 free

Pass all ten lessons for the certificate. Sample · Claim

  1. Macro introspection: @type, instance_vars and code generation

    Lesson 1 · On the house

    Macro introspection: @type, instance_vars and code generation

    Read a type's own structure at compile time with @type and instance_vars, then generate methods from it with {% for %} and {% begin %}.

  2. Macro hooks: inherited, included, extended, method_missing, finished

    Lesson 2

    Macro hooks: inherited, included, extended, method_missing, finished

    Run code automatically when a class is subclassed, a module is mixed in, a missing method is called, or the program has finished parsing.

  3. Annotations: define, attach and read them in macros

    Lesson 3

    Annotations: define, attach and read them in macros

    Attach metadata to types, instance variables and methods with your own annotations, then read it in macros to generate code.

  4. JSON at scale: converters, strict mode, discriminators and the pull parser

    Lesson 4

    JSON at scale: converters, strict mode, discriminators and the pull parser

    Convert JSON values on the way in and out, reject unknown keys, decode polymorphic arrays, and stream large documents without building trees.

  5. Object protocols: to_s(io), inspect(io), equality, hash and clone

    Lesson 5

    Object protocols: to_s(io), inspect(io), equality, hash and clone

    Make your types print, compare, hash and copy correctly by overriding the IO-based protocol methods instead of building throwaway strings.

  6. Low-level memory: StaticArray, pointers, Slice and Bytes

    Lesson 6

    Low-level memory: StaticArray, pointers, Slice and Bytes

    Work below the safe collections: fixed stack arrays, pointers, byte slices, binary encoding and the real sizes of your types.

  7. C bindings: lib, fun, structs, out parameters and callbacks

    Lesson 7

    C bindings: lib, fun, structs, out parameters and callbacks

    Call C functions directly: declare them in a lib block, pass strings and buffers, return C structs, use out parameters and hand a callback to qsort.

  8. Compile-time versus run-time types, flags and constants

    Lesson 8

    Compile-time versus run-time types, flags and constants

    Tell the compile-time type apart from the run-time class, branch on build flags, compare compiler versions and fold constants before the program runs.

  9. Generics in depth: variance, Indexable(T) and generic inheritance

    Lesson 9

    Generics in depth: variance, Indexable(T) and generic inheritance

    Know how generic types relate to each other, build a full collection from two methods with Indexable(T), and subclass generic classes.

  10. API design: delegate, forward_missing_to, getter!, property? and visibility

    Lesson 10

    API design: delegate, forward_missing_to, getter!, property? and visibility

    Shape a clean public API: forward calls to a wrapped object, mark late-set fields, name boolean properties, and hide internals with protected and private.

Sample certificate

Certificate of completion

Sign in to claim your certificate of completion.

Certificate

Finish all ten lessons, then sign in

Pass every lesson on this device (quizzes and checks). Then sign in or create an account to type your name and download the JPG.

All lessons