Unit 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

CSP 101 -Unit 2

Basics of Programming, Programming Paradigms, System Software versus Application Software.


Hard Computing versus Soft Computing, Data Structures and Algorithms.
Computer Graphics, Multimedia, Computer Vision.

Basics of Programming: Almost all programs consist of the same basic


'building blocks', assembled in different ways to achieve a particular
goal. Variables, data types, sequence, selection, and iteration are
examples of these basic concepts, which all new programmers need to
learn. In order to compare and manipulate data, and to make decisions in
a program, programmers use a variety of different logical, relational,
and arithmetic operators. It is also useful to be able to
generate randomness in a program, for example selecting a random
number or a random item from a list.
Some of these concepts include:

 Variable Declaration
 Basic Syntax
 Data Type and Structures
 Flow Control Structures (Conditionals and loops)
 Functional Programming
 Object-Oriented Programming
 Debugging
 IDEs and Coding Environments

Programming paradigms :

There are several kinds of major programming paradigms:

1. Imperative
2. Logical
3. Functional
4. Object-Oriented
 Imperative: Computations are performed through a guided
sequence of steps, in which these variables are referred to or
changed. The order of the steps is crucial, because a given step
will have different consequences depending on the current
values of variables when the step is executed.

 Advantages
o efficient;
o close to the machine;
o popular;
o familiar.
 Disadvantages
o The semantics of a program can be complex to understand or
prove, because of referential transparency does not hold(due
to side effects)
o Side effects also make debugging harder;
o Abstration is more limitted than with some paradigms;
o Order is crucial, which doesn't always suit itself to problems.

 Logical:The Logical Paradigm takes a declarative approach to


problem-solving. Various logical assertions about a situation are
made, establishing all known facts. Then queries are made. The
role of the computer becomes maintaining data and logical
deduction.

o Logical Paradigm Programming:


A logical program is divided into three sections:
1. a series of definitions/declarations that define the
problem domain
2. statements of relevant facts
3. statement of goals in the form of a query
Any deducible solution to a query is returned. The definitions
and declarations are constructed entirely from relations. i.e. X
is a member of Y or X is in the internal between a and b etc.

o Advantages:
The advantages of logic oriented programming are bifold:
1. The system solves the problem, so the programming
steps themselves are kept to a minimum;
2. Proving the validity of a given program is simple.

 Functional:The Functional Programming paradigm views all


subprograms as functions in the mathematical sense-informally,
they take in arguments and return a single solution. The solution
returned is based entirely on the input, and the time at which a
function is called has no relevance. The computational model is
therefore one of function application and reduction.

o Languages
Functional languages are created based on the functional
paradigm. Such languages permit functional solutions to
problems by permitting a programmer to treat functions as
first-class objects(they can be treated as data, assumed to
have the value of what they return; therefore, they can be
passed to other functions as arguments or returned from
functions).
o Advantages
The following are desirable properties of a functional
language:
1. The high level of abstraction, especially when functions
are used, supresses many of the details of programming
and thus removes the possibility of commiting many
classes of errors;
2. The lack of dependence on assignment operations,
allowing programs to be evaluated in many different
orders. This evaluation order independence makes
function-oriented languages good candidates for
programming massively parallel computers;
3. The absence of assignment operations makes the
function-oriented programs much more amenable to
mathematical proof and analysis than are imperative
programs, because functional programs possess
referential transparency.
o Disadvantages
1. Perhaps less efficiencey
2. Problems involving many variables or a lot of
sequential activity are sometimes easier to handle
imperatively or with object-oriented programming.

 Object-Oriented:Object Oriented Programming (OOP) is a


paradigm in which real-world objects are each viewed as
seperate entities having their own state which is modified only
by built in procedures, called methods.

Because objects operate independently, they are encapsulated


into modules which contain both local environments and
methods. Communication with an object is done by message
passing.

Objects are organized into classes, from which they inherit


methods and equivalent variables. The object-oriented paradigm
provides key benefits of reusable code and code extensibility.

o Features & Benefits


A new class (called a derived class or subclass) may
be derived from another class (called a base
class or superclass) by a mechanism called inheritance. The
derived class inherits all the features of the base class: its
structure and behavior(response to messages). In addition, the
derived class may contain additional state (instance
variables), and may exhibit additional behavior (new
methods to resond to new messages). Significantly, the
derived class can also override behavior corresponding to
some of the methods of the base class: there would be a
different method to respond to the same message. Also, the
inheritance mechanism is allowed even without access to the
source code of the base class.

The ability to use inheritance is the single most


distinguishing feature of the OOP paradigm. Inheritance
gives OOP its chief benefit over other programming
paradigms - relatively easy code reuse and extension without
the need to change existing source code.

The mechanism of modeling a program as a collection of


objects of various classes, and furthermore describing many
classes as extensions or modifications of other classes,
provides a high degree of modularity.

Ideally, the state of an object is manipulated and accessed


only by that object's methods. (Most O-O languages allow
direct manipulation of the state, but such access is
stylistically discouraged). In this way, a class' interface (how
objects of that class are accessed) is separate from the
class' implementation (the actual code of the class' methods).
Thus encapsulation and information hiding are inherent
benefits of OOP.
System Software versus Application Software.
Computer software is a set of instructions or programs instructing the computer to do specific
tasks. Software is basically a generic term used to describe computer programs. In general,
scripts, applications, programs and a set of instructions are all terms often used to describe a
software.
Those computer software that control and monitor the computer hardware and provide essential
functionality to the computer are called system software. Therefore, system software are
essential parts of a computer, which means a computer cannot perform its functions without
system software. System software are entirely responsible for creating an interface between the
computer’s user and computer hardware.
System software are the system-side computer programs that are required for the working of the
computer itself, although the user of the computer does not need to know about the functionality
of system software while using the computer. Examples of system software include: operating
systems, device drivers, language processors, etc.
An application software may be a set of computer programs or a single computer program.
These software provide the required functionality for a specific purpose. Thus, a computer user
uses these software to accomplish a specific task.
The different types of application software can be developed to accomplish different tasks such
as word processing, playing multimedia files, database applications, spreadsheets, accounting,
graphic designing, etc. The most common examples of application software are: MS-Word,
Excel, PowerPoint, browsers, video editors, etc.

Difference between System Software and Application Software


Both system software and application software are essentially required for using the computer. But they
are completely different from each other in many aspects like programing languages, purposes,
development processes, etc. The important differences between a system software and an application
software are listed in the following table −

Parameter System Software Application Software

Definition System Software is the type of Application Software is the type of


software which is the interface software which runs as per user
between application software and request. It runs on the platform
system. which is provide by system
software.

Development In general, System software are In case of Application software,


Language developed using low-level language high level language is used for
which is more compatible with the their development as they are
system hardware in order to interact developed as some specific
with. purpose software.

Necessity System software are essential for Application software are not
operating the computer hardware. essential for the operation of the
Without these software, a computer computer. These are installed as
even may not start or function per the user’s requirements.
properly.

Usage System software is used for Application software is used by


operating computer hardware. user to perform specific task.

Installation System software are installed on the Application software are installed
computer when operating system is according to user’s requirements.
installed.

User System software are specific to Users can interact with an


interaction system hardware, so less or no user application software with the help
interaction available in case of of a User Interface (UI).
system software.

Dependency System software can run An application software cannot


independently. It provides platform run independently. It cannot run
for running application software. without the presence of system
software.

Examples Examples of system software Examples of application software


include operating systems, include word processors, web
compilers, assemblers, debuggers, browsers, media players, etc.
drivers, etc.

Difference between Soft Computing and Hard Computing:


S.No Soft Computing Hard Computing

Soft Computing is liberal of


inexactness, uncertainty,
partial truth and Hard computing needs a exactly
1. approximation. state analytic model.

Soft Computing relies on


formal logic and probabilistic Hard computing relies on
2. reasoning. binary logic and crisp system.
Soft computing has the Hard computing has the
features of approximation and features of exactitude(precision)
3. dispositionality. and categoricity.

Soft computing is stochastic in Hard computing is deterministic


4. nature. in nature.

Soft computing works on Hard computing works on exact


5. ambiguous and noisy data. data.

Soft computing can perform Hard computing performs


6. parallel computations. sequential computations.

Soft computing produces Hard computing produces


7. approximate results. precise results.

Soft computing will emerge Hard computing requires


8. its own programs. programs to be written.

Soft computing incorporates


9. randomness . Hard computing is settled.

Soft computing will use Hard computing uses two-


10. multivalued logic. valued logic.

What are Data Structures?


Data structure is a storage that is used to store and organize data. It is a
way of arranging data on a computer so that it can be accessed and
updated efficiently.
Depending on your requirement and project, it is important to choose the
right data structure for your project. For example, if you want to store
data sequentially in the memory, then you can go for the Array data
structure.

Types of Data Structure


Basically, data structures are divided into two categories:

1. Linear
ar data structure
2. Non-linear
linear data structure

Linear data structures


In linear data structures, the elements are arranged in sequence one after
the other. Since elements are arranged in particular order, they are easy
to implement.
However, when the comp
complexity
lexity of the program increases, the linear data
structures might not be the best choice because of operational
complexities.

Popular linear data structures are:

1. Array Data Structure


In an array, elements in memory are arranged in continuous memory. AllA
the elements of an array are of the same type. And, the type of elements
that can be stored in the form of arrays is determined by the
programming language.

An array
An array with each element represented by an index

2. Stack Data Structure


In stack data structure, elements are stored in the LIFO principle. That
is, the last element stored in a stack will be removed first.
It works just like a pile of plates where the last plate kept on the pile will
be removed first. To learn more, visit Stack Data Structure.
stack
In a stack, operations can be perform only from one end (top here).

3. Queue Data Structure


Unlike stack, the queue data structure works in the FIFO principle where
first element stored in the queue will be removed first.

It works just like a queue of people in the ticket counter where first
person on the queue will get the ticket first. To learn more, visit Queue
Data Structure.
queue
In a queue, addition and removal are performed from separate ends.

4. Linked List Data Structure


In linked list data structure, data elements are connected through a series
of nodes. And, each node contains the data items and address to the next
node.

Characteristics of an Algorith
Algorithm
Unambiguous − Algorithm should be clear and unambiguous. Each of its steps (or
phases), and their inputs/outputs should be clear and must lead to only one
meaning.
Input − An algorithm should have 0 or more well-defined inputs.

Output − An algorithm should have 1 or more well-defined outputs, and should


match the desired output.

Finiteness − Algorithms must terminate after a finite number of steps.

Feasibility − Should be feasible with the available resources.

Independent − An algorithm should have step-by-step directions, which should be


independent of any programming code.
Problem − Design an algorithm to add two numbers and display the result.

Step 1 − START
Step 2 − declare three integers a, b & c
Step 3 − define values of a & b
Step 4 − add values of a & b
Step 5 − store output of step 4 to c
Step 6 − print c
Step 7 − STOP
What is computer Graphics?

Computer graphics is an art of drawing pictures, lines, charts, etc using


computers with the help of programming. Computer graphics is made up
of number of pixels. Pixel is the smallest graphical picture or unit
represented on the computer screen.

OR

It is the use of computers to create and manipulate pictures on a display


device. It comprises of software techniques to create, store, modify,
represents pictures.

Types of Computer Graphics

1. Raster Graphics: In raster graphics pixels are used for an image


to be drawn. It is also known as a bitmap image in which a
sequence of image is into smaller pixels. Basically a bitmap
indicates a large number of pixels together.

2. Vector Graphics: In vector graphics, mathematical formulae are


used to draw different types of shapes, lines, objects and so on.

Application of Computer Graphics


1. Education and Training: Computer-generated model of the physical,
financial and economic system is often used as educational aids. Model
of physical systems, physiological system, population trends or
equipment can help trainees to understand the operation of the system.
For some training applications, particular systems are designed. For
example Flight Simulator.
Flight Simulator: It helps in giving training to the pilots of airplanes.
These pilots spend much of their training not in a real aircraft but on the
ground at the controls of a Flight Simulator.
Advantages:
1. Fuel Saving
2. Safety
3. Ability to familiarize the training with a large number of the
world's airports.

2. Use in Biology: Molecular biologist can display a picture of


molecules and gain insight into their structure with the help of computer
graphics. SecOriginal Apple computer sold for $400k at auction
3. Computer-Generated Maps: Town planners and transportation
engineers can use computer-generated maps which display data useful to
them in their planning work.
4. Architect: Architect can explore an alternative solution to design
problems at an interactive graphics terminal. In this way, they can test
many more solutions that would not be possible without the computer.
5. Presentation Graphics: Example of presentation Graphics are bar
charts, line graphs, pie charts and other displays showing relationships
between multiple parameters. Presentation Graphics is commonly used
to summarize
 Financial Reports
 Statistical Reports
 Mathematical Reports
 Scientific Reports
 Economic Data for research reports
 Managerial Reports
 Consumer Information Bulletins
 And other types of reports

6. Computer Art: Computer Graphics are also used in the field of


commercial arts. It is used to generate television and advertising
commercial.
7. Entertainment: Computer Graphics are now commonly used in
making motion pictures, music videos and television shows.
8. Visualization: It is used for visualization of scientists, engineers,
medical personnel, business analysts for the study of a large amount of
information.
9. Educational Software: Computer Graphics is used in the
development of educational software for making computer-aided
instruction.
10. Printing Technology: Computer Graphics is used for printing
technology and textile design.
Concept of Multimedia
Multi Many, Multiple,
Media Tools that is used to represent or do a certain things, delivery medium, a
form of mass communication – newspaper, magazine / tv. Distribution tool
& information presentation – text, graphic, voice, images, music and etc
Multimedia is a combination of text, graphic, sound, animation, and video that is
delivered interactively to the user by electronic or digitally manipulated means.

Examples of recent applications of multimedia are electronic books and newspapers,


electronic classroom presentation technologies, full-motion videoconferencing,
sophisticated imaging, and graphics design tools.
Components of Multimedia
Following are the common components of multimedia:
 Text- All multimedia productions contain some amount of text. The text can have various
types of fonts and sizes to suit the profession presentation of the multimedia software.
 Graphics- Graphics make the multimedia application attractive. In many cases people do
not like reading large amount of textual matter on the screen. Therefore, graphics are
used more often than text to explain a concept, present background information etc.
There are two types of Graphics:
o Bitmap images- Bitmap images are real images that can be captured from
devices such as digital cameras or scanners. Generally bitmap images are not
editable. Bitmap images require a large amount of memory.
o Vector Graphics- Vector graphics are drawn on the computer and only require a
small amount of memory. These graphics are editable.
 Audio- A multimedia application may require the use of speech, music and sound effects.
These are called audio or sound element of multimedia.Speech is also a perfect way for
teaching. Audio are of analog and digital types. Analog audio or sound refers to the
original sound signal. Computer stores the sound in digital form. Therefore, the sound
used in multimedia application is digital audio.
 Video- The term video refers to the moving picture, accompanied by sound such as a
picture in television. Video element of multimedia application gives a lot of information in
small duration of time. Digital video is useful in multimedia application for showing real life
objects. Video have highest performance demand on the computer memory and on the
bandwidth if placed on the internet. Digital video files can be stored like any other files in
the computer and the quality of the video can still be maintained. The digital video files
can be transferred within a computer network. The digital video clips can be edited easily.
 Animation- Animation is a process of making a static image look like it is moving. An
animation is just a continuous series of still images that are displayed in a sequence. The
animation can be used effectively for attracting attention. Animation also makes a
presentation light and attractive. Animation is very popular in multimedia application

Applications of Multimedia
Following are the common areas of applications of multimedia.
 Multimedia in Business- Multimedia can be used in many applications in a business.
The multimedia technology along with communication technology has opened the door
for information of global wok groups. Today the team members may be working anywhere
and can work for various companies. Thus the work place will become global. The
multimedia network should support the following facilities:
o Voice Mail
o Electronic Mail
o Multimedia based FAX
o Office Needs
o Employee Training
o Sales and Other types of Group Presentation
o Records Management
 Multimedia in Marketing and Advertising- By using multimedia marketing of new
products can be greatly enhanced. Multimedia boost communication on an affordable
cost opened the way for the marketing and advertising personnel. Presentation that have
flying banners, video transitions, animations, and sound effects are some of the elements
used in composing a multimedia based advertisement to appeal to the consumer in a way
never used before and promote the sale of the products.
 Multimedia in Entertainment- By using multimedia marketing of new products can be
greatly enhanced. Multimedia boost communication on an affordable cost opened the
way for the marketing and advertising personnel. Presentation that have flying banners,
video transitions, animations, and sound effects are some of the elements used in
composing a multimedia based advertisement to appeal to the consumer in a way never
used before and promote the sale of the products.
 Multimedia in Education- Many computer games with focus on education are now
available. Consider an example of an educational game which plays various rhymes for
kids. The child can paint the pictures, increase reduce size of various objects etc apart
from just playing the rhymes.Several other multimedia packages are available in the
market which provide a lot of detailed information and playing capabilities to kids.
 Multimedia in Bank- Bank is another public place where multimedia is finding more and
more application in recent times. People go to bank to open saving/current accounts,
deposit funds, withdraw money, know various financial schemes of the bank, obtain loans
etc. Every bank has a lot of information which it wants to impart to in customers. For this
purpose, it can use multimedia in many ways. Bank also displays information about its
various schemes on a PC monitor placed in the rest area for customers. Today on-line
and internet banking have become very popular. These use multimedia extensively.
Multimedia is thus helping banks give service to their customers and also in educating
them about banks attractive finance schemes.
 Multimedia in Hospital- Multimedia best use in hospitals is for real time monitoring of
conditions of patients in critical illness or accident. The conditions are displayed
continuously on a computer screen and can alert the doctor/nurse on duty if any changes
are observed on the screen. Multimedia makes it possible to consult a surgeon or an
expert who can watch an ongoing surgery line on his PC monitor and give online advice
at any crucial juncture.
In hospitals multimedia can also be used to diagnose an illness with CD-ROMs/
Cassettes/ DVDs full of multimedia based information about various diseases and their
treatment.Some hospitals extensively use multimedia presentations in training their junior
staff of doctors and nurses. Multimedia displays are now extensively used during critical
surgeries.
 Multimedia Pedagogues- Pedagogues are useful teaching aids only if they stimulate
and motivate the students. The audio-visual support to a pedagogue can actually help in
doing so. A multimedia tutor can provide multiple numbers of challenges to the student to
stimulate his interest in a topic. The instruction provided by pedagogue have moved
beyond providing only button level control to intelligent simulations, dynamic creation of
links, composition and collaboration and system testing of the user interactions.
 Communication Technology and Multimedia Services- The advancement of high
computing abilities, communication ways and relevant standards has started the
beginning of an era where you will be provided with multimedia facilities at home.

• Computer vision is a field of artificial intelligence (AI) that


enables computers and systems to derive meaningful
information from digital images, videos and other visual inputs
and take actions or make recommendations based on that
information.
• Computer vision is an interdisciplinary scientific field that
deals with how computers can gain high
high-level
level understanding
from digital image
images or videos.

You might also like