SlideShare une entreprise Scribd logo
1  sur  19
COMPUTER PROGRAMMING:
A programming language is a set of instructions used to communicate with the
computer and the set of instructions written in a programming language is called
a Program. Programming is the implementation of logic to facilitate specified
computing operations and functionality.
Programming language semantics and syntax are used when constructing an
application. Thus, programming requires knowledge of application domains,
algorithms and programming language expertise. Programming language logic
differs by developer. From a high level, good code can be evaluated with factors
such as:
• Robustness: Focuses on program continuation capability, regardless of
errors or incorrect data
• Reliability: Focuses on correct design and algorithm implementation
• Efficiency: Focuses on memory, hardware or other properties used to
optimize programs
• Readability: Proper documentation and indentation availability, which
provides insight to other program developers or designers
It occurs in one or more languages, which differ by application, domain and
programming model. Programming languages for computers are developed with
the primary objective of facilitating a large number of persons to use computers
without the need to know in detail the internal structure of a computer.
Languages are matched to the type of applications which are to be programmed
using the language. The ideal language would be one which expresses precisely
the specification of a problem to be solved, and converts it into a series of
instructions for a computer. It is not possible to achieve this ideal as a clear
Suneel Dogra 1
SD College Hoshiarpur
specification of a problem is often not available and developing an algorithm from
specifications requires subject knowledge and expertise. In actual practice, a
detailed algorithm to solve a problem is the starting point and it is expressed as a
program in a programming language. A large number of languages, over a
thousand, exist each catering to a different class of applications. All modern
programming languages (with one exception) are designed to be machine
independent. In other words, the structure of the programming language would
not depend upon the internal structure of a specified computer; one should be
able to execute a program written in the programming language on any computer
regardless of who manufactured it or what model it is. Such languages are known
as high level machine independent programming languages. A computer
language means, a set of rules and symbols used to operate a computer.
Whatever command we give to computer, it is first converted in its own language.
A computer language is also known as Programming Language. There are
various types of programming languages. These languages are used to write
programs to tell the computer what to do. Users who write these programs are
called programmers. Each computer language has its own set of rules and
grammar. These are called the syntax rules of the language. This syntax rules
should be followed while writing a program. Computer Languages have
progressed over the years just like hardware. Starting from the language made
up to just two symbols 0 and 1, today, you can make the computer programs
using common English and Mathematical terms.
CLASSIFICATION OF PROGRAMMING LANGUAGES:
Suneel Dogra 2
SD College Hoshiarpur
Classification of programming languages. We have classified high level machine
independent languages into three groups, namely, procedural, non-procedural
and Problem-oriented.
Classification of Programming Languages.
LOW LEVEL LANGUAGES:
The languages which use only primitive operations of the computer are known as
low language. In these languages, programs are written by means of the memory
and registers available on the computer. Since the architecture of computer
differs from one machine to another, so far each type of computer there is a
separate low level programming language. In the other words, Programs written
in one low level language of one, architectural can’t be ported on any other
machine dependent languages. Examples are Machine Language and Assembly
Language.
MACHINE LEVEL LANGUAGE
Suneel Dogra 3
SD College Hoshiarpur
You know that a computer can understand only special signals, which are
represented by 1’s and 0’s. These two digits are called binary digits. Computer
understands program written in binary digits. The language, which uses binary
digits, is called the machine level language. Computer works in bits and bytes. It
understands the language of the binary digits, 0 and 1. You may write a program
in whichever language you want, but it is finally converted into the language of 0s
and 1s before it gets executed. Writing a program in machine language is
definitely very difficult. It is not possible to memorize a long string of 0s and 1s
for every instruction that you want to derive executed. It is proper that before the
higher levels of programming languages were designed, machine languages were
old-fashioned for writing programming codes, but they are no longer traditional
for designing computer programs.
A machine language is a collection of very detailed cryptic instructions that
control computer’s internal circuitry. It is language that a computer actually
understands. It is viewed as sequences of 1`s and 0`s that a program written in
any language is finally translated to. In machine language program, the
computation is based on binary numbers. All the instructions including operations,
registers, data and memory locations are given in there binary equivalent.
The machine directly understands this language by virtue of its circuitry design so
these programs are directly executable on the computer without any translations.
This makes the program execution very fast. Machine languages are also known
as first generation languages.
A machine language consists of the numeric codes for the operations
that a particular computer can execute directly. The codes are strings of 0s and
1s, or binary digits (“bits”), which are frequently converted both from and to
Suneel Dogra 4
SD College Hoshiarpur
hexadecimal (base 16) for human viewing and modification. Machine language
instructions typically use some bits to represent operations, such as addition, and
some to represent operands, or perhaps the location of the next instruction.
Machine language is difficult to read and write, since it does not resemble
conventional mathematical notation or human language, and its codes vary from
computer to computer.
Machine language is the only language that a computer understands.
Each statement in a machine language program is a sequence of bits. Each bit
may be set to 0 or 1. Series of bits represent instructions that a computer can
understand. For example, the number 455 is represented by the bit sequence
111000111. Machine language is a low-level programming language. It is easily
understood by computers but difficult to read by people. This is why people use
higher level programming languages. Programs written in high-level languages
are compiled and/or interpreted into machine language so computers can execute
them.
ASSEMBLY LANGUAGE:
The first step in the evolution of programming languages was the development of
what is known as an assembly language. In an assembly language, mnemonics
are used to represent operations to be performed by the computer and strings
of characters to represent addresses of locations in the computer’s memory
where the operands will be stored. Thus the language is matched to a particular
computer’s processor structure and is thus machine dependent. A translator
called an assembler translates a program written in assembly language to a set of
machine instructions, which can be executed by a computer. Now-a-days
programs are written in assembly language only in applications which are cost
Suneel Dogra 5
SD College Hoshiarpur
sensitive or time critical as efficiency of machine code is of paramount importance
in these types of applications. A cost sensitive application is one in which
microprocessors are used to enhance the functionality of consumer items such as
washing machines or music systems. In these cases the program is stored in a
read only memory and its size is small. Thus code optimization
is important. A time-critical application is use of microprocessors in aircraft
controls where real time operation of the system is required. Here again the
number of machine instructions executed should be minimized.
Assembly languages are also known as second generation languages. These
languages substitutes alphabetic or numeric symbols for the binary codes of
machine language. That is, we can use mnemonics for all opcodes, registers and
for the memory locations which provide us with a facility to write reusable code in
the form of macros. Has two parts, one is macro name and the other is macro
body which contains the line of instructions. A macro can be called at any point of
the program by its name to use the instruction. A macro can be called at any
point of the program by its name to use the instructions given in the macro
repetitively.
These languages require a translator known as “Assembler” for translating the
program code written in assembly language to machine language. Because
computer can interpret only the machine code instruction, once the translation is
completed the program can be executed.
Assembly language is one level above machine language. It uses short mnemonic
codes for instructions and allows the programmer to introduce names for blocks
of memory that hold data. One might thus write “add pay, total” instead of
“0110101100101000” for an instruction that adds two numbers. Assembly
Suneel Dogra 6
SD College Hoshiarpur
language is designed to be easily translated into machine language. Although
blocks of data may be referred to by name instead of by their machine addresses,
assembly language does not provide more sophisticated means of organizing
complex information. Like machine language, assembly language requires
detailed knowledge of internal computer architecture. It is useful when such
details are important, as in programming a computer to interact with input/output
devices (printers, scanners, storage devices, and so forth).
Assembly language is a representation of machine language. In other words,
each assembly language instruction translates to a machine language instruction.
The advantage of assembly language is that its instructions are readable. For
example, assembly language statements like MOV and ADD are more
recognizable than sequences of 0s and 1s. Though assembly language statements
are readable, the statements are still low-level. Another disadvantage of
assembly language is that it is not portable. In other words, assembly language
programs are specific to a particular hardware. Assembly language programs for
a Mac will not work on a PC. But this can be an advantage for programmers who
are targeting a specific platform and need full control over the hardware.
HIGH LEVEL LANGUAGE
High-level languages are what most programmers use. A high level language is a
collection of instructions that resemble human languages. This provides more
compatibility of the language with the human thought process. E.g. FORTRAN,
BASIC, PASCAL, C, JAVA etc. Languages such as C++ and Java are all high-level
languages. One advantage of high-level languages is that they are very readable.
The statements in these languages are English-like. For example, you can gain a
basic understanding of what a Java program is doing by simply reading the
Suneel Dogra 7
SD College Hoshiarpur
program source code. High-level languages use English words as statements.
Loops in Java programs are indicated by the words for, while and do. Another
advantage of high-level languages is that they are less tedious to use. A single
statement in a high-level language can translate into many machine language
statements. Finally, high-level languages are usually portable. A disadvantage of
high-level languages is that they are usually less powerful and less efficient. Since
statements are high-level, you cannot code at the bit level the way you can with
assembly language. High-level languages also need to be compiled and/or
interpreted into machine language before execution.
High-level languages offer many advantages over low level languages and are
thus preferred for program development. Some main advantages are:
SIMPLICITY & PROGRAMMING EFFICIENCY: Generally, a single instruction
in a high-level language corresponds to a set of multiple machine language
instructions. This greatly enhances simplicity of program development i.e. leads
to higher programming efficiency and productivity.
UNIFORMITY: The rules that apply to the programming, in a particular high-
level language, for a particular computer are much the same for other computers
also.
PORTABILITY: Uniformity supports high degree of portability on computers of
same type. Even if the instruction sets of the computers differ, it is the task of
the compiler to suit them (see below for compiler) and the rules for programming
remain essentially the same i.e. the same program can be run on different
computers. Since, portability depends on the compiler of the language (may be
available for the instruction set or not) or the libraries accompanying the
Suneel Dogra 8
SD College Hoshiarpur
language, high degree of portability is the benefit provided by only few high-level
languages and absolute portability is still a big quest of the day.
Although, nearly whole of the programming world is dominated by the high -
level programming languages due to their higher program efficiency and
productivity, the assembly language still maintains its place in low level
programming and hardware interaction, especially for high performance systems.
PROCEDURAL LANGUAGE:
Procedural language is a computer programming language that specifies a series
of well-structured steps and procedures within its programming context to
compose a program. It contains a systematic order of statements, functions and
commands to complete a computational task or program. Procedural language is
also known as imperative language.
Procedural language, as the name implies, relies on predefined and well-
organized procedures, functions or sub-routines in a program’s architecture by
specifying all the steps that the computer must take to reach a desired state or
output.
Procedural language segregates a program within variables, functions,
statements and conditional operators. Procedures or functions are implemented
on the data and variables to perform a task. These procedures can be
called/invoked anywhere between the program hierarchy, and by other
procedures as well. A program written in procedural language contains one or
more procedures.
Procedural language is one of the most common programming languages in use
with notable languages such as C/C++, Java, Cold Fusion and PASCAL.
Suneel Dogra 9
SD College Hoshiarpur
The procedural programming methodology involves dividing a large program
into a set of sub-procedures or subprograms that perform specific tasks. In
this methodology, a program is divided into one or more units or modules.
These modules can be user-defined or can be taken from libraries.
A module can consist of single or multiple procedures. These procedures are
also known as functions, routines, subroutines, or methods in various
programming languages.
A procedural program can consist of multiple levels or scopes. A procedure
can be defined independently or within another procedure. The level of the
procedure depends on the definition. Similarly, the data available in the
procedure also exhibits various levels or scopes. The procedure of a higher or
outer scope cannot access the data within the procedure that has lower or
inner scope.
A procedure or a subprogram is a set of commands that can be executed
independently. In a program following procedural methodology, each step of
a subprogram is linked to the previous step.
Suneel Dogra 10
SD College Hoshiarpur
For example, in a program that needs to accept, display, and print data, you
can divide the program into subprograms. You can create three subprograms
that accept data, display data, and print data, respectively. Each subprogram
performs a defined function while the combined action of subprograms
makes a complete program.
In procedural programming, you can use a subprogram at multiple locations
within a program to perform a specific task.
This enables you to reuse the program code as and when required in a
program, without rewriting the entire code, as shown in the figure:
The figure displays a program that consists of three procedures. Accept Data,
Display Data, and Print Data. Data is accepted in the Accept Data procedure,
displayed in the Display Data procedure, and printed in the Print Data
procedure.
Procedural programming is used for developing simple applications. The
languages that use the procedural programming methodology include Pascal
and C languages.
Some of the benefits of the procedural programming methodology are:
• Easy to read program code.
Suneel Dogra 11
SD College Hoshiarpur
• Easy maintainable program code as various procedures can be
debugged in isolation.
• Code is more flexible as you can change a specific procedure that gets
implemented across the program.
The features of procedural programming methodology are:
• Large programs are divided into smaller programs.
• Most of the data is shared as global that can be accessed from
anywhere within the program.
In the procedural programming approach, portions of the code are so
interdependent that the code in one application cannot be reused in another.
For example, the module used to calculate the salary of the employees in a
bank management system cannot be used to calculate the salary of the
employees in an educational institute. You need to create a separate module
to calculate the salary of the employees in an educational institute.
When you need to reuse the procedural program in another application, a
change in the application results in rewriting a large portion of the code. This
results in decreased productivity and increased maintenance cost of the
application. This was one of the reasons that led to the evolution of the
object-oriented approach.
Suneel Dogra 12
SD College Hoshiarpur
NON-PROCEDURAL LANGUAGE:
Programming languages that are based on functions or logic are
representatives of what is called declarative programming, due to the fact
that (to some extent) the users state what to be solved and the
computers solve it. Programs written in declarative languages are usually
self-explanatory, succinct, and much shorter than their counterparts in
procedural or object-oriented languages.
Non-procedural programming languages allow users and professional
programmers to specify the results they want without specifying how to
solve the problem. Examples are FORTRAN, C++, COBOL, ALGOL etc. A
computer language that does not require writing traditional programming
logic. Also known as a "declarative language," users concentrate on defining
the input and output rather than the program steps required in a procedural
programming language such as C++ or Java. Functional programming is
about writing and composing functions. The central idea lies in symbolic
manipulation as computation -- the use of recursive functions defined over
lists provides a computational framework with the full power of expressing
deterministic computations. You will be presented with a brief overview of
functional programming in LISP, and you will use it to solve a number of
problems. We will introduce lambda calculus as a foundation for functional
programming, and an abstract machine called SECD as a model of executing
compiled lisp programs.
Logic programming draws the idea of programming as specifying solutions in
a logic and logic deduction as computation. You will learn how to turn a
Suneel Dogra 13
SD College Hoshiarpur
subset of logic into a programming language. For the practical aspect, you
will write small yet interesting programs in Prolog (Programming in Logic).
We will also introduce constraint programming, perhaps one of the most
exciting developments in programming languages in the last decade.
PROBLEM-ORIENTED LANGUAGE:
These are high level language designed for developing a convenient
expression of the given class of problem.
STRUCTURED PROGRAMMING
Structured programming (sometimes known as modular programming) is a
subset of procedural programming that enforces a logical structure on the
program being written to make it more efficient and easier to understand
and modify. Certain languages such as Ada, Pascal, and dBASE are designed
with features that encourage or enforce a logical program structure.
Structured programming frequently employs a top-down design model, in
which developers map out the overall program structure into separate
subsections. A defined function or set of similar functions is coded in a
separate module or sub module, which means that code can be loaded into
memory more efficiently and that modules can be reused in other programs.
After a module has been tested individually, it is then integrated with other
modules into the overall program structure.
Program flow follows a simple hierarchical model that employs looping
constructs such as "for," "repeat," and "while." Use of the "Go To" statement
is discouraged.
Suneel Dogra 14
SD College Hoshiarpur
Structured programming was first suggested by Corrado Bohm and Guiseppe
Jacopini. The two mathematicians demonstrated that any computer program
can be written with just three structures: decisions, sequences, and loops.
Edsger Dijkstra's subsequent article, Go To Statement Considered Harmful
was instrumental in the trend towards structured programming. The most
common methodology employed was developed by Dijkstra. In this model
(which is often considered to be synonymous with structured programming,
although other models exist) the developer separates programs into
subsections that each have only one point of access and one point of exit.
Almost any language can use structured programming techniques to avoid
common pitfalls of unstructured languages. Unstructured programming must
rely upon the discipline of the developer to avoid structural problems, and as
a consequence may result in poorly organized programs. Most modern
procedural languages include features that encourage structured
programming. Object-oriented programming (OOP) can be thought of as a
type of structured programming, uses structured programming techniques
for program flow, and adds more structure for data to the model.
STRUCTURED PROGRAMMING CAN BE DEFINED AS :
1. Top-Down Analysis for Program Solving
2. Modularization for program structure
Suneel Dogra 15
SD College Hoshiarpur
3. Structure code for individual modules
TOP-DOWN ANALYSIS FOR PROGRAM SOLVING
A top-down approach (also known as stepwise design) is essentially the
breaking down of a system to gain insight into the sub-systems that make it
up. In a top-down approach an overview of the system is formulated,
specifying but not detailing any first-level subsystems. Each subsystem is
then refined in yet greater detail, sometimes in many additional subsystem
levels, until the entire specification is reduced to base elements. Once these
base elements are recognized then we can build these as computer modules.
Once they are built we can put them together, making the entire system
from these individual components.
In recent years, computer memory ceased to be the limitation factor for
most of the application programs. This, along with increasing software
complexity and maintenance hitches, shifted the focus from the execution
time to the programming techniques adopted in development of a program.
It allowed programs to be written in a more organized manner, i.e., in a
structured manner, producing code that is easier to read, analyze, and
modify later – if the need arose. With increasing demands for software
efficiency and programming standardization, a changed approach saw the
programmers examining the problem as a whole and outlining the major
steps to solve the problem. Then the process was repeated and the steps
thus obtained were broken down in finer details. This is the top-down
programming approach and is used in structured programming.
Suneel Dogra 16
SD College Hoshiarpur
1. Define exactly what data the program will get and what it has to do with
them.
2. If the task is simple enough, write the program code.
3. Otherwise, split the task into smaller parts and define exactly the duty of
each part and interface to the rest of the program.
4. Repeat the steps 1–4 separately for each subtask.
MODULAR PROGRAMMING
Modular programming (also called "top-down design" and "stepwise
refinement") is a software design technique that emphasizes separating the
functionality of a program into independent, interchangeable modules, such
that each contains everything necessary to execute only one aspect of the
desired functionality. Conceptually, modules represent a separation of
concerns, and improve maintainability by enforcing logical boundaries
between components. Modules are typically incorporated into the program
through interfaces. A module interface expresses the elements that are
provided and required by the module. The elements defined in the interface
are detectable by other modules. The implementation contains the working
code that corresponds to the elements declared in the interface. Modular
programming is the process of subdividing a computer program into separate
sub-programs.
A module is a separate software component. It can often be used in a variety
of applications and functions with other components of the system. Similar
Suneel Dogra 17
SD College Hoshiarpur
functions are grouped in the same unit of programming code and separate
functions are developed as separate units of code so that the code can be
reused by other applications.
Object-oriented programming (OOP) is compatible with the modular
programming concept to a large extent. Modular programming enables
multiple programmers to divide up the work and debug pieces of the
program independently.
Modules in modular programming enforce logical boundaries between
components and improve maintainability. They are incorporated through
interfaces. They are designed in such a way as to minimize dependencies
between different modules. Teams can develop modules separately and do
not require knowledge of all modules in the system.
Each and every modular application has a version number associated with it.
This provides developers flexibility in module maintenance. If any changes
have to be applied to a module, only the affected subroutines have to be
changed. This makes the program easier to read and understand.
Modular programming has a main module and many auxiliary modules. The
main module is compiled as an executable (EXE), which calls the auxiliary
module functions. Auxiliary modules exist as separate executable files, which
load when the main EXE runs. Each module has a unique name assigned in
the PROGRAM statement. Function names across modules should be unique
for easy access if functions used by the main module must be exported.
Languages that support the module concept are IBM Assembler, COBOL,
RPG, FORTRAN, Morpho, Zonnon and Erlang, among others.
Suneel Dogra 18
SD College Hoshiarpur
The benefits of using modular programming include:
1. Less code has to be written.
2. A single procedure can be developed for reuse, eliminating the need to retype the code
many times.
3. Programs can be designed more easily because a small team deals with only a small
part of the entire code.
4. Modular programming allows many programmers to collaborate on the same
application.
5. The code is stored across multiple files.
6. Code is short, simple and easy to understand.
7. Errors can easily be identified, as they are localized to a subroutine or function.
8. The same code can be used in many applications.
9. The scoping of variables can easily be controlled.
Suneel Dogra 19
SD College Hoshiarpur

Contenu connexe

Tendances

FUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&M
FUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&MFUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&M
FUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&MBalamurugan Subburaj
 
Presentation Study on CMM And Application
Presentation Study on CMM And ApplicationPresentation Study on CMM And Application
Presentation Study on CMM And Applicationsandeepbags2004
 
CADM-Unit 4/CNC &PROGRAMING
CADM-Unit 4/CNC &PROGRAMINGCADM-Unit 4/CNC &PROGRAMING
CADM-Unit 4/CNC &PROGRAMINGgopalkrishnan202
 
Lesson 11 Isometric Projection - Part I
Lesson 11 Isometric Projection - Part ILesson 11 Isometric Projection - Part I
Lesson 11 Isometric Projection - Part IJeyapoovan Thangasamy
 
Unit 2 2 design consideration
Unit 2 2 design considerationUnit 2 2 design consideration
Unit 2 2 design considerationnilesh sadaphal
 
Development of Surfaces.pptx
Development of Surfaces.pptxDevelopment of Surfaces.pptx
Development of Surfaces.pptxabdulbasit998
 
Chapter 4 cnc part programming
Chapter 4 cnc part programmingChapter 4 cnc part programming
Chapter 4 cnc part programmingRAHUL THAKER
 
Absolute and incremental in CAD & CAM
Absolute and incremental in CAD & CAMAbsolute and incremental in CAD & CAM
Absolute and incremental in CAD & CAMVaibhavBHARAMBE3
 
Moving iron (MI) instruments
Moving iron (MI) instrumentsMoving iron (MI) instruments
Moving iron (MI) instrumentsChandan Singh
 
Optical torsion meter
Optical torsion meterOptical torsion meter
Optical torsion meterDominicHendry
 
Tool compensationCNC
Tool compensationCNCTool compensationCNC
Tool compensationCNCArpit Agarwal
 
Solid modeling
Solid modelingSolid modeling
Solid modelingDhruv Shah
 

Tendances (20)

FUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&M
FUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&MFUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&M
FUNDAMENTALS OF CNC & PART PROGRAMMING - UNIT - 4 CAD&M
 
Presentation Study on CMM And Application
Presentation Study on CMM And ApplicationPresentation Study on CMM And Application
Presentation Study on CMM And Application
 
Plc ppt
Plc pptPlc ppt
Plc ppt
 
CADM-Unit 4/CNC &PROGRAMING
CADM-Unit 4/CNC &PROGRAMINGCADM-Unit 4/CNC &PROGRAMING
CADM-Unit 4/CNC &PROGRAMING
 
Lesson 11 Isometric Projection - Part I
Lesson 11 Isometric Projection - Part ILesson 11 Isometric Projection - Part I
Lesson 11 Isometric Projection - Part I
 
Unit 2 2 design consideration
Unit 2 2 design considerationUnit 2 2 design consideration
Unit 2 2 design consideration
 
Development of Surfaces.pptx
Development of Surfaces.pptxDevelopment of Surfaces.pptx
Development of Surfaces.pptx
 
Chapter 4 cnc part programming
Chapter 4 cnc part programmingChapter 4 cnc part programming
Chapter 4 cnc part programming
 
Absolute and incremental in CAD & CAM
Absolute and incremental in CAD & CAMAbsolute and incremental in CAD & CAM
Absolute and incremental in CAD & CAM
 
induction generator
induction generatorinduction generator
induction generator
 
Mechanical CNC machine
Mechanical CNC machineMechanical CNC machine
Mechanical CNC machine
 
Cnc
CncCnc
Cnc
 
Moving iron (MI) instruments
Moving iron (MI) instrumentsMoving iron (MI) instruments
Moving iron (MI) instruments
 
Optical torsion meter
Optical torsion meterOptical torsion meter
Optical torsion meter
 
Cmm 3
Cmm 3Cmm 3
Cmm 3
 
Lathe presentation
Lathe presentationLathe presentation
Lathe presentation
 
Unit v isometric projection
Unit  v  isometric projectionUnit  v  isometric projection
Unit v isometric projection
 
Tool compensationCNC
Tool compensationCNCTool compensationCNC
Tool compensationCNC
 
Solid modeling
Solid modelingSolid modeling
Solid modeling
 
Cad notes
Cad notesCad notes
Cad notes
 

Similaire à Computer programming

Abstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworksAbstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworksijpla
 
Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Arslan Hussain
 
Programming languages of computer
Programming languages of computerProgramming languages of computer
Programming languages of computerKeval Goyani
 
FIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer LanguagesFIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer Languagesraksharao
 
2 Programming Language.pdf
2 Programming Language.pdf2 Programming Language.pdf
2 Programming Language.pdfKINGZzofYouTube
 
Computer languages and generation
Computer languages and generationComputer languages and generation
Computer languages and generationMunawar Bukhari
 
Programming languages
Programming languagesProgramming languages
Programming languagesgaurav jain
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languagesNaqashAhmad14
 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programmingAzmiah Mahmud
 
Introduction to Programming By Wathika F. Maina
Introduction to Programming By Wathika F. MainaIntroduction to Programming By Wathika F. Maina
Introduction to Programming By Wathika F. MainaNez Computex
 
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming LanguagesMuhammad Hammad Waseem
 

Similaire à Computer programming (20)

Abstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworksAbstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworks
 
Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Programming Fundamental Slide No.1
Programming Fundamental Slide No.1
 
Programming languages of computer
Programming languages of computerProgramming languages of computer
Programming languages of computer
 
FIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer LanguagesFIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer Languages
 
Computer languages 11
Computer languages 11Computer languages 11
Computer languages 11
 
2 Programming Language.pdf
2 Programming Language.pdf2 Programming Language.pdf
2 Programming Language.pdf
 
Computer languages and generation
Computer languages and generationComputer languages and generation
Computer languages and generation
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptx
 
Notacd071
Notacd071Notacd071
Notacd071
 
Notacd07
Notacd07Notacd07
Notacd07
 
Nota programming
Nota programmingNota programming
Nota programming
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Programming Part 01
Programming Part 01Programming Part 01
Programming Part 01
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 
Ict topic 5
Ict topic 5Ict topic 5
Ict topic 5
 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programming
 
Introduction to Programming By Wathika F. Maina
Introduction to Programming By Wathika F. MainaIntroduction to Programming By Wathika F. Maina
Introduction to Programming By Wathika F. Maina
 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
 
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
 

Plus de Suneel Dogra

Distributed databases
Distributed databasesDistributed databases
Distributed databasesSuneel Dogra
 
Data base management system
Data base management systemData base management system
Data base management systemSuneel Dogra
 
Web sitedesignpart1
Web sitedesignpart1Web sitedesignpart1
Web sitedesignpart1Suneel Dogra
 
Web sitedesignpart1
Web sitedesignpart1Web sitedesignpart1
Web sitedesignpart1Suneel Dogra
 
He 12 different types of servers that every techie should know about
He 12 different types of servers that every techie should know aboutHe 12 different types of servers that every techie should know about
He 12 different types of servers that every techie should know aboutSuneel Dogra
 
Bachelor of computer application b.c.a.-2014
Bachelor of computer application b.c.a.-2014Bachelor of computer application b.c.a.-2014
Bachelor of computer application b.c.a.-2014Suneel Dogra
 
Cloud computing application
Cloud computing applicationCloud computing application
Cloud computing applicationSuneel Dogra
 
Fast track to linux
Fast track to linuxFast track to linux
Fast track to linuxSuneel Dogra
 
A sorted linear array
A sorted linear array A sorted linear array
A sorted linear array Suneel Dogra
 

Plus de Suneel Dogra (20)

Business model
Business modelBusiness model
Business model
 
Internet
InternetInternet
Internet
 
Html
HtmlHtml
Html
 
Dreamweaver
DreamweaverDreamweaver
Dreamweaver
 
Advanced html
Advanced htmlAdvanced html
Advanced html
 
Sql
SqlSql
Sql
 
File organisation
File organisationFile organisation
File organisation
 
Distributed databases
Distributed databasesDistributed databases
Distributed databases
 
Database models
Database models Database models
Database models
 
Data base management system
Data base management systemData base management system
Data base management system
 
Web sitedesignpart1
Web sitedesignpart1Web sitedesignpart1
Web sitedesignpart1
 
Web sitedesignpart1
Web sitedesignpart1Web sitedesignpart1
Web sitedesignpart1
 
Internet security
Internet securityInternet security
Internet security
 
What is the linux
What is the linuxWhat is the linux
What is the linux
 
He 12 different types of servers that every techie should know about
He 12 different types of servers that every techie should know aboutHe 12 different types of servers that every techie should know about
He 12 different types of servers that every techie should know about
 
Bachelor of computer application b.c.a.-2014
Bachelor of computer application b.c.a.-2014Bachelor of computer application b.c.a.-2014
Bachelor of computer application b.c.a.-2014
 
Cloud computing application
Cloud computing applicationCloud computing application
Cloud computing application
 
Fast track to linux
Fast track to linuxFast track to linux
Fast track to linux
 
A sorted linear array
A sorted linear array A sorted linear array
A sorted linear array
 
String in c
String in cString in c
String in c
 

Dernier

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Dernier (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

Computer programming

  • 1. COMPUTER PROGRAMMING: A programming language is a set of instructions used to communicate with the computer and the set of instructions written in a programming language is called a Program. Programming is the implementation of logic to facilitate specified computing operations and functionality. Programming language semantics and syntax are used when constructing an application. Thus, programming requires knowledge of application domains, algorithms and programming language expertise. Programming language logic differs by developer. From a high level, good code can be evaluated with factors such as: • Robustness: Focuses on program continuation capability, regardless of errors or incorrect data • Reliability: Focuses on correct design and algorithm implementation • Efficiency: Focuses on memory, hardware or other properties used to optimize programs • Readability: Proper documentation and indentation availability, which provides insight to other program developers or designers It occurs in one or more languages, which differ by application, domain and programming model. Programming languages for computers are developed with the primary objective of facilitating a large number of persons to use computers without the need to know in detail the internal structure of a computer. Languages are matched to the type of applications which are to be programmed using the language. The ideal language would be one which expresses precisely the specification of a problem to be solved, and converts it into a series of instructions for a computer. It is not possible to achieve this ideal as a clear Suneel Dogra 1 SD College Hoshiarpur
  • 2. specification of a problem is often not available and developing an algorithm from specifications requires subject knowledge and expertise. In actual practice, a detailed algorithm to solve a problem is the starting point and it is expressed as a program in a programming language. A large number of languages, over a thousand, exist each catering to a different class of applications. All modern programming languages (with one exception) are designed to be machine independent. In other words, the structure of the programming language would not depend upon the internal structure of a specified computer; one should be able to execute a program written in the programming language on any computer regardless of who manufactured it or what model it is. Such languages are known as high level machine independent programming languages. A computer language means, a set of rules and symbols used to operate a computer. Whatever command we give to computer, it is first converted in its own language. A computer language is also known as Programming Language. There are various types of programming languages. These languages are used to write programs to tell the computer what to do. Users who write these programs are called programmers. Each computer language has its own set of rules and grammar. These are called the syntax rules of the language. This syntax rules should be followed while writing a program. Computer Languages have progressed over the years just like hardware. Starting from the language made up to just two symbols 0 and 1, today, you can make the computer programs using common English and Mathematical terms. CLASSIFICATION OF PROGRAMMING LANGUAGES: Suneel Dogra 2 SD College Hoshiarpur
  • 3. Classification of programming languages. We have classified high level machine independent languages into three groups, namely, procedural, non-procedural and Problem-oriented. Classification of Programming Languages. LOW LEVEL LANGUAGES: The languages which use only primitive operations of the computer are known as low language. In these languages, programs are written by means of the memory and registers available on the computer. Since the architecture of computer differs from one machine to another, so far each type of computer there is a separate low level programming language. In the other words, Programs written in one low level language of one, architectural can’t be ported on any other machine dependent languages. Examples are Machine Language and Assembly Language. MACHINE LEVEL LANGUAGE Suneel Dogra 3 SD College Hoshiarpur
  • 4. You know that a computer can understand only special signals, which are represented by 1’s and 0’s. These two digits are called binary digits. Computer understands program written in binary digits. The language, which uses binary digits, is called the machine level language. Computer works in bits and bytes. It understands the language of the binary digits, 0 and 1. You may write a program in whichever language you want, but it is finally converted into the language of 0s and 1s before it gets executed. Writing a program in machine language is definitely very difficult. It is not possible to memorize a long string of 0s and 1s for every instruction that you want to derive executed. It is proper that before the higher levels of programming languages were designed, machine languages were old-fashioned for writing programming codes, but they are no longer traditional for designing computer programs. A machine language is a collection of very detailed cryptic instructions that control computer’s internal circuitry. It is language that a computer actually understands. It is viewed as sequences of 1`s and 0`s that a program written in any language is finally translated to. In machine language program, the computation is based on binary numbers. All the instructions including operations, registers, data and memory locations are given in there binary equivalent. The machine directly understands this language by virtue of its circuitry design so these programs are directly executable on the computer without any translations. This makes the program execution very fast. Machine languages are also known as first generation languages. A machine language consists of the numeric codes for the operations that a particular computer can execute directly. The codes are strings of 0s and 1s, or binary digits (“bits”), which are frequently converted both from and to Suneel Dogra 4 SD College Hoshiarpur
  • 5. hexadecimal (base 16) for human viewing and modification. Machine language instructions typically use some bits to represent operations, such as addition, and some to represent operands, or perhaps the location of the next instruction. Machine language is difficult to read and write, since it does not resemble conventional mathematical notation or human language, and its codes vary from computer to computer. Machine language is the only language that a computer understands. Each statement in a machine language program is a sequence of bits. Each bit may be set to 0 or 1. Series of bits represent instructions that a computer can understand. For example, the number 455 is represented by the bit sequence 111000111. Machine language is a low-level programming language. It is easily understood by computers but difficult to read by people. This is why people use higher level programming languages. Programs written in high-level languages are compiled and/or interpreted into machine language so computers can execute them. ASSEMBLY LANGUAGE: The first step in the evolution of programming languages was the development of what is known as an assembly language. In an assembly language, mnemonics are used to represent operations to be performed by the computer and strings of characters to represent addresses of locations in the computer’s memory where the operands will be stored. Thus the language is matched to a particular computer’s processor structure and is thus machine dependent. A translator called an assembler translates a program written in assembly language to a set of machine instructions, which can be executed by a computer. Now-a-days programs are written in assembly language only in applications which are cost Suneel Dogra 5 SD College Hoshiarpur
  • 6. sensitive or time critical as efficiency of machine code is of paramount importance in these types of applications. A cost sensitive application is one in which microprocessors are used to enhance the functionality of consumer items such as washing machines or music systems. In these cases the program is stored in a read only memory and its size is small. Thus code optimization is important. A time-critical application is use of microprocessors in aircraft controls where real time operation of the system is required. Here again the number of machine instructions executed should be minimized. Assembly languages are also known as second generation languages. These languages substitutes alphabetic or numeric symbols for the binary codes of machine language. That is, we can use mnemonics for all opcodes, registers and for the memory locations which provide us with a facility to write reusable code in the form of macros. Has two parts, one is macro name and the other is macro body which contains the line of instructions. A macro can be called at any point of the program by its name to use the instruction. A macro can be called at any point of the program by its name to use the instructions given in the macro repetitively. These languages require a translator known as “Assembler” for translating the program code written in assembly language to machine language. Because computer can interpret only the machine code instruction, once the translation is completed the program can be executed. Assembly language is one level above machine language. It uses short mnemonic codes for instructions and allows the programmer to introduce names for blocks of memory that hold data. One might thus write “add pay, total” instead of “0110101100101000” for an instruction that adds two numbers. Assembly Suneel Dogra 6 SD College Hoshiarpur
  • 7. language is designed to be easily translated into machine language. Although blocks of data may be referred to by name instead of by their machine addresses, assembly language does not provide more sophisticated means of organizing complex information. Like machine language, assembly language requires detailed knowledge of internal computer architecture. It is useful when such details are important, as in programming a computer to interact with input/output devices (printers, scanners, storage devices, and so forth). Assembly language is a representation of machine language. In other words, each assembly language instruction translates to a machine language instruction. The advantage of assembly language is that its instructions are readable. For example, assembly language statements like MOV and ADD are more recognizable than sequences of 0s and 1s. Though assembly language statements are readable, the statements are still low-level. Another disadvantage of assembly language is that it is not portable. In other words, assembly language programs are specific to a particular hardware. Assembly language programs for a Mac will not work on a PC. But this can be an advantage for programmers who are targeting a specific platform and need full control over the hardware. HIGH LEVEL LANGUAGE High-level languages are what most programmers use. A high level language is a collection of instructions that resemble human languages. This provides more compatibility of the language with the human thought process. E.g. FORTRAN, BASIC, PASCAL, C, JAVA etc. Languages such as C++ and Java are all high-level languages. One advantage of high-level languages is that they are very readable. The statements in these languages are English-like. For example, you can gain a basic understanding of what a Java program is doing by simply reading the Suneel Dogra 7 SD College Hoshiarpur
  • 8. program source code. High-level languages use English words as statements. Loops in Java programs are indicated by the words for, while and do. Another advantage of high-level languages is that they are less tedious to use. A single statement in a high-level language can translate into many machine language statements. Finally, high-level languages are usually portable. A disadvantage of high-level languages is that they are usually less powerful and less efficient. Since statements are high-level, you cannot code at the bit level the way you can with assembly language. High-level languages also need to be compiled and/or interpreted into machine language before execution. High-level languages offer many advantages over low level languages and are thus preferred for program development. Some main advantages are: SIMPLICITY & PROGRAMMING EFFICIENCY: Generally, a single instruction in a high-level language corresponds to a set of multiple machine language instructions. This greatly enhances simplicity of program development i.e. leads to higher programming efficiency and productivity. UNIFORMITY: The rules that apply to the programming, in a particular high- level language, for a particular computer are much the same for other computers also. PORTABILITY: Uniformity supports high degree of portability on computers of same type. Even if the instruction sets of the computers differ, it is the task of the compiler to suit them (see below for compiler) and the rules for programming remain essentially the same i.e. the same program can be run on different computers. Since, portability depends on the compiler of the language (may be available for the instruction set or not) or the libraries accompanying the Suneel Dogra 8 SD College Hoshiarpur
  • 9. language, high degree of portability is the benefit provided by only few high-level languages and absolute portability is still a big quest of the day. Although, nearly whole of the programming world is dominated by the high - level programming languages due to their higher program efficiency and productivity, the assembly language still maintains its place in low level programming and hardware interaction, especially for high performance systems. PROCEDURAL LANGUAGE: Procedural language is a computer programming language that specifies a series of well-structured steps and procedures within its programming context to compose a program. It contains a systematic order of statements, functions and commands to complete a computational task or program. Procedural language is also known as imperative language. Procedural language, as the name implies, relies on predefined and well- organized procedures, functions or sub-routines in a program’s architecture by specifying all the steps that the computer must take to reach a desired state or output. Procedural language segregates a program within variables, functions, statements and conditional operators. Procedures or functions are implemented on the data and variables to perform a task. These procedures can be called/invoked anywhere between the program hierarchy, and by other procedures as well. A program written in procedural language contains one or more procedures. Procedural language is one of the most common programming languages in use with notable languages such as C/C++, Java, Cold Fusion and PASCAL. Suneel Dogra 9 SD College Hoshiarpur
  • 10. The procedural programming methodology involves dividing a large program into a set of sub-procedures or subprograms that perform specific tasks. In this methodology, a program is divided into one or more units or modules. These modules can be user-defined or can be taken from libraries. A module can consist of single or multiple procedures. These procedures are also known as functions, routines, subroutines, or methods in various programming languages. A procedural program can consist of multiple levels or scopes. A procedure can be defined independently or within another procedure. The level of the procedure depends on the definition. Similarly, the data available in the procedure also exhibits various levels or scopes. The procedure of a higher or outer scope cannot access the data within the procedure that has lower or inner scope. A procedure or a subprogram is a set of commands that can be executed independently. In a program following procedural methodology, each step of a subprogram is linked to the previous step. Suneel Dogra 10 SD College Hoshiarpur
  • 11. For example, in a program that needs to accept, display, and print data, you can divide the program into subprograms. You can create three subprograms that accept data, display data, and print data, respectively. Each subprogram performs a defined function while the combined action of subprograms makes a complete program. In procedural programming, you can use a subprogram at multiple locations within a program to perform a specific task. This enables you to reuse the program code as and when required in a program, without rewriting the entire code, as shown in the figure: The figure displays a program that consists of three procedures. Accept Data, Display Data, and Print Data. Data is accepted in the Accept Data procedure, displayed in the Display Data procedure, and printed in the Print Data procedure. Procedural programming is used for developing simple applications. The languages that use the procedural programming methodology include Pascal and C languages. Some of the benefits of the procedural programming methodology are: • Easy to read program code. Suneel Dogra 11 SD College Hoshiarpur
  • 12. • Easy maintainable program code as various procedures can be debugged in isolation. • Code is more flexible as you can change a specific procedure that gets implemented across the program. The features of procedural programming methodology are: • Large programs are divided into smaller programs. • Most of the data is shared as global that can be accessed from anywhere within the program. In the procedural programming approach, portions of the code are so interdependent that the code in one application cannot be reused in another. For example, the module used to calculate the salary of the employees in a bank management system cannot be used to calculate the salary of the employees in an educational institute. You need to create a separate module to calculate the salary of the employees in an educational institute. When you need to reuse the procedural program in another application, a change in the application results in rewriting a large portion of the code. This results in decreased productivity and increased maintenance cost of the application. This was one of the reasons that led to the evolution of the object-oriented approach. Suneel Dogra 12 SD College Hoshiarpur
  • 13. NON-PROCEDURAL LANGUAGE: Programming languages that are based on functions or logic are representatives of what is called declarative programming, due to the fact that (to some extent) the users state what to be solved and the computers solve it. Programs written in declarative languages are usually self-explanatory, succinct, and much shorter than their counterparts in procedural or object-oriented languages. Non-procedural programming languages allow users and professional programmers to specify the results they want without specifying how to solve the problem. Examples are FORTRAN, C++, COBOL, ALGOL etc. A computer language that does not require writing traditional programming logic. Also known as a "declarative language," users concentrate on defining the input and output rather than the program steps required in a procedural programming language such as C++ or Java. Functional programming is about writing and composing functions. The central idea lies in symbolic manipulation as computation -- the use of recursive functions defined over lists provides a computational framework with the full power of expressing deterministic computations. You will be presented with a brief overview of functional programming in LISP, and you will use it to solve a number of problems. We will introduce lambda calculus as a foundation for functional programming, and an abstract machine called SECD as a model of executing compiled lisp programs. Logic programming draws the idea of programming as specifying solutions in a logic and logic deduction as computation. You will learn how to turn a Suneel Dogra 13 SD College Hoshiarpur
  • 14. subset of logic into a programming language. For the practical aspect, you will write small yet interesting programs in Prolog (Programming in Logic). We will also introduce constraint programming, perhaps one of the most exciting developments in programming languages in the last decade. PROBLEM-ORIENTED LANGUAGE: These are high level language designed for developing a convenient expression of the given class of problem. STRUCTURED PROGRAMMING Structured programming (sometimes known as modular programming) is a subset of procedural programming that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify. Certain languages such as Ada, Pascal, and dBASE are designed with features that encourage or enforce a logical program structure. Structured programming frequently employs a top-down design model, in which developers map out the overall program structure into separate subsections. A defined function or set of similar functions is coded in a separate module or sub module, which means that code can be loaded into memory more efficiently and that modules can be reused in other programs. After a module has been tested individually, it is then integrated with other modules into the overall program structure. Program flow follows a simple hierarchical model that employs looping constructs such as "for," "repeat," and "while." Use of the "Go To" statement is discouraged. Suneel Dogra 14 SD College Hoshiarpur
  • 15. Structured programming was first suggested by Corrado Bohm and Guiseppe Jacopini. The two mathematicians demonstrated that any computer program can be written with just three structures: decisions, sequences, and loops. Edsger Dijkstra's subsequent article, Go To Statement Considered Harmful was instrumental in the trend towards structured programming. The most common methodology employed was developed by Dijkstra. In this model (which is often considered to be synonymous with structured programming, although other models exist) the developer separates programs into subsections that each have only one point of access and one point of exit. Almost any language can use structured programming techniques to avoid common pitfalls of unstructured languages. Unstructured programming must rely upon the discipline of the developer to avoid structural problems, and as a consequence may result in poorly organized programs. Most modern procedural languages include features that encourage structured programming. Object-oriented programming (OOP) can be thought of as a type of structured programming, uses structured programming techniques for program flow, and adds more structure for data to the model. STRUCTURED PROGRAMMING CAN BE DEFINED AS : 1. Top-Down Analysis for Program Solving 2. Modularization for program structure Suneel Dogra 15 SD College Hoshiarpur
  • 16. 3. Structure code for individual modules TOP-DOWN ANALYSIS FOR PROGRAM SOLVING A top-down approach (also known as stepwise design) is essentially the breaking down of a system to gain insight into the sub-systems that make it up. In a top-down approach an overview of the system is formulated, specifying but not detailing any first-level subsystems. Each subsystem is then refined in yet greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements. Once these base elements are recognized then we can build these as computer modules. Once they are built we can put them together, making the entire system from these individual components. In recent years, computer memory ceased to be the limitation factor for most of the application programs. This, along with increasing software complexity and maintenance hitches, shifted the focus from the execution time to the programming techniques adopted in development of a program. It allowed programs to be written in a more organized manner, i.e., in a structured manner, producing code that is easier to read, analyze, and modify later – if the need arose. With increasing demands for software efficiency and programming standardization, a changed approach saw the programmers examining the problem as a whole and outlining the major steps to solve the problem. Then the process was repeated and the steps thus obtained were broken down in finer details. This is the top-down programming approach and is used in structured programming. Suneel Dogra 16 SD College Hoshiarpur
  • 17. 1. Define exactly what data the program will get and what it has to do with them. 2. If the task is simple enough, write the program code. 3. Otherwise, split the task into smaller parts and define exactly the duty of each part and interface to the rest of the program. 4. Repeat the steps 1–4 separately for each subtask. MODULAR PROGRAMMING Modular programming (also called "top-down design" and "stepwise refinement") is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality. Conceptually, modules represent a separation of concerns, and improve maintainability by enforcing logical boundaries between components. Modules are typically incorporated into the program through interfaces. A module interface expresses the elements that are provided and required by the module. The elements defined in the interface are detectable by other modules. The implementation contains the working code that corresponds to the elements declared in the interface. Modular programming is the process of subdividing a computer program into separate sub-programs. A module is a separate software component. It can often be used in a variety of applications and functions with other components of the system. Similar Suneel Dogra 17 SD College Hoshiarpur
  • 18. functions are grouped in the same unit of programming code and separate functions are developed as separate units of code so that the code can be reused by other applications. Object-oriented programming (OOP) is compatible with the modular programming concept to a large extent. Modular programming enables multiple programmers to divide up the work and debug pieces of the program independently. Modules in modular programming enforce logical boundaries between components and improve maintainability. They are incorporated through interfaces. They are designed in such a way as to minimize dependencies between different modules. Teams can develop modules separately and do not require knowledge of all modules in the system. Each and every modular application has a version number associated with it. This provides developers flexibility in module maintenance. If any changes have to be applied to a module, only the affected subroutines have to be changed. This makes the program easier to read and understand. Modular programming has a main module and many auxiliary modules. The main module is compiled as an executable (EXE), which calls the auxiliary module functions. Auxiliary modules exist as separate executable files, which load when the main EXE runs. Each module has a unique name assigned in the PROGRAM statement. Function names across modules should be unique for easy access if functions used by the main module must be exported. Languages that support the module concept are IBM Assembler, COBOL, RPG, FORTRAN, Morpho, Zonnon and Erlang, among others. Suneel Dogra 18 SD College Hoshiarpur
  • 19. The benefits of using modular programming include: 1. Less code has to be written. 2. A single procedure can be developed for reuse, eliminating the need to retype the code many times. 3. Programs can be designed more easily because a small team deals with only a small part of the entire code. 4. Modular programming allows many programmers to collaborate on the same application. 5. The code is stored across multiple files. 6. Code is short, simple and easy to understand. 7. Errors can easily be identified, as they are localized to a subroutine or function. 8. The same code can be used in many applications. 9. The scoping of variables can easily be controlled. Suneel Dogra 19 SD College Hoshiarpur