Unit 2 Flashcards
Define Data
Information that is stored in some specific format.
Define a Data Structure
A particular way of formatting or organising data.
Define an Algorithm
A specification of a computational process.
Define an Architecture
The overall structure of a computer program in terms of its component algorithms and data.
Define an Application
A piece of software that provides one or more useful functions.
5 Main types of data format
- Binary digits (0, 1)
- Numbers, characters
- Sequences of numbers, strings
- Complex data structures: lists, dictionaries, sets, trees
- Structured data objects - CSV files, standard formats for images, video, audio, etc.
Define Encapsulation
An important concept in computer programming. It arises from the idea that a component of a computer program should be usable without a programmer needing to know all the details of how it works.
Although within the component may be a complex implementation, the programmer can use it by just passing it certain information (e.g. the arguments of a function call) and can rely on it computing results according to a specification of what it should do.
Modularity
The concept that the functionality of a computer program should be broken down into independent modules.
Creating smaller and simpler pieces of functionality means that each one can be understood by a programmer more easily.
The parts can then be used together like building blocks to create large, complex systems.
Object-oriented programming
A way of structuring code.
Related variables and functions are collected together into classes.
A class is instantiated to create an object.
Class attributes
Variables belonging to the class.
A class attribute has the same value across all objects that instantiate the class.
E.g. a Person class might have class attributes for species with the value ‘homo sapiens’
Instance attributes
Variables representing traits that objects have.
Static method
A method in a class that does not get the “self” parameter passed in and which therefore does not have access to any of the instance attributes of the object.
This means that the method will give the same result for any object.
Defined using the @staticmethod decorator.
Inheritance
Inheritance allows a class to include methods and attributes of another class.
The original class is often called the parent class and the new class that inherits methods and attributes from the other is called the child class.