Principles of programming Flashcards

(10 cards)

1
Q

What is a programming paradigm

A

the fundamental structure and approach of a programming language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Give six examples of programming paradigms

A

procedural languages
Non-procedural languages
Event-driven programming
Visual programming
Mark-up languages
Object-oriented programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe procedural languages

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe non-procedural languages (declarative)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe traditional procedural languages

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe event driven programming

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe visual programming languages

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe mark-up languages

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Describe object-oriented programming

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Give advantages of object oriented programming

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly