همسری تسلیم میشود: او کنترل را به همسایهٔ مسلط خود واگذار میکند
A Wife Surrenders: She gives up control to her dominant neighbor
معرفی کتاب «همسری تسلیم میشود: او کنترل را به همسایهٔ مسلط خود واگذار میکند» (با عنوان لاتین A Wife Surrenders: She gives up control to her dominant neighbor) نوشتهٔ Irv Kalb و Leigh Temple، منتشرشده توسط نشر 2021 در سال 2021. این کتاب در فرمت epub، زبان انگلیسی ارائه شده است.
Power up your Python with object-oriented programming and learn how to write powerful, efficient, and re-usable code.Object-Oriented Python is an intuitive and thorough guide to mastering object-oriented programming from the ground up. You’ll cover the basics of building classes and creating objects, and put theory into practice using the pygame package with clear examples that help visualize the object-oriented style. You’ll explore the key concepts of object-oriented programming — encapsulation, polymorphism, and inheritance — and learn not just how to code with objects, but the absolute best practices for doing so. Finally, you’ll bring it all together by building a complex video game, complete with full animations and sounds. The book covers two fully functional Python code packages that will speed up development of graphical user interface (GUI) programs in Python.You’ll learn how to:• Create and manage multiple objects using an object manager object• Use encapsulation to hide the inner details of objects from client code• Use polymorphism to define one interface and implement it in multiple classes• Apply inheritance to build on existing code Title Page Copyright Dedication About the Author Acknowledgments Introduction Who Is This Book For? Python Version(s) and Installation How Will I Explain OOP? What’s in the Book Development Environments Widgets and Example Games Part I: Introducing Object-oriented Programming Chapter 1: Procedural Python Examples Higher or Lower Card Game Representing the Data Implementation Reusable Code Bank Account Simulations Analysis of Required Operations and Data Implementation 1—Single Account Without Functions Implementation 2—Single Account with Functions Implementation 3—Two Accounts Implementation 4—Multiple Accounts Using Lists Implementation 5—List of Account Dictionaries Common Problems with Procedural Implementation Object-Oriented Solution—First Look at a Class Summary Chapter 2: Modeling Physical Objects with Object-Oriented Programming Building Software Models of Physical Objects State and Behavior: Light Switch Example Classes, Objects, and Instantiation Writing a Class in Python Scope and Instance Variables Differences Between Functions and Methods Creating an Object from a Class Calling Methods of an Object Creating Multiple Instances from the Same Class Python Data Types Are Implemented as Classes Definition of an Object Building a Slightly More Complicated Class Representing a More Complicated Physical Object as a Class Passing Arguments to a Method Multiple Instances Initialization Parameters Classes in Use OOP as a Solution Summary Chapter 3: Mental Models of Objects and the Meaning of “self” Revisiting the DimmerSwitch Class High-Level Mental Model #1 A Deeper Mental Model #2 What Is the Meaning of “self”? Summary Chapter 4: Managing Multiple Objects Bank Account Class Importing Class Code Creating Some Test Code Creating Multiple Accounts Multiple Account Objects in a List Multiple Objects with Unique Identifiers Building an Interactive Menu Creating an Object Manager Object Building the Object Manager Object Main Code That Creates an Object Manager Object Better Error Handling with Exceptions try and except The raise Statement and Custom Exceptions Using Exceptions in Our Bank Program Account Class with Exceptions Optimized Bank Class Main Code That Handles Exceptions Calling the Same Method on a List of Objects Interface vs. Implementation Summary Part II: Graphical User interfaces with Pygame Chapter 5: Introduction to Pygame Installing Pygame Window Details The Window Coordinate System Pixel Colors Event-Driven Programs Using Pygame Bringing Up a Blank Window Drawing an Image Detecting a Mouse Click Handling the Keyboard Creating a Location-Based Animation Using Pygame rects Playing Sounds Playing Sound Effects Playing Background Music Drawing Shapes Reference for Primitive Shapes Summary Chapter 6: Object-Oriented Pygame Building the Screensaver Ball with OOP Pygame Creating a Ball Class Using the Ball Class Creating Many Ball Objects Creating Many, Many Ball Objects Building a Reusable Object-Oriented Button Building a Button Class Main Code Using a SimpleButton Creating a Program with Multiple Buttons Building a Reusable Object-Oriented Text Display Steps to Display Text Creating a SimpleText Class Demo Ball with SimpleText and SimpleButton Interface vs. Implementation Callbacks Creating a Callback Using a Callback with SimpleButton Summary Chapter 7: Pygame GUI Widgets Passing Arguments into a Function or Method Positional and Keyword Parameters Additional Notes on Keyword Parameters Using None as a Default Value Choosing Keywords and Default Values Default Values in GUI Widgets The pygwidgets Package Setting Up Overall Design Approach Adding an Image Adding Buttons, Checkboxes, and Radio Buttons Text Output and Input Other pygwidgets Classes pygwidgets Example Program The Importance of a Consistent API Summary Part III: Encapsulation, Polymorphism, and Inheritance Chapter 8: Encapsulation Encapsulation with Functions Encapsulation with Objects Objects Own Their Data Interpretations of Encapsulation Direct Access and Why You Should Avoid It Strict Interpretation with Getters and Setters Safe Direct Access Making Instance Variables More Private Implicitly Private More Explicitly Private Decorators and @property Encapsulation in pygwidgets Classes A Story from the Real World Abstraction Summary Chapter 9: Polymorphism Sending Messages to Real-World Objects A Classic Example of Polymorphism in Programming Example Using Pygame Shapes The Square Shape Class The Circle and Triangle Shape Classes The Main Program Creating Shapes Extending a Pattern pygwidgets Exhibits Polymorphism Polymorphism for Operators Magic Methods Comparison Operator Magic Methods A Rectangle Class with Magic Methods Main Program Using Magic Methods Math Operator Magic Methods Vector Example Creating a String Representation of Values in an Object A Fraction Class with Magic Methods Summary Chapter 10: Inheritance Inheritance in Object-Oriented Programming Implementing Inheritance Employee and Manager Example Base Class: Employee Subclass: Manager Test Code The Client’s View of a Subclass Real-World Examples of Inheritance InputNumber DisplayMoney Example Usage Multiple Classes Inheriting from the Same Base Class Abstract Classes and Methods How pygwidgets Uses Inheritance Class Hierarchy The Difficulty of Programming with Inheritance Summary Chapter 11: Managing Memory Used by Objects Object Lifetime Reference Count Garbage Collection Class Variables Class Variable Constants Class Variables for Counting Putting It All Together: Balloon Sample Program Module of Constants Main Program Code Balloon Manager Balloon Class and Objects Managing Memory: Slots Summary Part IV: Using OOP in Game Development Chapter 12: Card Games The Card Class The Deck Class The Higher or Lower Game Main Program Game Object Testing with __name__ Other Card Games Blackjack Deck Games with Unusual Card Decks Summary Chapter 13: Timers Timer Demonstration Program Three Approaches for Implementing Timers Counting Frames Timer Event Building a Timer by Calculating Elapsed Time Installing pyghelpers The Timer Class Displaying Time CountUpTimer CountDownTimer Summary Chapter 14: Animation Building Animation Classes SimpleAnimation Class SimpleSpriteSheetAnimation Class Merging Two Classes Animation Classes in pygwidgets Animation Class SpriteSheetAnimation Class Common Base Class: PygAnimation Example Animation Program Summary Chapter 15: Scenes The State Machine Approach A pygame Example with a State Machine A Scene Manager for Managing Many Scenes A Demo Program Using a Scene Manager The Main Program Building the Scenes A Typical Scene Rock, Paper, Scissors Using Scenes Communication Between Scenes Requesting Information from a Target Scene Sending Information to a Target Scene Sending Information to All Scenes Testing Communications Among Scenes Implementation of the Scene Manager run() Method Main Methods Communication Between Scenes Summary Chapter 16: Full Game: Dodger Modal Dialogs Yes/No and Alert Dialogs Answer Dialogs Building a Full Game: Dodger Game Overview Implementation Extensions to the Game Summary Chapter 17: Design Patterns and Wrap-Up Model View Controller File Display Example Statistical Display Example Advantages of the MVC Pattern Wrap-Up Index Object-Oriented Python (OOP) is a paradigm that combines data and code into cohesive units, allowing you to think differently about computational problems and solve them in a highly reusable way. Aimed at intermediate-level programmers, Object-Oriented Python is a hands-on tutorial that goes deep into the core tenets of OOP, showing you how to use encapsulation, polymorphism, and inheritance to write games and apps using Python. The book begins by demonstrating key problems inherent in procedural programming, then guides you through the basics of creating classes and objects in Python. You’ll build on this groundwork by developing buttons, text fields, and other GUI elements that are standard in event-driven environments. You’ll also use many real-world code examples and two pygame-based packages to help turn theory into practice, enabling you to easily write interactive games and applications complete with GUI widgets, animations, multiple scenes, and reusable game logic. In the final chapter, you’ll bring it all together by building a fully functional video game that incorporates many of the OOP techniques and GUI elements covered in the book. You’ll learn how to: •Create and manage multiple objects using an object manager object •Use encapsulation to hide the inner details of objects from client code •Use polymorphism to define one interface and implement it in multiple classes •Apply inheritance to build on existing code Object-Oriented Python is a visual, intuitive guide to fully understanding how OOP operates and how you can use it to make your code more maintainable, readable, and efficient—without sacrificing functionality. Power up your Python with object-oriented programming and learn how to write powerful, efficient, and re-usable code. Object-Oriented Python is an intuitive and thorough guide to mastering object-oriented programming from the ground up. You’ll cover the basics of building classes and creating objects, and put theory into practice using the pygame package with clear examples that help visualize the object-oriented style. You’ll explore the key concepts of object-oriented programming — encapsulation, polymorphism, and inheritance — and learn not just how to code with objects, but the absolute best practices for doing so. Finally, you’ll bring it all together by building a complex video game, complete with full animations and sounds. The book covers two fully functional Python code packages that will speed up development of graphical user interface (GUI) programs in Python.
دانلود کتاب همسری تسلیم میشود: او کنترل را به همسایهٔ مسلط خود واگذار میکند