MODULE 5
A set of instructions to the computer that tells to do some specified task is called a program. A program is generally complete in it and is used by the author of the program only.
Software is a collection of meaningful programs that can together accomplish a defined task,along with its documentation. The software in a computer system acts as an interface between the user and hardware part of the computer. The command to be given to the hardware to perform the task is given and implemented through the software. A functional block diagram of the interface may like,
- APPLICATION SOFTWARE AND SYSTEM SOFTWARE
Software is the intangible part of the computer system. It acts as an interface between the user and the hardware in the other extreme. It may be of two types :
the application software and the system software.
Application software is a subclass of computer software that employs the capabilities of a computer directly and thoroughly to a task that the user wishes to perform. The application software is the software to serve the needs of the user. It is the computer software designed to help the user to perform the specified task. Common examples for the application software includes : Word processor(line MS word), Resource management software(banking software etc), entertainment software(games) etc.
Word processing (MS- word) :MS- Word is the word processing program which involves the transformation of written text into a form, that gives it a format. Systematic look that facilitates easy reading
A word is a computer based program that
-Is used to type text
-Correct spellings and grammar errors as we type
-Allows us to add headers and footers
-Allows us to share resources available to all office programs such as clip arts, drawing tools etc.
System software is computer software designed to operate the computer hardware and to provide and maintain a platform for running application software. System software serves the needs of the application software to work. So the system software arranges an environment for the application software to execute correctly and effectively. It may be considered as an interface between the application software and the hardware. So the above shown arrangement can be expanded as :
Some of the system software are OS, compiler etc.
- PROGRAMMING LANGUAGES
Programming languages are the medium to communicate between the user and the system. The communication is done in the form of programs. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication. A programming language is composed of a group of valid words usually called keywords which are having a specific meaning, and the grammarwhich specifies the right usages of the keywords.The instructions in a language are created using the right combination of these keywords. Any violation in the use of the keywords and the grammar in the program is an error. The set of valid instructions in a programming language is known as the instruction set. It will be different for different languages. When writing the program we should strictly follow the instruction set of the language used. The person who is building the program is the programmer.
Instructions to the computer are given with the help of computer languages. These languages can be classified as follows
- Machine languages
- Assembly language
- High level language
Machine languages
- It is the programming language in which the instruction set includes only 1s and 0s. It is the lowest level programming language. As it contains only 1s and 0s, it can be directly executed by the computer.
- All computer system has its own machine language. The programs are written in the machine readable format, so its execution is fast. But it is very difficult for the user to remember the instructions in the binary format. Also it is very difficult to understand the already written program. So it is rarely used for programming.
- Advantages
- Machine language is faster in execution
- It does not require any translation
- It makes efficient use of storage
- It can be used to manipulate individual bits
- Disadvantages
- Machine language is machine dependent
- It is difficult to understand and develop a program
- There are chances of frequent errors
- It is difficult to correct or modify programs
Assembly language
- Assembly language is a low level programming language which implements symbolic representations of the binary code. It is the next level to the machine language.
- Thekeywords in the assembly language are implemented in terms of mnemonics. It is highly machine dependent. It means the mnemonics of one machine may not be valid for other machine. So the assembly language programs are not portable between the machines.
- The assembly language program that is given to assembler for translation into machine language is called source program and the translated machine language program is called the object program.
- Writing assembly programs will be easier for the programmer than in the machine language as it is having mnemonics other than the binary combinations as in machine language. But the machine can understand only the code in binary format that is the machine readable format. So to execute the assembly language program it should be converted into the machine readable format.
- Because it is extremely low level, assembly language can be optimized extremely well. Therefore assembly language is used where the utmost performance is required for applications. Assembly language is also useful for communicating with the machine at a hardware level. For this reason, it is often used for writing device drivers.
Example of mnemonics are:
ADD – can be used for addition
MUL – can be used for multiplication
SUB – can be used for subtraction
- Advantages
- It gives more readability than machine language
- It is easier to understand and use
- It is easy to locate and correct errors
- Disadvantages
- It is machine oriented language
- It is less efficient than machine language
- It needs translator
High level language
- The high level language is the programming language that shows great abstraction from the details of the computer. The keywords are not specific to any of the machines. So it is portable. That means the same program can be reused in any of the machines.
- It uses English like words as keywords that areeasier for the programmer to remember.Also the program will be easy to understand. In writing the high level program the programmer does not have to worry about the address. The program written in the high level language must be translated into the machine readable format.
- Some commonly used high level languages are C, C++, java etc.
- Advantages
- It is machine independent
- It is easy to learn and use
- Errors in programming are less
- Program preparation cost is less
- Disadvantages
- Less efficient
- It is not flexible
- Requires more memory
- Slow in execution
- LANGUAGE TRANSLATORS
- Language translators are the system software that translates the program written in one language into other language.
- The user may develop program, in higher level languages as they are easy to develop and maintain. But a machine cannot understand a program written using high level language(HLL). These HLL programs are to be converted into machine language program before a computer can execute the program
- For that a special type of the system software is requires to convert HLL programs into corresponding machine language. Theyare known aslanguage translators.
- Their action involves two steps: First the input program is checked whether there is any error. The error means there is any violation in the valid keywords and the grammar. If there is any error it will produce the corresponding error message. If there is no error, the code will be converted into the machine language.The code written by the user is called the source code. It is converted by the translators to make the object code which can be executed by the machine.
The three major types of translators are:
- Assembler
- Interpreter
- Complier
Assembler:
- It is the software that converts the assembly code into the machine language. The process is called the assembly process.
- The user program that is fed as input to the translator is known as source program and the resultant machine language program is called the object program
Source Program
(Assembly Language) / Assembler / Object Program
(Machine Language)
Interpreter
- Interpreter is system software to translate the higher level program into the machine code.
- The interpreter is translating the code one by one at the time of execution. Only after the translation and execution of the first line the interpreter will go to process the 2nd line.
- Let a program is having an error in the last line. Then only after executing up to the last line the error will be revealed if in case of interpreter
- Example - BASIC interpreter
Source Program
(high level Language) / Interpreter / Object Program
(Machine Language)
Compiler
- Compiler is system software to translate the higher level program into the machine code.
- Incase of compiler, it will convert all the lines (means the entire program) into machine code first and then only the resulting code will start execute from the beginning.
- In compiler, the error will be handled before the starting of the execution.
- In case of loops the compiler will have to compile it only once.
Source Program
(high level Language) / Complier / Object Program
(Machine Language)
- Example - C compiler
Comparison between complier & Interpreter
COMPLIER / INTERPRETERScans the entire program first and translates it into machine code / Translate the program line by line
Converts the entire program to machine code, when all syntax errors are removed, execution takes place / Each time the program is executed, every line is checked for syntax errors, and then converted into equivalent machine code
Slow for debugging / Good for fast debugging
Execution time is less / Execution time is more
- OPERATING SYSTEM
- An Operating system is software or a collection of program that controls the execution of application programs and acts as an interface between hardware and user or applications. Its objectives are
(i) Convenience
-Makes the computer more convenient to use
(ii) Efficiency
-Allows computer system resources to be used in an efficient manner
Layers of computer system
A computer system can be divided roughly into four components: the hardware, the operating system and other system programs (utilities), the application programs, and the users.
- The primary goal of operating system isconvenience for the user. The OS provides an interface for the user to communicate with the hardware.The user friendliness of the system is brought to the user by the OS.
- One other goal of the OS is to provide efficiency for the computations. The efficiency is achieved by managing the resources in the optimized manner. It manages to ensure the availability of the resources for different programs at the correct time and deallocate the allocated resources for the programs that complete the use of the resource.
- The resources include memory, I/O devices, CPU etc. If more than one program is running at the same time, all programs will demand the resources for the execution but the resources are limited. The OS will manage to make all the resources available to the programs. The OS designed so that it better managed to get the maximum efficiency. To give efficiency the OS performs
- memory management
- process management
- I/O management
- Storage management
- Job scheduling
The OS performs the overall control to the system.
Types of operating systems
1)Multiprogrammed system: It is type of OS that support multiple programs running at the same time in the system.
2)Real time system: A real-time system is used when rigid time requirements have been placed on the operation of a processor or the flow of data; thus, it is often used as a control device in a dedicated application.
- Air traffic control
- Space shuttle
- Home appliance
- Nuclear power plant
3)Single user operating system : is a type of operating system that is developed and intended for use on a computer or similar machine that will only have single user at any given time
4)Multi user system:It is the type of OS that more than one user can use the system at the same time.
5)Batch processing operating system: here interaction between the user and the processor is limited or there is no interaction at all during execution of work. Data and programs that need to be processed are bundled and collected as a batch and executed together.
- PROGRAMMING
Programming is the process of creating programs to accomplish a defined task. The process of programming will be difficult in case of bigger programs. So to make the process easier, the task may be divided into small pieces and each part is separately solved and after that it is joined to make the software.
There are two approaches to the programming process : procedure oriented and object oriented.
Procedure oriented programming (POP):
Here the problem is viewed as a sequence of things to be done such as reading calculating, printing etc. POP mainly consist of writing a list of instructions and organize these instructions into functions. The primary focus is on functions. While creating the function a very little attention is given to the data that are being used by the functions. Most of the functions share the same data. Data moves around the system from function to function. Emphasis is mainly on doing things. The data that is shared by functions is vulnerable to abnormal changes. As the data shared by many functions, if we need to revise the data, we should revise the function that used the data also. The POP is not model real world situations.
The entire approach revolves around the procedures that need to be created and executed to accomplish the task. It involves the following steps:
- Analyze the problem.
- Determine the objectives (What is to be accomplished?).
- Identify the steps to be taken.
- Every step or action needs to be supported by a procedure.
- The steps are carried out (procedures are called) in a proper sequence to obtain the desired result.
e.g. you can break down the entire admission process into following subtasks:
- Accept a new student
- Validate the student’s documents
- Record number of subjects opted by the student
- Check the fee details of the student
- Maintain the student’s attendance.
Object oriented programming(OOP) : Object-oriented programming (OOP) is a programming paradigm that uses "objects" -consisting of data fields and methods together with their interactions – to design applications and computer programs. OOP treat data as acritical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the functions and protects it from accidental modifications from outside function. Here the emphasis is given to data rather than procedure. Here the program is divided into number of entities called OBJECTS. The object is a cage containing the data and the functions that is manipulating that data. The wrapping up of data and functions into a single structure is called theencapsulation.The data in an object can be accessed only by the function in that object.The data is hidden to the external functions. This process is known as Data hiding.Thus the accidental modification of the data can be avoided. Also a new object can be derived from an existing object. So the new object will have the properties of the parent object and the new object will have its own properties. This method of inheriting the behavior from the parent by the child is known as inheritance. Thus the same property can be reused.
Points to remember
- The problem is visualized and modeled in terms of objects, which is a realistic paradigm in nature.
- The OOP systems can be easily updated and upgraded from the point of view of software maintenance and development which otherwise would have been cost prohibitive.
- The data is the most critical central theme in oop. This enables us to focus on more details of data which is the most important precious resource.
- The data hiding provides more security to data and its maintenance.
- The inheritance enables better and optimal organization of data in an hierarchical model.
- The program development can concentrate more on message passing between the objects rather than on the general code.
- The OOP paradigm is a modern technology.
Software complexity is reduced
- OOP systems can be easily upgraded
- One to one relation can be established between the objects in the real world and those in the program.
- It is easier to partition the projects based on objects and interfaces.
- OOP has properties which procedural oriented programming doesn’t have.
They are:
Inheritance
Polymorphism
Encapsulation
Class extensibility
Abstract classes
Code reusability
Difference Between Procedure Oriented Programming (POP) & Object Oriented Programming (OOP)
Procedure Oriented Programming / Object Oriented Programming