College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
Unit 2: Programming Language Tools
1. Unit 2: Programming
Language Tools
for
Open Educational Resource
On
Programming Concepts(EC208)
by
Dr. Piyush Charan
Assistant Professor
Department of Electronics and Communication Engg.
Integral University, Lucknow
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
2. HELLO!
I am Dr Piyush Charan
I am here to take lecture on Unit 2 of the
course Programming Concepts (EC208).
You can find me at piyush@iul.ac.in
2
Dr. Piyush Charan
ASSISTANT PROFESSOR
Department of ECE,
Integral University, Lucknow
3. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Unit 2: Content
PROGRAMMING LANGUAGE TOOLS
Compiler
Linker
Interpreter
Editor,
GUI (Graphic user interface),
IDE (Integrated development environment),
Testing and debugging: difference between testing and debugging,
Types of program errors,
testing a program,
Debugging a program for syntax error/logic errors.
Program documentation: Need for documenting programs and software,
System documentation, user manual and comments.
3
5. “a special program that
processes statements
written in a particular
programming language
5
6. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
COMPILER
▪ In computing, a compiler is a computer program that
translates computer code written in one programming
language into another language.
▪ The name "compiler" is primarily used for programs that
translate source code from a high-level programming
language to a lower level language to create an
executable program.
6
8. “a computer program that
takes one or more object
files generated by a
compiler and combines
them into one, executable
program
8
9. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
LINKER
▪ Computer programs are usually made up of
multiple modules that span separate object files, each being a
compiled computer program. The program as a whole refers to
these separately compiled object files using symbols. The linker
combines these separate files into a single, unified program,
resolving the symbolic references as it goes along.
▪ Dynamic linking is a similar process available on many operating
systems, which postpones the resolution of some symbols until
the program is executed. When the program is run,
these dynamic link libraries are loaded, as well. Dynamic linking
does not require a linker.
9
11. “a computer program that
directly executes
instructions written in a
programming or scripting
language
11
12. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
INTERPRETER
▪ An interpreter is a computer program that directly executes, i.e.
performs, instructions written in a programming or scripting
language
or
▪ An interpreter translates high-level instructions into an
intermediate form, which it then executes.
▪ Translates one line of the program into binary code at a time:
▫ Interpreting can be done in different ways, depending on the
setting, how much time is available, how many languages are
used, and whether or not technology is available.
12
14. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Interpreter
▪ Translates program one statement at a
time.
▪ Interpreters usually take less amount of
time to analyze the source code.
However, the overall execution time is
comparatively slower than compilers.
▪ No Object Code is generated, hence are
memory efficient.
▪ Programming languages like JavaScript,
Python, Ruby use interpreters.
Interpreter v/s Compiler
Compiler
▪ Scans the entire program and translates
it as a whole into machine code.
▪ Compilers usually take a large amount of
time to analyze the source code.
However, the overall execution time is
comparatively faster than interpreters.
▪ Generates Object Code which further
requires linking, hence requires more
memory.
▪ Programming languages like C, C++, Java
use compilers.
14
15. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
EDITORS, GUI, and IDE
A complex idea can be conveyed with
just a single still image, namely making
it possible to absorb large amounts of
data quickly.
15
16. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Editor
▪ Editors or text editors are software programs
that enable the user to create and edit text
files.
▪ In the field of programming, the term editor
usually refers to source code editors that
include many special features for writing and
editing code.
▪ Notepad, Wordpad are some of the common
editors used on Windows OS and vi, emacs,
Jed, pico are the editors on UNIX OS.
▪ Features normally associated with text editors
are — moving the cursor, deleting, replacing,
pasting, finding, finding and replacing, saving
etc.
16
17. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Structure of Editor
17
18. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Types of Editors
▪ Line editor: In this, you can only edit one line at a time or an integral
number of lines. You cannot have a free-flowing sequence of
characters. It will take care of only one line. Ex : Teleprinter, edlin,
teco
▪ Stream editors: In this type of editors, the file is treated as
continuous flow or sequence of characters instead of line numbers,
which means here you can type paragraphs. Ex : Sed editor in UNIX
▪ Screen editors: In this type of editors, the user is able to see the
cursor on the screen and can make a copy, cut, paste operation
easily. It is very easy to use mouse pointer. Ex : vi, emacs, Notepad
18
19. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Types of Editors contd…
▪ Word Processor: Overcoming the limitations of screen editors, it
allows one to use some format to insert images, files, videos, use
font, size, style features. It majorly focuses on Natural language.
▪ Structure Editor: Structure editor focuses on programming
languages. It provides features to write and edit source code.
Ex : Netbeans IDE, gEdit.
19
20. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Graphical User Interface (GUI)
▪ A GUI or Graphical User Interface is a form
of user interface that allows users to
interact with electronic devices through
graphical icons and audio indicator such as
primary notation, instead of text-based
user interfaces, typed command labels or
text navigation.
▪ GUIs were introduced in reaction to the
perceived steep learning curve of
command-line interfaces (CLIs), which
require commands to be typed on a
computer keyboard.
20
21. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
GUI contd….
▪ GUI is an interface that allows users to
interact with different electronic
devices using icons and other visual
indicators. The graphical user
interfaces were created because
command line interfaces were quite
complicated and it was difficult to
learn all the commands in it.
▪ In today’s times, graphical user
interfaces are used in many devices
such as mobiles, MP3 players, gaming
devices, smartphones etc.
21
22. Want big impact?
Graphics and graphic assisted user interface
creates a big one . It is more user friendly.
22
23. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Elements in Graphical User Interface
▪ Graphical User Interface makes use of visual elements mostly. These elements
define the appearance of the GUI. Some of these are described in detail as follows:
1. Window
▫ This is the element that displays the information on the screen. It is very
easy to manipulate a window. It can be opened or closed with the click of an
icon. Moreover, it can be moved to any area by dragging it around.In a
multitasking environment, multiple windows can be open at the same time,
all of them performing different tasks.
▫ There are multiple types of windows in a graphical user interface, such as
container window, browser window, text terminal window, child window,
message window etc.
23
24. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Elements in Graphical User Interface
contd…..
2. Menu
▫ A menu contains a list a choices and it allows users to select one from them.
A menu bar is displayed horizontally across the screen such as pull down
menu. When any option is clicked in this menu, then the pull down menu
appears.
▫ Another type of menu is the context menu that appears only when the user
performs a specific action. An example of this is pressing the right mouse
button. When this is done, a menu will appear under the cursor.
3. Icons
▫ Files, programs, web pages etc. can be represented using a small picture in a
graphical user interface. This picture is known as an icon. Using an icon is a
fast way to open documents, run programs etc. because clicking on them
yields instant access.
24
25. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Elements in Graphical User Interface
contd…..
4. Controls
▫ Information in an application can be directly read or influences using the
graphical control elements. These are also known as widgets. Normally,
widgets are used to display lists of similar items, navigate the system using
links, tabs etc. and manipulating data using check boxes, radio boxes etc.
5. Tabs
▫ A tab is associated with a view pane. It usually contains a text label or a
graphical icon. Tabs are sometimes related to widgets and multiple tabs
allow users to switch between different widgets. Tabs are used in various
web browsers such as Internet Explorer, Firefox, Opera, Safari etc. Multiple
web pages can be opened in a web browser and users can switch between
them using tabs.
25
26. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Integrated Development Environment
(IDE)
▪ An integrated development environment (IDE) is an application that
facilitates application development. IDEs are designed to encompass all
programming tasks in one application. Therefore, IDEs offer a central
interface featuring all the tools a developer needs, including the
following:
▫ Code editor: This feature is a text editor designed for writing and editing
source code. Source code editors are distinguished from text editors
because they enhance or simplify the writing and editing of code.
▫ Compiler: This tool transforms source code written in a human
readable/writable language into a form executable by a computer.
▫ Debugger: This tool is used during testing to help debug application
programs.
▫ Build automation tools: These tools automate common developer tasks.
26
27. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Features of IDE
▪ Editing Source Code
▫ Writing code is an important part of programming. We start
with a blank file, write a few lines of code, and a program is
born! IDEs facilitate this process with features like syntax
highlighting and autocomplete.
27
28. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Syntax Highlighting
▪ An IDE that knows the syntax of your language can provide
visual cues. Keywords, words that have special meaning
like class in Java, are highlighted with different colors.
▪ Compare these two code samples:
28
29. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Autocomplete
▪ When the IDE knows your programming language, it can anticipate what
you’re going to type next!
▪ We’ve seen statements with System.out.println() quite a bit so far. In an
IDE, we might see System as an autocomplete option after only
typing Sy. This saves keystrokes so the programmer can focus on logic
in their code.
29
30. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Languages Supported by IDE
▪ Some IDEs are dedicated to a specific programming language or set of
languages, creating a feature set that aligns with the particulars of that
language. For instance, Xcode for the Objective-C and Swift languages,
Cocoa and Cocoa Touch APIs.
▪ However, there are many multiple-language IDEs, such as Eclipse (C,
C++, Python, Perl, PHP, Java, Ruby and more), Komodo (Perl, Python, Tcl,
PHP, Ruby, Javascript and more) and NetBeans (Java, JavaScript, PHP,
Python, Ruby, C, C++ and more).
▪ Support for alternative languages is often provided by plugins. For
example, Flycheck is a syntax checking extension for GNU Emacs 24
with support for 39 languages.
30
Source: https://www.veracode.com/security/integrated-development-environment
31. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Testing and Debugging
▪ Testing:
Testing is the process of verifying and validating that a software or
application is bug free, meets the technical requirements as guided by
its design and development and meets the user requirements
effectively and efficiently with handling all the exceptional and boundary
cases.
▪ Debugging:
Debugging is the process of fixing a bug in the software. It can defined
as the identifying, analyzing and removing errors. This activity begins
after the software fails to execute properly and concludes by solving the
problem and successfully testing the software. It is considered to be an
extremely complex and tedious task because errors need to be resolved
at all stages of debugging.
31
32. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Comparison of Testing v/s Debugging
32
Testing Debugging
Testing is the process to find bugs and errors. Debugging is the process to correct the bugs
found during testing.
It is the process to identify the failure of
implemented code.
It is the process to give the absolution to code
failure.
Testing is the display of errors. Debugging is a deductive process.
Testing is done by the tester. Debugging is done by either programmer or
developer.
There is no need of design knowledge in the
testing process.
Debugging can’t be done without proper design
knowledge.
Testing can be done by insider as well as
outsider.
Debugging is done only by insider. Outsider can’t
do debugging.
33. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Comparison of Testing v/s Debugging
contd….
33
Testing Debugging
Testing can be manual or automated. Debugging is always manual. Debugging can’t be
automated.
It is based on different testing levels i.e. unit
testing, integration testing, system testing etc.
Debugging is based on different types of bugs.
Testing is a stage of software development life
cycle (SDLC).
Debugging is not an aspect of software
development life cycle, it occurs as a consequence
of testing.
Testing is composed of validation and
verification of software.
While debugging process seeks to match
symptom with cause, by that it leads to the error
correction.
Testing is initiated after the code is written. Debugging commences with the execution of a
test case.
34. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Errors
▪ Errors are the problems or the faults that occur
in the program, which makes the behavior of
the program abnormal, and experienced
developers can also make these faults.
▪ Programming errors are also known as the bugs
or faults, and the process of removing these
bugs is known as debugging.
34
35. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Types of Errors
▪ There are five types of errors that occur in typical C-programming
which are as follows:
35
36. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Syntax Error
▪ Syntax errors are also known as the compilation errors as they
occurred at the compilation time, or we can say that the syntax
errors are thrown by the compilers.
▪ These errors are mainly occurred due to the mistakes while
typing or do not follow the syntax of the specified programming
language.
▪ These mistakes are generally made by beginners only because
they are new to the language. These errors can be easily
debugged or corrected.
36
37. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Syntax Errors contd…
▪ This kind of errors are occurred, when it violates the rule of C++ writing
techniques or syntaxes. This kind of errors are generally indicated by the
compiler before compilation. Sometimes these are known as compile
time error.
▪ In this example, we will see how to get syntax error if we do not put
semicolon after one line.
37
38. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Runtime Errors
▪ Errors which occur during program execution(run-time) after successful
compilation are called run-time errors. One of the most common run-
time error is division by zero also known as Division error. These types of
error are hard to find as the compiler doesn’t point to the line at which
the error occurs.
▪ For more understanding run the example given below:
38
39. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Linker Error
▪ These error occurs when after compilation we link the different object
files with main’s object using Ctrl+F9 key(RUN). These are errors
generated when the executable of the program cannot be generated.
This may be due to wrong function prototyping, incorrect header files.
One of the most common linker error is writing Main() instead of main().
39
// C program to illustrate
// linker error
#include<stdio.h>
void Main() // Here Main() should be main()
{
int a = 10;
printf("%d", a);
}
40. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Logical Errors
▪ On compilation and execution of a program,
desired output is not obtained when certain input
values are given.
▪ These types of errors which provide incorrect
output but appears to be error free are called
logical errors.
▪ These are one of the most common errors done
by beginners of programming.
40
41. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Logical Errors contd…
▪ These errors solely depend on the logical thinking of the programmer
and are easy to detect if we follow the line of execution and determine
why the program takes that path of execution.
41
Output:
▪ Here we want the line will be printed five times. But only one time it will
be printed for the block of code.
42. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Semantic Errors
▪ This kind of error occurs when it is syntactically correct but has no meaning. This is
like grammatical mistakes.
▪ If some expression is given at the left side of assignment operator, this may generate
semantic error. Semantic errors are the errors that occurred when the statements are
not understandable by the compiler.
▪ The following can be the cases for the semantic error:
▫ Use of a un-initialized variable.
int i;
i=i+2;
▫ Type compatibility
int b = "javatpoint";
▫ Errors in expressions
int a, b, c;
a+b = c;
▫ Array index out of bound
int a[10];
a[10] = 34;
42
43. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Semantic Errors contd…
43
44. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Program Documentation
▪ Any written text, illustrations or video that describe a software or
program to its users is called program or software document. User can
be anyone from a programmer, system analyst and administrator to end
user. At various stages of development multiple documents may be
created for different users. In fact, software documentation is a critical
process in the overall software development process.
▪ In modular programming documentation becomes even more important
because different modules of the software are developed by different
teams. If anyone other than the development team wants to or needs to
understand a module, good and detailed documentation will make the
task easier.
44
45. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Program Documentation Guidelines
▪ These are some guidelines for creating
the documents −
▫ Documentation should be from the point of view of
the reader
▫ Document should be unambiguous
▫ There should be no repetition
▫ Industry standards should be used
▫ Documents should always be updated
▫ Any outdated document should be phased out after
due recording of the phase out
45
46. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Advantages of Documentation
▪ These are some of the advantages of providing
program documentation −
▫ Keeps track of all parts of a software or program
▫ Maintenance is easier
▫ Programmers other than the developer can understand all
aspects of software
▫ Improves overall quality of the software
▫ Assists in user training
▫ Ensures knowledge de-centralization, cutting costs and
effort if people leave the system abruptly
46
47. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Example Documents
▪ A software can have many types of documents
associated with it. Some of the important ones
include −
▫ User manual − It describes instructions and procedures for
end users to use the different features of the software.
▫ Operational manual − It lists and describes all the
operations being carried out and their inter-dependencies.
▫ Design Document − It gives an overview of the software
and describes design elements in detail. It documents
details like data flow diagrams, entity relationship
diagrams, etc.
47
48. Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Example Documents contd…
▫ Requirements Document − It has a list of all the requirements of
the system as well as an analysis of viability of the requirements. It
can have user cases, reallife scenarios, etc.
▫ Technical Documentation − It is a documentation of actual
programming components like algorithms, flowcharts, program
codes, functional modules, etc.
▫ Testing Document − It records test plan, test cases, validation plan,
verification plan, test results, etc. Testing is one phase of software
development that needs intensive documentation.
▫ List of Known Bugs − Every software has bugs or errors that
cannot be removed because either they were discovered very late
or are harmless or will take more effort and time than necessary to
rectify. These bugs are listed with program documentation so that
they may be removed at a later date. Also they help the users,
implementers and maintenance people if the bug is activated.
48
49. 49
Dr. Piyush Charan
Assistant Professor,
Department of ECE,
Integral University, Lucknow
Email: er.piyush.charan@gmail.com, piyush@iul.ac.in