liveBook · Manning

Object-oriented programming

As explained in The Art of Unit Testing 3e

A programming paradigm that structures software around objects encapsulating state and behavior.

Object-oriented programming structures software around objects that combine state and behavior. It is one of JavaScript’s major programming styles, alongside procedural and functional programming. TypeScript supplies useful structure for expressing object-oriented designs, while the underlying patterns remain transferable across languages. section 1.0

Object-oriented programming becomes especially relevant when code must manage dependencies or verify interactions between collaborating objects. Dependency injection and mock-based testing are common settings for this style, particularly for developers familiar with C# or Java. section 3.7 section 4.7

Choose the style according to the problem and the team rather than treating one paradigm as universally best:

  • Use object-oriented designs when their structure fits the team’s experience or the dependency-management problem. section 3.4
  • Use functional designs when simplicity, clarity, or provability makes them a better fit. section 3.4
  • Translate shared patterns between styles instead of assuming that a pattern belongs exclusively to object-oriented programming. section 3.4
  • Expect object-oriented examples to use TypeScript here, while procedural and functional examples may use ordinary JavaScript. section 1.0

How The Art of Unit Testing 3e covers it

How deep it goes
Treats the style through design choices, dependency injection, and mocking rather than presenting a language-independent implementation theory.
Examples
Uses TypeScript object-oriented examples and discusses dependency-injection and mock-object patterns.
What you can do after
Evaluate whether object-oriented or functional design better fits a team and apply shared patterns across both styles.
How it connects
Links object-oriented programming with TypeScript, functional programming, dependency injection, stubs, and mock objects.

Also explained in

Compare how 9 books explain object-oriented programming →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Unit Testing 3e. The section links point to the parts of the book it draws on.