Book

Object-Oriented Programming

Object-Oriented Programming with Java and Python — Every useful program you have ever used — the app that tells you when your laundry is ready, the game on your phone, the website where you pay a bill — is built out of objects: small, self-contained pieces of software that each know something and can do something, and that cooperate by sending one another messages. This book teaches you to think in objects and to build with them, in the two languages that the world uses most for exactly that purpose: Java and Python.

A416 ChaptersBI · ENJava · Python1,719 pages
Profitina Object-Oriented Programming
Download Full Book (PDF) Download All Lectures (PDF) Download the Source Code (ZIP)

Overview

Chapters 1 to 3 set up your workbench (VS Code, the Java Development Kit and Python, on Windows, macOS or Linux), teach the development environment and the debugger, and build the first classes: objects, strings, types, conditionals and loops. Chapters 5 to 7 add arrays and lists, input, exceptions and files, documentation and testing, interfaces, inheritance, polymorphism and access control. Chapters 9 to 11 cover collections and generics, graphical user interfaces and events, and the Model–View–Controller pattern. Chapters 13 to 15 treat iterators and immutability, threads and their dangers, and networking with sockets, ending with a team project.

Chapters 4, 8, 12 and 16 are Evaluation and Discussion chapters. Each closes one quarter of the book by solving complete problems in full — every problem restated, designed on paper, programmed in both languages, tested, run, and explained — with the tempting wrong solutions shown and taken apart, and a “check yourself” variant at the end of every problem.

Throughout, one small business grows chapter by chapter: Profitina Laundry, a laundry shop whose customers, orders, services, machines and receipts become classes, interfaces, collections, windows, threads and network services as the book goes on. Each chapter also has a Profitina in Practice section that shows where the same ideas appear in a real product.

Every program in this book was compiled and run before its output was printed. The programs are collected, chapter by chapter, in the accompanying Code folder, with a README in every chapter folder that explains how to run each one in a terminal and in VS Code on Windows, macOS and Linux.

Inside the Book

  1. Objects, Programs, and Your First Workbench
  2. The Development Environment: Editing, Running, and Debugging
  3. Classes, Objects, Strings, Types, Conditionals, and Loops
  4. Evaluation and Discussion I: From a Plain Specification to a Tested Class
  5. Arrays, Lists, Input, Exceptions, and Files
  6. Documentation, Testing, and Interfaces
  7. Inheritance, Polymorphism, and Access Control
  8. Evaluation and Discussion II: Recursive Structures, Robust Classes, and Class Hierarchies
  9. Collections and Generics
  10. Graphical User Interfaces and Event Handling
  11. The Model–View–Controller Pattern
  12. Evaluation and Discussion III: Predictive Text with Lists, Maps, Trees, and a Keypad
  13. Iterators, Immutability, and More Collections
  14. Threads, Races, Deadlock, and Livelock
  15. Sockets, Networking, and the Team Project
  16. Evaluation and Discussion IV: Iterators, Concurrency, Networking, and the Whole Book
Who this book is for: You are assumed to know nothing. If you have never written a program, never installed a programming tool, never heard the word class used outside a school building, you are exactly the reader this book was written for. Chapter 1 starts with an empty computer and ends with your first two programs running, one in each language. From there, every idea is introduced in plain words, then shown in Java, then shown in Python, then run, and then explained line by line — because a program you have run and understood is worth ten you have only read.

Profitina · profitina.com

💬 Community Discussion