A-WPS Office
A-WPS Office
A-WPS Office
OOP helps to keep the C++ code DRY "Don't Repeat Yourself", and makes the code easier to
maintain, modify and debug
OOP makes it possible to create full reusable applications with less code and shorter
development time
Classes and objects are the two main aspects of object-oriented programming.
Look at the following illustration to see the difference between class and objects:
class
Fruit
objects
Apple
Banana
Mango
Another example:
class
Car
objects
Volvo
Audi
Toyota
When the individual objects are created, they inherit all the variables and functions from the
class.
The four pillars for OOP are Abstraction, Encapsulation, Inheritance, Polymorphism.
Abstraction : Abstraction is the process of showing only essential/necessary features of an
entity/object to the outside world and hide the other irrelevant information. For example to
open your TV we only have a power button, It is not required to understand how infra-red
waves are getting generated in TV remote control.
Inheritance : The ability of creating a new class from an existing class. Inheritance is when an
object acquires the property of another object. Inheritance allows a class (subclass) to acquire
the properties and behavior of another class (super-class). It helps to reuse, customize and
enhance the existing code. So it helps to write a code accurately and reduce the development
time.
Polymorphism: Polymorphism is derived from 2 Greek words: poly and morphs. The word
"poly" means many and "morphs" means forms. So polymorphism means "many forms". A
subclass can define its own unique behavior and still share the same functionalities or behavior
of its parent/base class. A subclass can have their own behavior and share some of its behavior
from its parent class not the other way around. A parent class cannot have the behavior of its
subclass.
Computer Organization refers to the level of abstraction above the digital logic level, but below
the operating system level.
[HIERARCHY]
Click on the image to test your understanding of this hierarchy of abstraction in systems
organization.
At this level, the major components are functional units or subsystems that correspond to
specific pieces of hardware built from the lower level building blocks described in the previous
module.
A closely related term, computer architecture, emphasizes the engineering decisions and
tradeoffs that must be made in order to produce a "good" design. The computer architect
answers questions like...
Assembly Language
Since most compilers convert source code directly to machine code, software developers often
create programs without using assembly language. However, in some cases, assembly code can
be used to fine-tune a program. For example, a programmer may write a specific process in
assembly language to make sure it functions as efficiently as possible.
While assembly languages differ between processor architectures, they often include similar
instructions and operators. Below are some examples of instructions supported by x86
processors.
The following assembly language can be used to add the numbers 3 and 4:
Instruction Set Architecture (ISA)
The Instruction Set Architecture (ISA) is the part of the processor that is visible to the
programmer or compiler writer. The ISA serves as the boundary between software and
hardware. We will briefly describe the instruction sets found in many of the microprocessors
used today. The ISA of a processor can be described using 5 catagories:
Operand location
Can any ALU instruction operand be located in memory? Or must all operands be kept internaly
in the CPU?
Operations
What is the type and size of each operand and how is it specified?
General Purpose Register (GPR) - All operands are explicitely mentioned, they are either
registers or memory locations.
Lets look at the assembly code of
C = A + B;
in all 3 architectures:
POP C - -
Not all processors can be neatly tagged into one of the above catagories. The i8086 has many
instructions that use implicit operands although it has a general register set. The i8051 is
another example, it has 4 banks of GPRs but most instructions must have the A register as one
of its operands.
Stack
Disadvantages: A stack can't be randomly accessed This makes it hard to generate eficient code.
The stack itself is accessed every operation and becomes a bottleneck.
Accumulator
GPR
Advantages: Makes code generation easy. Data can be stored for long periods in registers.
Earlier CPUs were of the first 2 types but in the last 15 years all CPUs made are GPR processors.
The 2 major reasons are that registers are faster than memory, the more data that can be kept
internaly in the CPU the faster the program wil run. The other reason is that registers are easier
for a compiler to use.
Software, instructions that tell a computer what to do. Software comprises the entire set of
programs, procedures, and routines associated with the operation of a computer system. The
term was coined to differentiate these instructions from hardware—i.e., the physical
components of a computer system. A set of instructions that directs a computer’s hardware to
perform a task is called a program, or software program.
Computer hardware is any physical device used in or with your machine, whereas software is a
collection of programming code installed on your computer's hard drive. In other words,
hardware is something you can hold in your hand, whereas software cannot be held in your
hand. You can touch hardware, but you cannot touch software. Hardware is physical, and
software is virtual.
Memory
Video card
Motherboard
Processor
Power Supply
Monitor
Quite simply, computer hardware is the physical components that a computer system requires
to function. It encompasses everything with a circuit board that operates within a PC or laptop;
including the motherboard, graphics card, CPU (Central Processing Unit), ventilation fans,
webcam, power supply, and so on.