본문 바로가기

분류 전체보기402

Visual Programming of Tables of Data 3 Visual Programming of Tables of Data In this chapter, we’ll look at a few ways to represent lists of data. We’ll start by writing code to read in a list of states, along with some of their data. Then we use these entries as examples for display, to easily find tables of all the U.S. states and their capitals and population data. When writing this book, we extracted the data from a table on Wik.. 2023. 3. 23.
Visual Programming in Python 2 Visual Programming in Python You can make very nice visual interfaces using the tkinter toolkit provided with Python. It gives you tools for creating windows, buttons, radio buttons, check boxes, entry fields, list boxes, combo boxes and a number of other useful visual widgets. To use the tkinter library, you must tell your program to import those tools: import tkinter as tk from tkinter impor.. 2023. 3. 23.
Introduction Introduction to Objects Classes are one of the most important parts of the Python language and also a major component of object-oriented programming. Some books put off classes until later chapters, but because nearly every component of Python is an object, we will take a look at them up right away. And don’t skip ahead, because we’ll be using them in every single chapter that follows! Almost ev.. 2023. 3. 23.
Index You can find complete working code for all these programs on GitHub at https://github.com/jwcnmr/jameswcooper/tree/main/Pythonpatterns. This book is organized into five parts. Part I, “Introduction” Design patterns essentially describe how objects can interact effectively. This book starts by introducing objects in Chapter 1, “Introduction to Objects,” and providing graphical examples that clear.. 2023. 3. 23.
The Observer Pattern in Reactive Programming The Observer Pattern in Reactive Programming In the previous chapter, we covered the last four in our list of behavioral patterns. That chapter also marked the end of the list of patterns presented by the Gang of Four in their book. Among the patterns we have discussed so far, one is particularly interesting now, for this new chapter: the Observer pattern (covered in Chapter 11, *The Observer Pa.. 2023. 3. 22.
Other Behavioral Patterns Other Behavioral Patterns We have seen in Chapter 12, *The State pattern, which helps us in making behavior changes when an object's internal state changes, by using state machines. There is a number of behavioral patterns and, in this chapter, we are going to discuss five more of them: Interpreter, Strategy, Memento, Iterator, and Template. What is the Interpreter pattern? The Interpreter p.. 2023. 3. 22.
The State Pattern The State Pattern In the previous chapter, we covered the Observer pattern, which is useful in a program to notify other objects when the state of a given object changes. Let's continue discovering those patterns proposed by the Gang of Four. Object-oriented programming (OOP) focuses on maintaining the states of objects that interact with each other. A very handy tool to model state transiti.. 2023. 3. 22.
The Observer Pattern The Observer Pattern When we need to update a group of objects when the state of another object changes, a popular solution is offered by the Model-View-Controller (MVC) pattern. Assume that we are using the data of the same model in two views, for instance in a pie chart and in a spreadsheet. Whenever the model is modified, both the views need to be updated. That's the role of the Observer .. 2023. 3. 22.
The Command Pattern The Command Pattern Most applications nowadays have an undo operation. It is hard to imagine, but undo did not exist in any software for many years. Undo was introduced in 1974 (j.mp/wiundo), but Fortran and Lisp, two programming languages that are still widely used, were created in 1957 and 1958, respectively (j.mp/proghist)! I wouldn't like to have been an application user during those yea.. 2023. 3. 22.