Week 5 Flashcards
(35 cards)
What is object orientated programming
It is a programming paradigm based on concept of objects which are instances of classes
Objects contain:
data - attributes / properties
code - methods / functions
What is Object-Orientated design
process of designing a software solution using OOP
what are method signatures
Each method has signature : name, parameters, return type and access level.
What are key ideas related to object calling and answering
objects interact by calling methods, but not just any, only predefined methods
They don’t accept arbitrary calls
Methods define acceptable calls
What is an object interface
This is the set of method signatures available for the object
example arrays have .index or .get or whatever but you don’t actually know wtf happens behind the interface.
explain information hiding or encapsulation regarding Object interfaces
Involves hiding their internal attributes and only allowing access through interface methods.
client and server objects
client = object requesting something
server = the object fulfilling it by like doing the function
scenario based obvs
when object calls a method on another object its like sending a message “ hey poes do this”
Modules vs objects
modularity is more for just organising code by grouping functionality together
objects is similar but encapsulates data
What are UMLs
- Unified Modelling Language
Standardised visual language which represents different aspects of a systems structure and behaviour
similar to ERDs
Key components of a UML
Class diagrams
Use case diagrams
Sequence diagrams
Activity diagrams
State machine diagrams
Component Diagrams
Deployment diagrams
Package diagrams
UML classes has 3 compartments
Class Name
Attributes
Operations
symbols with operations in UML classes
+ public - Accessible from anywhere (any class can use it).
- private - Only accessible within the class itself (not from other classes).
protected # - Accessible from the same class and subclasses (but not outside them).
~ package - Accessible only within the same package/module (used in Java, not in Python).
/ derived - Represents a calculated (not stored) attribute.
class diagrams
shows classes, attributes and relationships
use case diagrams
different users
sequence diagrams
how objects interact over time
e.g. log into ATMs, requests verification, bank responds
Activity diagrams
shows flow of activities in a system
like online order has
Add to cart
Payment info
Confirm order
State machine diagrams
show how objects move between states
robot go red to green to yellow
Component diagrams
shows software components and their dependencies
web app with its databases, UI and APIs
Deployment diagrams
how software is deployed
Package diagrams
groups classes into packages for better organisation
a large e commerce might have separate packages for User management or payments or order processing etc
UML notation for classes relationships
Association : solid line >
Inheritance : solid line open triangle
implementation : dotted line open triangle
dependency: dotted line >
aggregation : solid line open diamond
Composition : solid line solid diamond
what is association
when object accesses another in some way
owner feeds dog
bidirectional - solid line no arrow
unidirectional - solid line with one arrow
prohibited association - solid lines with two arrows facing each other
Inheritance
object inherits properties of another
“is a “ relationship
composition
object references another object
“has a” relationship