The Object Oriented Way
$20.00
Minimum price
$20.00
Suggested price

The Object Oriented Way

How To Solve Problems

About the Book

🐤💲 Early bird SALE RIGHT NOW 💲🐤

(Note: The book is not done, but you can buy and read it now. It will be more expensive later.)

How do we solve problems using objects?

That question is the north star of this book. While we happen use C# for all examples in this book, that language is merely a means and not an end. The purpose of this book is to teach the *fundamental ideas in contemporary object oriented programming*.

Who is this book for?

Whether you are a complete novice or a seasoned coder looking to grow, this book is your roadmap to mastering contemporary object orientation. From simple topics like syntax and types all the way to advanced concepts like design patterns and variance.

Why objects?

I believe that the functional way is superior to the object oriented way. So why study objects? Before we criticise the other side, we must understand their arguments better than they do themselves. This book is my attempt at steel-manning the object oriented way, once and for all.

Who am I?

A Senior Lecturer at Uppsala University with a Ph.D. in Information Systems. You might know me from my popular YouTube channel on programming. I have been teaching object oriented concepts for more than a decade. This is the book I wish I had been given and I use it to teach object orientation to university students.

About the Author

Christopher Okhravi
Christopher Okhravi (PhD)

I am a university lecturer (Uppsala University, Sweden) by day and a YouTuber by night.

I have been teaching object oriented programming to university students for over a decade and I hold a PhD in Information Systems (where I used Haskell to model policy interventions for antibiotics development as financial contracts).

On YouTube I am most famous for my deep diving playlist on Object Oriented Design Patterns but am uploading content on anything from functional programming to architecture.

I love abstractions and this is why I love programming.

I write simple books because that's what we all deserve :)

Table of Contents

    • Preface
      • How To Read This Book
    Part I:Imperative Programming
    • 1.Programming
      • 1.1.Algorithms
      • 1.2.Computation
      • 1.3.Programs
      • 1.4.Syntax
      • 1.5.Compilation
      • 1.6.Execution
      • 1.7.Interpretation
      • 1.8.Comments
    • 2.Data
      • 2.1.Values
      • 2.2.Variables
      • 2.3.Data Types
      • 2.4.Constants
      • 2.5.Type Checking
      • 2.6.Type Inference
      • 2.7.Null
      • 2.8.Dynamic Types
    • 3.Expressions
      • 3.1.Arithmetic Operators
      • 3.2.Equality Operators
      • 3.3.Relational Operators
      • 3.4.Logical Operators
      • 3.5.String Concatenation
      • 3.6.String Interpolation
      • 3.7.Assignment Operator
      • 3.8.Precedence
      • 3.9.Associativity
    • 4.Control Flow
      • 4.1.Statements
      • 4.2.Selection Statements
      • 4.3.Selection Expressions
      • 4.4.Conditionals Breed
      • 4.5.Iteration Statements
      • 4.6.Exceptions
    • 5.Type Definitions
      • 5.1.Make Impossible States Impossible
      • 5.2.Enumeration Types
      • 5.3.Tuples
      • 5.4.Arrays
      • 5.5.References and Values
    • 6.Methods
      • 6.1.Local Functions
      • 6.2.Parameters
      • 6.3.Return Values
      • 6.4.Fat Arrows
      • 6.5.Recursion
    • 7.Organization
      • 7.1.Namespaces
      • 7.2.Entry Point
      • 7.3.Global Variables Considered Harmful
    Part II:Object Oriented Programming
    • 8.Objects
      • 8.1.Classes
      • 8.2.Fields
      • 8.3.Constructors
      • 8.4.Instance Methods
      • 8.5.The this Keyword
      • 8.6.Encapsulation
      • 8.7.Access Modifiers
      • 8.8.Properties
      • 8.9.Static
      • 8.10.Overloading
      • 8.11.Extension Methods
    • 9.Object Composition
      • 9.1.Dependency Instantiation
      • 9.2.Dependency Injection
      • 9.3.Tell Don’t Ask
      • 9.4.Law of Demeter
    • 10.Subtype Polymorphism
      • 10.1.Substitutability
      • 10.2.Interfaces
      • 10.3.Run-Time Type vs Compile-Time Type
      • 10.4.Dynamic Dispatch
      • 10.5.Replace Conditional With Polymorphism
      • 10.6.Don’t Use Subtypes for Data Variation
      • 10.7.Multiple Interfaces
      • 10.8.Interface Segregation Principle
    • 11.Inheritance
      • 11.1.Class Inheritance
      • 11.2.Overriding
      • 11.3.Hiding
      • 11.4.The base Keyword
      • 11.5.Constructor Chaining
      • 11.6.Protected Access Modifier
      • 11.7.Abstract Classes
      • 11.8.Interface Inheritance
      • 11.9.Default Interface Methods
      • 11.10.Multiple Inheritance
      • 11.11.Fragile Base Class Problem
    • 12.Type Conversions
      • 12.1.Kinds of Type Conversions
      • 12.2.Upcasting
      • 12.3.Downcasting
      • 12.4.Everything Is An Object
    • 13.UML Class Diagrams
      • 13.1.Classes
      • 13.2.Fields
      • 13.3.Access Modifiers
      • 13.4.Properties
      • 13.5.Instance Methods
      • 13.6.Constructors
      • 13.7.Composition
      • 13.8.Interfaces
      • 13.9.Inheritance
      • 13.10.Abstract
    • 14.More Type Definitions
      • 14.1.Structure Types
      • 14.2.Record Types
      • 14.3.Anonymous Types
    • 15.Generics
      • 15.1.Can Everything Be Generic?
      • 15.2.Generic Types
      • 15.3.Generics Maintain Static Type Safety
      • 15.4.Generic Supertypes
      • 15.5.Generic Methods
      • 15.6.Type Parameter Constraints
      • 15.7.Collections
    • 16.Composition Over Inheritance
      • 16.1.The Duck Dilemma
      • 16.2.Strategy Pattern
      • 16.3.Bridge Pattern
      • 16.4.Delegates
      • 16.5.Generic Delegates
      • 16.6.Multicast Delegates
      • 16.7.Lambdas
    Part III:Advanced Object Oriented Programming
    • 17.Dependency Inversion
      • 17.1.Dependency Inversion Principle
      • 17.2.Factory Method Pattern
    • 18.Observers
      • 18.1.Observer Pattern
      • 18.2.Events
      • 18.3.Event-Driven Programming
      • 18.4.Reactive Programming
    • 19.Iterators
      • 19.1.Iterator Pattern
      • 19.2.Enumerables
      • 19.3.The yield Statement
      • 19.4.Lazy Evaluation
      • 19.5.Infinite Iterators
      • 19.6.LINQ
    • 20.Multiple Dynamic Dispatch
      • 20.1.Visitor Pattern
      • 20.2.Pattern Matching
    • 21.Variance
      • 21.1.Type Safe Variance
      • 21.2.Covariance
      • 21.3.Contravariance
      • 21.4.Invariance
      • 21.5.The Square-Rectangle Problem
      • 21.6.Liskov Substitution Principle
      • 21.7.Variant Class Inheritance
      • 21.8.Variant Delegates
      • 21.9.Variant Generic Delegates
      • 21.10.Variant Generic Interfaces
    • Epilogue

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub