CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • Separation of responsibilities

    Kotlin SELF
    Level 39, Lesson 0
    We break down how to stop turning main into a “command centre” and split a console application into three layers: CLI (I/O and command parsing), domain (rules and checks via require), and storage (data persistence). Using expense tracking as an example, we build the Expense model, storage, and service, add a command parser, show the data flow (mermaid), and cover typical mistakes that make layer boundaries “bleed” into each other.
    Available
  • How to lock architecture into the project structure

    Kotlin SELF
    Level 39, Lesson 1
    We break down how to “bake” architecture into packages and directories in a Kotlin project: why it’s worth syncing package with the folder structure, how to use import as an indicator of broken boundaries, how to split responsibility by layers ( app.cli, domain.model, domain.service, storage), how to fix the dependency direction, and how not to turn utils into a “junk drawer.” There’s a diagram in mermaid, a practical file layout, and a review of common mistakes.
    Available
  • Interfaces as API Boundaries

    Kotlin SELF
    Level 39, Lesson 2
    We’ll break down how to design interfaces in Kotlin as boundaries between layers: why the contract should be “narrow”, how to separate domain rules from storage via ExpenseRepository, how to move report formatting into ReportExporter, why to return List instead of MutableList, when to take a snapshot via toList(), and how the CLI wires dependencies via constructor injection without mixing roles ( println stays in the CLI).
    Available
  • Refactoring in small steps

    Kotlin SELF
    Level 39, Lesson 3
    We go through a practical refactoring approach “without a big bang”: keep compilation and behavior invariants, take short verifiable steps, introduce explicit types instead of “ubiquitous strings” ( ParsedCommand), move routing into CommandRouter, carefully move files across packages, and replace direct dependencies via a layer ( MutableList -> ExpenseRepository). Separately, we discuss how to use require()/ check() for explicit contracts and which mistakes most often break refactoring.
    Available
  • Fixation v1 — a single command contract

    Kotlin SELF
    Level 39, Lesson 4
    We break down “fixation v1” for a CLI application: we introduce a single result contract via a sealed interface CommandResult ( Ok/ Error), centralize output using render(), define command handling as handle(...) -> CommandResult, show a minimal pipeline readln() → parse → handle → render → println(), and lock down typical mistakes that break layer boundaries.
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym