Web Development · WDC-86

JavaScript OOP

JavaScript OOP is a course in designing object-oriented JavaScript, from prototypes and classes to encapsulation, inheritance, polymorphism, composition and the SOLID principles, together with commonly used design patterns and TypeScript interfaces. It suits developers who already write JavaScript and tech leads who set the code structure for their team.

Updated
From 8,550 THB / person 9,500 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration18 hours · 3 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

As a JavaScript project grows, code written as long chains of functions tends to become hard to change, hard to reuse and easy to break when several people work on it. Object-oriented thinking splits a system into parts with clear responsibilities, hides details that others do not need and lets you extend the system without tearing up what already works. The same ideas sit behind the frameworks and libraries developers use every day.

This course explains OOP the JavaScript way, built on prototypes. Learners start with objects, prototypes and this, write classes using the latest ECMAScript syntax, and practise encapsulation with private elements, abstraction, inheritance and polymorphism. They learn when composition is a better choice than inheritance, design to the SOLID principles and use TypeScript to add interfaces and abstract classes. They then study creational, structural and behavioural design patterns, write tests and refactor existing code, and finish with a capstone that designs a system using patterns. (3 days, 6 hours per day, 18 hours in total, Intermediate level.)

What you’ll gain

  • Explain OOP concepts and how prototypes and classes differ in JavaScript
  • Write classes correctly with private elements, static members, getters and setters
  • Apply encapsulation, abstraction, inheritance and polymorphism to code design
  • Choose composition or inheritance to suit the problem
  • Design classes to the SOLID principles and communicate with class diagrams
  • Use TypeScript to add interfaces, abstract classes and access modifiers to object-oriented code
  • Apply commonly used design patterns to JavaScript problems
  • Write tests and refactor existing code into an object-oriented structure

Who this course is for

  • Developers who already write JavaScript and want to design their code systematically
  • Front-end and full-stack developers who maintain medium to large projects
  • Anyone who wants to understand the ideas behind frameworks such as Angular and NestJS and other libraries
  • IT managers and tech leads who set code structure and review their team's work

Prerequisites

  • Able to write JavaScript, including variables, functions, arrays, objects and arrow functions
  • Some experience with import and export or with npm packages
  • Basic command-line and Git skills
  • A laptop that can run the current Node.js LTS release and VS Code, with permission to install software

Curriculum

Course Details

This course is the 2026 edition of JavaScript OOP. It runs for 3 days, 6 hours per day (18 hours in total, 09:00-16:00), as lectures with labs. Intermediate level. This edition uses the latest ECMAScript class syntax, including private methods, static blocks and #field in obj checks, and adds the SOLID principles, composition, mixins, class diagrams, TypeScript for interfaces and abstract classes, and

testing. Design pattern examples now use ES modules, EventTarget and Proxy. Creational, structural and behavioural patterns are all still covered. The class and prototype topics overlap in part with Advanced JavaScript, but this course concentrates on object-oriented design and design patterns. Every lab uses open source or free tools. Learners take home a lab guide, starter and solution code for every lab, and their capstone project.

Day 1 OOP Foundations in JavaScript

Section 1: Lab: OOP Concepts and Setting Up Tools

  • Why write object-oriented code, its benefits and limits, and how it differs from procedural code
  • Thinking in objects and separating each class's responsibilities
  • Install the Node.js LTS release, VS Code and ESLint
  • Organise the project with ES modules and run tests with node --test
  • Lab: a starter project used in every lab

Section 2: Objects, Prototypes and this

  • Object literals, methods and shorthand
  • Constructor functions and how new works
  • The prototype chain, Object.create and Object.getPrototypeOf
  • The value of this in methods, callbacks and arrow functions
  • Lab: build a product object in three ways and compare them

Section 3: Lab: Classes and Objects

  • Class declarations, constructors, fields and methods
  • Static fields, static methods and static initialisation blocks
  • Getters and setters that validate values before storing them
  • How classes work on top of prototypes
  • Lab: customer account and order classes

Section 4: Encapsulation

  • Encapsulate data with private fields and private methods
  • Check that an object belongs to a class with #field in obj
  • Closures and the module pattern as another way to hide data
  • Object.freeze and designing immutable objects
  • Lab: a wallet class that stops the balance being changed directly

Section 5: Abstraction

  • Design a class's public API so it is easy to use and hides the details
  • The abstract class idea in JavaScript, which has no abstract keyword
  • Force subclasses to implement methods with new.target and thrown errors
  • Duck typing and describing object contracts with JSDoc
  • Lab: a base class for several payment methods
Day 2 Inheritance, Polymorphism and Design Principles

Section 6: Lab: Inheritance

  • Inherit with extends and call the parent class with super
  • Method overriding and extending existing methods
  • Extend built-ins such as Error to create custom errors
  • instanceof and different kinds of class relationship
  • Lab: an employee hierarchy with salary calculation

Section 7: Polymorphism

  • What polymorphism is and how it reduces if-else chains
  • Overriding versus overloading, which JavaScript does not support directly
  • Make objects work with the language through Symbol.iterator and toString
  • Use many kinds of object through one interface
  • Lab: a shipping cost calculator with several methods

Section 8: Composition and Mixins

  • The problems with deep inheritance
  • Composition over inheritance and building objects from smaller parts
  • Mixins for adding capabilities to several classes
  • Dependency injection so parts can be swapped and tested easily
  • Lab: turn a class hierarchy into composition

Section 9: The SOLID Principles and Class Diagrams

  • Single responsibility and open/closed
  • Liskov substitution, interface segregation and dependency inversion
  • Read and write UML class diagrams
  • Create diagrams from code with Mermaid
  • Lab: analyse code that breaks SOLID and redesign it

Section 10: Lab: OOP with TypeScript

  • Why teams use TypeScript for object-oriented code
  • Interfaces and implements
  • Abstract classes, abstract methods and access modifiers
  • Parameter properties, readonly and simple generic classes
  • Lab: convert the payment system from Section 5 to TypeScript
Day 3 Design Patterns, Testing and Capstone

Section 11: Design Patterns and the Creational Group

  • Where design patterns come from, the Gang of Four, and how to choose one
  • Singleton, and the ES module alternative
  • Factory Method for creating objects based on conditions
  • Builder for objects with many settings
  • Lab: a factory that creates several notification channels

Section 12: Lab: Structural Patterns

  • Composite for tree-shaped data such as menus and categories
  • Adapter for connecting to APIs or libraries with a different shape
  • Decorator for adding behaviour without changing the original class
  • Facade for hiding a complex subsystem
  • Proxy with JavaScript's Proxy object

Section 13: Behavioural Patterns

  • Observer with EventTarget in the browser and EventEmitter in Node.js
  • Strategy for switching calculation methods at run time
  • Command for actions that can be undone
  • State for objects whose behaviour changes with their status
  • Lab: order status handling with State and Observer

Section 14: Lab: Testing and Refactoring Object-oriented Code

  • Write unit tests for classes with the Node.js test runner
  • Use dependency injection and mocks to test parts in isolation
  • Refactor long procedural code into classes step by step under test
  • Use an AI assistant to suggest refactorings and verify them with tests
  • Lab: refactor an existing discount calculation

Section 15: Workshop: Capstone System Design with OOP and Patterns

  • Analyse a booking or order system brief and draw its class diagram
  • Choose suitable patterns for each part and justify them
  • Write the code to the SOLID principles with tests for the key parts
  • Present the work and review the designs together

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

How do you write OOP in JavaScript, and how do JavaScript classes differ from other languages?

JavaScript is prototype-based: objects inherit from other objects through the prototype chain. The class syntax is a cleaner way of writing that still runs on prototypes, with constructor for initial values, extends and super for inheritance, and members prefixed with # for private data and methods. It has no interfaces, abstract classes or method overloading in the Java sense, so duck typing, new.target or TypeScript are used instead.

How do you achieve encapsulation in JavaScript?

The standard approach today is to declare private fields and methods with the # prefix inside a class, which outside code cannot access, and expose values through getters and setters that validate changes. You can also check that an object really comes from the class with #field in obj. A long-established alternative is a closure, keeping variables inside a function and returning only the methods you want to expose. Prefixing names with an underscore is just a convention and does not actually prevent access.

What is the Observer pattern, and when is it used in JavaScript?

In the Observer pattern, one object, the subject, keeps a list of subscribers and notifies them all when its state changes, without needing to know what each one does next. This reduces coupling between parts of a program. In JavaScript it appears everywhere, from addEventListener and EventTarget in the browser and EventEmitter in Node.js to state management libraries that tell the interface to update when data changes.

Who is the JavaScript OOP course for, and what should I know beforehand?

It suits developers who already write JavaScript and want to design their code systematically, front-end and full-stack developers who maintain medium to large projects, and tech leads who review their team's code. You should be able to write JavaScript, including functions, arrays, objects and arrow functions, and have used import and export. Graduates of Basic JavaScript or Advanced JavaScript can continue straight on.

What will I be able to do after the JavaScript OOP course?

You will be able to design object-oriented programs in JavaScript, write classes to the latest standard, apply encapsulation, abstraction, inheritance and polymorphism, choose composition where it fits, design to the SOLID principles, use TypeScript interfaces and abstract classes, and structure code with patterns such as Factory Method, Composite, Adapter, Observer and Strategy, as well as write tests and refactor existing code. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

Can the JavaScript OOP course be run in-house for our team?

Yes. It can be run in-house for your team, with examples adapted to your work, such as restructuring JavaScript code from projects your team maintains into object-oriented code backed by tests. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.

Related articles

Articles are published in Thai.