Lecture 1 Flashcards
Procedural program basic anatomy.
There are functions/methods and variables.
The functions/methods call each other.
As these get larger, they can become more unmanageable (spaghetti code).
What are some basic ideas of object-oriented programming?
Handle complexity by decomposing things.
Make ‘objects’ that contain data and related behaviors.
This works very well for large-scale systems that are maintainable and extendable.
Basic anatomy of object oriented programming.
Methods and variables within classes.
Questions to understand related to object-oriented programming.
What things should be classes and objects?
How do objects interact?
How can we design without implementing the design?
How can the design be robust, reusable, and adaptable?
Definition of classes and objects.
Class: A blueprint on how to create an object.
Object: An instance of a class.
What is a field or attribute?
Related data. May include the state of an object.
What is a constructor?
Makes an object with initial attributes.
Think __init__ in python.
What is a method?
Implements related behaviors.
Some describe real world behaviors.
Some describe system behaviors.
How does modelling work with programming?
Models group things (objects) with similar enough characteristics into the same type. How similar they are depends on the application.
In programming, objects of the same type are made with the same class. The class defines fields and operations.
All objects of the same type have the same fields and operations.
Can objects of the same type have different fields and operations?
No*
Categories of objects.
Entity: Real things. Like animals, people, numbers, etc.
Container: A data structure for storage of entities.
Interface: Communicates with the “outside world”. Such as a printer, file, or console.
Control: Organize computations. The main program.
Entity Objects.
Can be physical, conceptual, or event/state-change objects. People, buildings, agreements, abstractions, purchases, sales, etc.
Container Objects.
Contains some number of entities.
Implemented with data structures.
Interface Objects.
Handles communication between software and externals. Such as people, other hardware, etc.
I.e. GUI.
Control Objects.
Controls sequence of execution. I.e. Drivers, main program.