3.4 Principles Of Programming Flashcards
Procedural Programming
Code is divided into procedure which are discrete blocks of code that carry out single tasks. Best suited for problems that require a linear algorithm solution (solve step by step)
Examples:
- Basic, Java, Python
+ Ease of learning
+ Portable
+ Various applications can be used
+ flows lineraly so easy to follow
- cant solve real world problems
- less secure as there is no security of data
- semantics are hard to understand
Event Driven
Execution of program is determined by events such as actions or messages. Suited for problems that rely on heavy interaction through GUI (buttons execute subroutine on click for instance)
Examples
- Javascript with buttons and events
+ enables multitasking
+ critical for real time applciations
+ flexibility
- complexity
- less logical and obvious
- difficult to find errors
- debugging difficutlies
Visual
Coding approach that uses graphical elements to create software
Examples:
- Scratch
+ user friendly
+ improved debugging
+easy to learn
- require more memory due to graphic use
- limited functions
Mark-Up
Used to structure and format text documents using symbols and tags.
Examples:
- HTML, XML
+ support from every browser
+integrates with other languages
+ easy to code
- static language
- security features are limited
Database
Stores information that can be easily stored and managed
flat file and relational databases
Flat file - Stores data in a single table
Relational database - uses multiple tables that are connected by relationships, removes redundant data
What is a programming paradigm
describes different approaches in programming languages that are used to solve problems more effectively.
OOP
OOP utilise real world concepts of objects and how they interact with each other. They consist of attributes (characteristics) and methods (features). It follows principles allowing for reusable and maintainable code.
Relationship with object, classes, methods and instances
a class is simply like a blueprint for an object. An object is then made from this class and the instances is a variables that holds this objects memory address. Methods of the object defines it behaviour and what it can do.
Encapsulation
The hiding of the implementation of a class and controlling its attributes and methods. Allows developers to hide how the classes are made but keep the relevant info (like methods and attributes) so it can be interacted with as anyone using the class only needs to understand its interface (attributes and methods)
Inheritance
Allows a child class to inherit attributes and methods from a parent class while keeping its unique ones. Reduces redundant code as enables subclassed to reuse exsiting functionality