JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Struct embedding: promoted members

    Go SELF
    23 level,0 lecture
    We break down embedding in Go structs: how anonymous fields work, why fields from embedded structs become accessible via a shortened path (promotion), how embedding a value differs from embedding a pointer ( * Meta), how to correctly initialize embedded fields using keyed literals, and where it is better to write explicit qualification (for example, t. Meta. ID) for readability and safety.
    Open
  • Composition as a style for extending behavior in Go

    Go SELF
    23 level,1 lecture
    We break down why in Go composition is used more often than inheritance: how to assemble types from “building blocks” via fields ( Task contains Meta), how to “plug in” behavior via small types ( Status + wrapper methods), how embedding differs from a regular field, and how embedding affects the public API. We reinforce the idea with examples ( StoredTask + Task, TaskService + a validator), and finish with common mistakes when designing with composition.
    Open
  • Interface composition

    Go SELF
    23 level,2 lecture
    We break down why in Go you “glue” contracts together via embedding: how to assemble an interface from several small ones (for example, Reader + Writer = ReadWriter), why this is not inheritance, how embedding differs from manually copying signatures, what composition looks like in a practical example ( TaskStore built from TaskAdder and TaskLister), and also what signature conflicts the compiler catches and which mistakes beginners make most often.
    Open
  • Name conflicts and explicit access via x . Field

    Go SELF
    23 level,3 lecture
    We break down how Go “mechanically” resolves selectors like x . Field and x . Method () with embedding: search by “levels,” promotion (promoted) of fields and methods, the reasons behind the ambiguous selector error, and also how and why to switch to the explicit path x . EmbeddedType . Field / x . EmbeddedType . Method () to control behavior and improve readability.
    Open
  • When embedding is harmful

    Go SELF
    23 level,4 lecture
    Let’s break down why embedding in Go can unexpectedly expand a public API and “inflate” a type’s surface area: how promoted methods make Project “capable of” Next(), why embedding TaskList locks in internal implementation details, and how to replace this with a clean design using explicit methods ( AddTask, Tasks()) and safe data exposure via make + copy.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush