0% found this document useful (0 votes)
2 views7 pages

Further Programming

Uploaded by

rishabh2804sha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

Further Programming

Uploaded by

rishabh2804sha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Further Programming

20.1 Programming Paradigms


How many Programming Paradigms are there?
1. Low Level
2. Imperative
3. Object-Oriented
4. Declarative
Imperative

Declarative
Object-Oriented

OOP
Advantages of OOP:

5. Encapsulation
6. Data Hiding
7. Modularize Program code
8. Reusability
9. Classes are thoroughly tested
10. Allows to solve complex problems

OOP : Programming methodology that uses self contained objects, which contain programming
statements and data which communicate with each other.

Class : A class is a template / blueprint from which objects are created.

Object : It is an instance of a class.

Attributes : The data items in a class // Variables used inside a class

Properties :
Methods :

Inheritance :

Polymorphism :

Encapsulation :

Getter :

Setter :

Containment : Process by which one class can contain other classes.

Overloading : Feature of OOP that allows a method to be defined more than once in a class, so it can
be used in different situations.

Data Hiding : Technique which protects the integrity of an object by restricting access to the data and
methods within that object.

Constructor : A method used to create an object and assign initial values to the attributes.

Destructor : A method that is automatically invoked when an object is destroyed.

Parent Class : Base Class, the class from which class is being inherited.

Child Class : Class that inherits, also called derived class.


Low-Level Programming
Addressing Modes:

Immediate : LDM #n
Direct : LDD
Indirect : LDI
Relative : STO [BR] + 10 ; Store contents of the accumulator at address (Base Register + 10)
Indexed : LDX

Mneumonics are English labels for opcode

Declarative Programming
Variables : They either start with uppercase or underscore

Atoms : They start with lowercase letter

Rules : Relationships between facts // A clause with one or more conditions.

Declarative Programming : Statements of facts and rules together.

Anonymous Variable : A variable in who’s value we’re not interested in “_”

Argument : Terms written in a bracket of a goal or query.

Arity : The number of arguments a goal or query has.

Backtrack : When program answers no to a goal, it returns to the previous goal and tries to find another
solution.

Clause : Piece of information used to establish whether a goal is true.

Fact : A clause which is true

Goal : Something which we’re trying to prove.

Predicate : Collection of clauses whose heads all have the same function and arity.

Prompt : A symbol (usually “?”) used to indicate that the program is waiting foe the user to enter a
query.

Query : Goal entered by the user.

Trace and Debug :

Type “trace” to enter trace mode and then type the goal. Type “notrace” then nodebug to exit.

Lists :

Ordered Collection of terms. eg : [1, 2, 3] or [red, green, blue]

Head is the first element of the list and itself not a list.

Tail is the rest of the elements of the list and its a list.

[A, B, C, D] = A | [B, C, D]

Imperative Programming
It’s just normal programming languages like Python, Java and C++.
20.2 File Processing and Exception Handling
SEEK <filename>, <address> # To find the address
PUTRECORD <filename>, <recordname> # To store a record
GETRECORD <filename>, <recordname> # To retrieve an address of a record
OPEN <filename> FOR RANDOM # Use this open method to use the above commands

20.2.2 Exception Handling


Exception Handing is the process of responding to an exception within the program so that it doesn’t
halt unexpectedly.

TRY
<statements>
EXCEPT
<statements>
ENDTRY

You might also like