Fundamentals First

All data in Python are objects. We introduce and use objects in Chapter 3, but defining custom classes are covered later starting from Chapter 7. The book is fundamentals-first, which introduces basic programming concepts and techniques on selections, loops, functions, before writing custom classes.

Why Fundamentals First?

Learning basic logic and fundamental programming techniques like loops and step-wise refinement is essential for new programmers to succeed. Students who cannot write code in procedural programming are not able to learn object-oriented programming. A good introduction on elementary programming, control statements, and functions prepares students to learn object-oriented programming.

Problem Driven

This book uses the problem-driven approach to teach problem solving. Interesting and practical examples are used not only to illustrate syntax but also to teach problem solving and programming. Interesting and practical problems introduce each chapter and are solved within the chapter. The book uses a wide variety of problems with various levels of difficulty to motivate students. The problems cover many application areas in gaming, math, business, science, animation, and multimedia.

Why Problem-Driven?

Programming isn't just syntax, classes, or objects. It is really problem solving. Loops, methods, and arrays are fundamental techniques for problem solving. From fundamental programming techniques to object-oriented programming, there are many layers of abstraction. Classes are simply a layer of abstraction. Applying the concept of abstraction in the design and implementation of software projects is the key to developing software. The overriding objective of the book, therefore, is to teach students to use many layers of abstraction in solving problems and to see problems in small and in large. The examples and exercises throughout the book emphasize problem solving and foster the concept of developing reusable components and using them to create practical projects.

Graphics as Pedagogical Tool

It is motivating for beginners to learn programming using graphics. A big reason for learning programming using Python is that you can start programming using graphics in day one. We use Python's built-in Turtle graphics module in Chapters 1-6 and introduce Python's Tkinter in Chapter 8. Turtle is a good pedagogical tool for introducing fundamentals of programming. Tkinter can be used for developing comprehensive graphical user interfaces and for learning object-oriented programming. Both Turtle and Tkinter are remarkably simple and easy to learn. More importantly, they are valuable pedagogical tools for teaching fundamentals of programming and object-oriented programming.

Graphics is Optional

To give instructors flexibility to use this book, we make all graphics materials optional so they can be skipped.

Programming, Data Structures, and Algorithms in One Text

The book seamlessly integrates programming, data structures, and algorithms into one text. It employs a practical approach to teach data structures. We first introduce how to use various data structures to develop efficient algorithms, and then show how to implement these data structures. Through implementation, students gain a deep understanding on the efficiency of data structures and on how and when to use certain data structures. Finally we introduce design and implement custom data structures for trees and graphs.

Personal Observations on Teaching Programming

I teach four programming courses on Java, C++, or Python every semester. I use a hybrid of traditional lecture and flipped classroom. Traditional lecture covers important concepts and issues. Flipped classroom is to first assign reading, programming exercises, and quizzes, and then review these in the class. I probably use 50% of time for traditional lecture and 50% time on flipped classroom. I embrace the "the more you do it, the better you get at it" model by assigning one or two programming exercises after every meeting. Students submit programming exercises online to LiveLab. The programming exercises are automatically graded in most cases. My exercises include some even-numbered exercises. Students are asked to first attempt to solve these even-numbered exercises and then compare their programs with the solutions provided online. For more information about my courses, see