Fundamentals of Programming Flashcards
Iteration
Repetition
Definite iteration - set number of times
Indefinite iteration - repeats until certain condition is met
Truncating
The process of cutting off a number after a certain number of characters or decimal places
Procedure/Subprogram/Routine
Another word for Subroutine
Parameter
A parameter works like a variable in that it identifies the data that you want a subroutine to take in and use.
Argument
The argument is the actual value being passed to the subroutine.
Procedural Programming Language
Languages where the programmer specifies the steps that must be carried out in order to achieve a result.
Imperative Programming Language
Languages based on giving the computer commands or procedures to follow. (A single algorithm, similar to step by step)
Hierarchy Chart
A diagram that shows the design of a system from the top down.
https://a325ff60-a-ba81db26-s-sites.googlegroups.com/a/campioncollege.com/it_eveningschoool/hierarchy-chart/chart.jpg?attachauth=ANoY7cpoxmzJ98YOBdAnkYTsW4iImY5ldYqCrRbGMpLsPoiMMRwuvA_pn3N5pKYqO_qk1KLIXsxfBYOl9plKDO8tRhmkj26bFL41Ld5OBv0J1931o89RFcjMKfczrIR8SJg-vsdH0EJK4zHTC_ZFMW9qA11CDnKdffMf7oXk1WCJhze8dxeAeEbN7QH5yoO-6i58ZOC_P_iHFzeBDy2JjVsukxd_GmYZQMQLTh5C7vgVFRu0ypYjotSuqQezph9fSEdxfxlit6_Q&attredirects=0
Structure Chart
Similar to Hierarchy with the addition of showing how data are passed around the system.
Structured Programming
Programming paradigm aimed at improving the clarity, quality and development time of a computer program by making extensive use of the structured control flow constructs of selection (if/then/else) and repetition (while and for), block structures, and subroutines.
Object-Oriented Programming (OOP)
Is a programming paradigm based on the concept of “objects”
Attributes
Similar to Variables
Eg in Python
class Person: #set attributes def \_\_init\_\_ (self, age): #put the attributes you want to adjust here self.first_name = "John" self.last_name = "Smith" self.age = age
An underscore in front of the attribute (eg self._age = age) makes it a private attribute.
Methods
Similar to Functions
Eg in Python
class Person: #set attributes def \_\_init\_\_ (self, age): #put the attributes you want to adjust here self.first_name = "John" self.last_name = "Smith" self.age = age
__init__() is an existing method in the class Person.
Instantiation
The creation of objects from the class definition
Eg in Python
class Person: #set attributes def \_\_init\_\_ (self, age): #put the attributes you want to adjust here self.first_name = "John" self.last_name = "Smith" self.age = age
def main(): #to instantiate the object new_age = Person(25) #need variable = class(value) print(new_age.age)
Class Diagram
http://pythonschool.net/oop/creating-your-first-class/
First Picture
Encapsulation
The process of combining data and functions into a single unit called class. The concept of encapsulation is to make data hiding possible.
Inheritance
Inheritance provides a mechanism that allows us to build upon our existing work, for example, ensuring multiple people (from the example class) share similar characteristics and behaviours that they have in common. The relationship between classes benefitting from inheritance is similar to that of a parent and a child.
A child class inherits functionality from the parent class (including all attributes and methods the parent class has)
In addition, the child class can extend the functionality of the parent by adding attributed and methods unique to the child.
Inheritance Diagram
http://pythonschool.net/oop/inheritance-and-polymorphism/
First Picture
Polymorphism
In a child class, we can change how some methods work whilst keeping the same name. This is called polymorphism or overriding and is useful because we do not want to keep introducing new method names for functionality that is pretty similar in each class.
Abstraction
Abstraction is a technique for hiding the complexity of computer systems. It works by establishing a level of simplicity on which a person interacts with the system, suppressing the more complex details below the current level.