Comp Think: 2-27-2026
Homework Assignment
Previously assigned homework was to read about Python and play around with it.
Chapter Count: Approximately four short chapters.
Method of Study: Reading should not be passive; students must actively implement examples and experiment to achieve learning.
Analogy: Learning programming is akin to training as a doctor—practical experience is vital.
Class Structure for Learning Python
Emphasis on not starting to code prematurely—planning and modeling are important.
Project Theme: Implementation of a virtual zoo.
Definition of a zoo and its virtual analogy involving computer memory and objects.
Project Details
Class diagrams are essential, and students should follow a rigorous process when creating them.
Project Deliverables:
Class diagrams and at least three dynamical diagrams are required (including one step motion diagram).
No exam scheduled as students have other midterms.
Presentation Date: Scheduled for March 20, contingent on attendance.
Brainstorming Session
Identifying Actors at the Zoo:
Main Actors:
Animals (land, water, air).
Zookeepers.
Patrons (including annual pass holders and regular patrons).
Focus on modeling animals in the zoo at this point.
Zoo Class Diagram Considerations
Classes to Focus On:
Zoo.
Animals categorized by habitat: land, water, air.
Specialization can occur (e.g., mammals, reptiles, birds).
Attributes for Animals:
Genus and species may be included.
Considerations for characteristics applicable across classifications of animals.
Hierarchies and Inheritance in Class Design
Concept of generalization and specialization in class design:
Example of an "Animal" superclass with subclasses for specific types of animals (e.g., land animal, water animal).
Classes can have common attributes such as:
Habitat (descriptive of type or specific location).
Food type.
Attributes & Characteristics Discussion
Understanding attributes applicable to each subclass:
For land animals (e.g., fur): May be binary or variable (agreeing that fur is common or variable).
Water Animals: Gills and fins; can differentiate on sizes and shapes of these attributes.
The challenge of specifying common characteristics vs. unique attributes among subclasses.
Methods in Class Design
Each class should define its methods, such as:
Common methods (e.g., eating, breathing).
Discussions on virtual methods where subclasses can override behaviors.
Patterns in animals can be treated as attributes that differentiate individuals.
Practical Discussion on Animal Methods
Methods that may or may not share implementation across subclasses:
Example methods:
Die (common to all animals).
Reproduce (consideration for characteristics like live births or egg-laying).
All animals eat but may differ in the method or specifics.
Implementing Classes in Python
Overview of syntax needed to create classes in Python:
Class definitions using the
classkeyword.The use of
selfto signify instance methods.
Example prohibition against mimicking Java's syntax (using 'public') in Python.
Explanation about
objectin Python as a high-level class that every object should inherit from.
Error Handling and Adjustments in Class Design
Iterative design process: Constantly shifting attributes and methods as understanding deepens.
Importance of adjusting diagrams and class definitions to accurately reflect relationships and characteristics among classes.
Conclusion of Class Discussion
Students are encouraged to begin implementing their designs in Python after fully developing their class diagrams, not rushing into coding.
Reiterate necessity of continuous reading and practice for improving understanding and execution in Python programming.