Principles of programming Flashcards
(10 cards)
What is a programming paradigm
the fundamental structure and approach of a programming language.
Give six examples of programming paradigms
procedural languages
Non-procedural languages
Event-driven programming
Visual programming
Mark-up languages
Object-oriented programming
Describe procedural languages
traditional e.g. c, c++, pascal
Written as an ordered set of instructions in a sequence that the computer followed strictly
Logical step-by-step process
Allows programmer to define precisely each step when performing a task
And control steps being carried out by the processor.
Usually in large/complex programs similar operations grouped together so they can be carried out at varying stages.
Used for writing wide range of programs; stock control, pay roll
Not ideal for GUI.
Very large programs more likely object oriented programming
Describe non-procedural languages (declarative)
allow programmers to specify the results they want without specifying how to solve the problem.
Written as list of facts and rules.
Order is unimportant.
Computer process these facts and rules to find a solution to a problem. E.g. prolog
Describe traditional procedural languages
text based; no form design tools
Starts with main procedure, calls other procedures
No problem if developing simple text-based user interfaces
More difficult if designing GUIs
Describe event driven programming
visual programming language.
Subroutines written to react to events that occur
E.g. mouse click, key presses, errors
More difficult to debug- in traditional, bugs can be traced from main procedure. Event driven has many starting point s
Describe visual programming languages
e.g. Visual Basic,
Easy creation of GUI objects e.g. forms, text boxes.
Rapid development of applications
Reduced need for traditional programming,
Event-driven.
Programming environment that is visual.
Purely visual e.g. scratch
Describe mark-up languages
E.g. html, xml
Not really paradigms but are key part of web programming.
Add commands to a text document to add further meaning to the text or to structure it.
HTML- uses tags and chevrons.
XML- extensible mark-up language.
Transferring structured data across the internet. More data base structure.
Describe object-oriented programming
encapsulation- collecting attributes and methods related to one thing into a single object.
Definition of an object = class
Instantiation- creating an object based on a class.
Protected and private attributes and methods accessible only within the class.
-| protected attributes and methods can be used by derived classes that inherit from that class.
Classes can be re-used. Objects can be created that inherit attributes and methods from another object
Give advantages of object oriented programming
more intuitive: combine data. Makes design easier as it can model the real world
Makes programming easier to maintain by encapsulation. Object complexity can be hidden from the program/ people who use it.
Abstraction: allow access only where necessary