0% found this document useful (0 votes)
65 views21 pages

ZIDIN

The document discusses debugging, program testing, and programming of software. It defines debugging as the process of detecting and removing errors, or "bugs", in software code. Various types of bugs are described, including functional errors, performance defects, usability defects, and more. The debugging process and common approaches like brute force, backtracking, and cause elimination are explained. Program testing principles and strategies like incremental development and using assertions and debuggers are also outlined. Finally, popular debugging tools such as GDB, Lightrun, and Valgrind are listed.

Uploaded by

iangarvins
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views21 pages

ZIDIN

The document discusses debugging, program testing, and programming of software. It defines debugging as the process of detecting and removing errors, or "bugs", in software code. Various types of bugs are described, including functional errors, performance defects, usability defects, and more. The debugging process and common approaches like brute force, backtracking, and cause elimination are explained. Program testing principles and strategies like incremental development and using assertions and debuggers are also outlined. Finally, popular debugging tools such as GDB, Lightrun, and Valgrind are listed.

Uploaded by

iangarvins
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

KYAMBOGO UNIVERSITY

FACULTY OF ENGINEERING

P.O.BOX 1, KYAMBOGO-KAMPALA, UGANDA

TEL:+256-41-285272, www.kyambogo.ac.ug

DEPARTMENT OF ELECTRICAL AND


ELECTRONICS
BACHELOR OF MECHATRONICS AND
BIOMEDICAL ENGINEERING
NAME OF STUDENT: KAWISO ALI

REG NO: 18/U/BIO/6399/PD

YEAR OF STUDY: THREE SEMESTER: ONE

TASK: ASSIGNMENT

COURSE: MICROELECTRONICS COURSE CODE: TEMB 3101


QUESTION

THESE ARE SHORT NOTES CONCERNING DEBUGGING, PROGRAM TESTING AND PROGRAMMING OF
SOFTWARE. THEY ARE SEEN AS FOLLOWS;-

CHAPTER 1.

DEBUGGING.

Debugging is the process of detecting and removing of existing and potential errors (also called
as ‘bugs’) in a software code that can cause it to behave unexpectedly or crash. To prevent
incorrect operation of a software or system, debugging is used to find and resolve bugs or
defects.

A BUG.

A software bug is an error, flaw or fault in a computer program or system that causes it to
produce an incorrect or unexpected result, or to behave in unintended ways.

DIFFERENT TYPES OF BUGS.

Functional errors.

When it comes to functionality, each program should work correctly, but sometimes it doesn’t.
When the software does not act as it is intended, this is a functionality error.

Performance defects

Another of the types of software bugs, performance defects are tied to the software’s speed,
stability, response time, and resource consumption.

Usability defects

A usability defect is a type of error that hinders a user from using the software to its fullest
capability. This bug makes a piece of software difficult or inconvenient to use.
Compatibility defects

Compatibility errors occur when an application does not perform consistently on different types
of hardware, operating systems, browser compatibility, or when performing with particular
software under formal specifications.

Syntax errors

These types of software bugs occur in the source code of a program. Syntax errors are one of the
more common software bugs and will prevent your application from being compiled properly.

Logic errors

Logic errors is one of the types of coding errors that can cause your software to produce the
wrong output, crash, or even software failure.

Unit-level bugs

Another of the most common types of bug is the unit-level software bug. Once your program has
been coded, agile teams and other software developers typically perform unit testing, testing out
a smaller section of the code as a whole to ensure that it works as it should.

System-level integration bugs

These errors happen when there’s a mistake in the interaction between two different subsystems.
These types of software bugs are generally more difficult to fix because there are multiple
software systems involved, often written by different developers.

Code Duplication

This defect occurs when a sequence of code occurs more than once. This can mean that lines of
code are literally duplicated, character for character, but it can also apply to code that has the
same tokens.

Data Type Mismatch

This is another of the most common software defects. When one of these software flaws occurs,
it is because the wrong data type has been assigned to a variable or parameter.
DEBUGGING PROCESS.

1. Reproduce the problem.

2. Describe the bug. Try to get as much input from the user to get the exact reason.

3. Capture the program snapshot when the bug appears. Try to get all the variable values and
states of the program at that time.

4. Analyse the snapshot based on the state and action. Based on that try to find the cause of the
bug.

5. Fix the existing bug, but also check that any new bug does not occur.

DEBUGGING APPROACHES:

The following are a number of approaches popularly adopted by programmers for debugging.

Brute Force Method:

This is the foremost common technique of debugging however is that the least economical
method. during this approach, the program is loaded with print statements to print the
intermediate values with the hope that a number of the written values can facilitate to spot the
statement in error.

Backtracking:

This is additionally a reasonably common approach. during this approach, starting from the
statement at which an error symptom has been discovered, the source code is derived backward
till the error is discovered.

Cause Elimination Method:

In this approach, a listing of causes that may presumably have contributed to the error symptom
is developed and tests are conducted to eliminate every error. A connected technique of
identification of the error from the error symptom is that the package fault tree analysis.

Program Slicing:
This technique is analogous to backtracking. Here the search house is reduced by process slices.
A slice of a program for a specific variable at a particular statement is that the set of supply lines
preceding this statement which will influence the worth of that variable

DEBUGGING STRATEGIES

Although there is no precise procedure for fixing all bugs, there are a number of useful strategies
that can reduce the debugging effort.

Incremental and bottom-up program development. One of the most effective ways to localize
errors is to develop the program incrementally, and test it often, after adding each piece of code.
It is highly likely that if there is an error, it occurs in the last piece of code that you wrote.

Bottom-up development maximizes the benefits of incremental development. With bottom-


up development, once a piece of code has been successfully tested, its behavior won't change
when more code is incrementally added later.

Instrument program with assertions. Assertions check if the program indeed maintains the
properties or invariants that your code relies on. Because the program stops as soon as it an
assertion fails, it's likely that the point where the program stops is much closer to the cause, and
is a good indicator of what the problem is.

Use debuggers. If a debugger is available, it can replace the manual instrumentation using print
statements or assertions. Setting breakpoints in the program, stepping into and over functions,
watching program expressions, and inspecting the memory contents at selected points during the
execution will give all the needed run-time information without generating large, hard-to-read
log files.

Backtracking. One option is to start from the point where to problem occurred and go back
through the code to see how that might have happened.

Binary search. The backtracking approach will fail if the error is far from the symptom. A
better approach is to explore the code using a divide-and-conquer approach, to quickly pin down
the bug.
Problem simplification. A similar approach is to gradually eliminate portions of the code that
are not relevant to the bug. For instance, if a function fun f() = (g();h();k()) yields an error, try
eliminating the calls to g, h, and k successively (by commenting them out), to determine which is
the erroneous one.

A scientific method: form hypotheses. A related approach is as follows: inspect the test case
results; form a hypothesis that is consistent with the observed data; and then design and run a
simple test to refute the hypothesis.

Bug clustering. If a large number of errors are being reported, it is useful to group them into
classes of related bugs (or similar bugs), and examine only one bug from each class.

Error-detection tools. Such tools can help programmers quickly identify violations of certain
classes of errors. For instance, tools that check safety properties can verify that file accesses in a
program obey the open-read/write-close file sequence; that the code correctly manipulates locks;
or that the program always accesses valid memory

DEBUGGING TOOLS

1. Gdb (the gnu debugger)

The major perk of GBD is that it allows for remote debugging. For example, you might be
running an orchestration of servers and one of them blips out.

2. Lightrun

Lightrun is a server-side debugger that lets you run tests and diagnostics against your
microservices, Kubernetes, Docker swarms, and Amazon web services.

3. Fusion Reactor

Fusion Reactor is a continuous monitoring, profiling, live debugging, and multi-channel alert
integration tool. It that offers a full suite of features that can help you hunt down your bugs,
leaks, and spikes faster and easier.
4. Interactive Disassembler

Interactive Disassembler, or IDA, is a piece of software that allows you to reverse engineer
machine-executable code back into assembly language source code.

5. Ghidra

Ghidra is a free tool originally created by the NSA and allows you to reverse engineer software
back into its original source code. It’s a full-featured SRE framework with code mining
capabilities.

6. Valgrind

Valgrind is a debugging tool that targets memory management and allows for your software to
be profiled at a software and hardware level.

7. PurifyPlus

PurifyPlus is a run-time analysis tool. What this means is that it tracks the system during run-
time and watches the CPU allocations and any other potential bottlenecks in the application.8.
LLDB

9. Affinic Debugger

Affinic Debugger has the same expected features and functionalities of debuggers – breakpoints,
insertion tools, and disassembly. However, what makes Affinic Debugger stand out is that it is
designed to work with an interface.

10. Sentry

Sentry is a monitoring platform that lets you track the performance of your code over time.

CHAPTER 2

PROGRAM TESTING

Definition:
Testing is the process of executing a program with the aim of finding errors. To make our
software perform well it should be error-free.

Principles of Testing:-

(i) All the test should meet the customer requirements

(ii) To make our software testing should be performed by a third party

(iii) Exhaustive testing is not possible. As we need the optimal amount of testing based on the
risk assessment of the application.

(iv) All the test to be conducted should be planned before implementing it

(v) It follows the Pareto rule(80/20 rule) which states that 80% of errors come from 20% of
program components.

(vi) Start testing with small parts and extend it to large parts.

TYPES OF PROGRAM TESTING:-

1. Unit Testing

It focuses on the smallest unit of software design. In this, we test an individual unit or group of
interrelated units. It is often done by the programmer by using sample input and observing its
corresponding outputs.

The objective is to take unit tested components and build a program structure that has been
dictated by design. Integration testing is testing in which a group of components is combined to
produce output.

Integration testing is of four types: (i) Top-down (ii) Bottom-up (iii) Sandwich (iv) Big-Bang

3. Regression Testing

Every time a new module is added leads to changes in the program. This type of testing makes
sure that the whole component works properly even after adding components to the complete
program.
4. Smoke Testing

This test is done to make sure that software under testing is ready or stable for further testing

It is called a smoke test as the testing an initial pass is done to check if it did not catch the fire or
smoke in the initial switch on.

5. Alpha Testing

This is a type of validation testing. It is a type of acceptance testing which is done before the
product is released to customers. It is typically done by QA people.

6. Beta Testing

The beta test is conducted at one or more customer sites by the end-user of the software. This
version is released for a limited number of users for testing in a real-time environment

7. System Testing

This software is tested such that it works fine for the different operating systems. It is covered
under the black box testing technique. In this, we just focus on the required input and output
without focusing on internal working.

8. Stress Testing

In this, we give unfavorable conditions to the system and check how they perform in those
conditions.

9. Performance Testing

It is designed to test the run-time performance of software within the context of an integrated
system. It is used to test the speed and effectiveness of the program. It is also called load testing.
In it we check, what is the performance of the system in the given load.

10. Object-Oriented Testing

This testing is a combination of various testing techniques that help to verify and validate object-
oriented software. This testing is done in the following manner:
STRATEGIES OF SYSTEM TESTING/ PROGRAM TESTING

1. Static Testing Strategy

A static test evaluates the quality of a system without actually running the system. While that
may seem impossible, it can be accomplished in a few ways.

2. Structural Testing Strategy

While static tests are quite useful, they are not adequate. The software needs to be operated on
real devices, and the system has to be run in its entirety to find all bugs. Structural tests are
among the most important of these tests.

3. Behavioral Testing Strategy

Behavioral Testing focuses on how a system acts rather than the mechanism behind its functions.
It focuses on workflows, configurations, performance, and all elements of the user journey. The
point of these tests, often called “black box” tests, is to test a website or app from the perspective
of an end-user.

TESTING TOOLS FOR PROGRAM TESTING.

Testing Automation Tools for Software Testing

1. Selenium

Selenium is a testing framework to perform web application testing across various browsers and
platforms like Windows, Mac, and Linux. Selenium helps the testers to write tests in various
programming languages like Java, PHP, C#, Python, Groovy, Ruby, and Perl. It offers record
and playback features to write tests without learning Selenium IDE.
2. TestingWhiz

TestingWhiz is a test automation tool with the code-less scripting by Cygnet Infotech, a CMMi
Level 3 IT solutions provider. TestingWhiz tool’s Enterprise edition offers a complete package
of various automated testing solutions like web testing, software testing, database testing, API
testing, mobile app testing, regression test suite maintenance, optimization, and automation, and
cross-browser testing.

3. HPE Unified Functional Testing (HP – UFT formerly QTP)

HP QuickTest Professional was renamed to HPE Unified Functional Testing. HPE UFToffers
testing automation for functional and regression testing for software applications.

4. TestComplete

TestComplete is a functional testing platform that offers various solutions to automate testing for
desktop, web, and mobile applications by SmartBear Software.

5. Ranorex

Ranorex Studio offers various testing automation tools that cover testing all desktop, web, and
mobile applications.

6. Sahi

Sahi is a testing automation tool to automate web applications testing. The open-source Sahi is
written in Java and JavaScript programming languages.

7. Watir

Watir is an open-source testing tool made up of Ruby libraries to automate web application
testing. It is pronounced as “water.”

8. Tosca Testsuite

Tosca Testsuite by Tricentis uses model-based test automation to automate software testing.
9. Telerik TestStudio

Telerik TestStudio offers one solution to automate desktop, web, and mobile application testing
including UI, load, and performance testing.

10. Katalon Studio

Katalon Studio is a free automation testing solution developed by Katalon LLC. The software is
built on top of the open-source automation frameworks Selenium, Appium with a specialized
IDE interface for API, web and mobile testing. This tool includes a full package of powerful
features that help overcome common challenges in web UI test automation.

CHAPTER 3

PROGRAMMING

Computer programming is the process that professionals use to write code that instructs how a
computer, application or software program performs. At its most basic, computer programming
is a set of instructions to facilitate specific actions.

TYPES OF PROGRAMMING

Numbery Programming:

The oldest type of computer program -- adding, multiplying, averaging and performing statistical
operations on one or more numbers, or doing matrix and vector operations, or equation solving
operations, as well as drawing graphs of numerical functions.

Bumpy Programming:

Many tasks designed for very young learners fit into this category. These are concerned with
controlling movements and changing appearances of real or simulated mobile devices, like the
LOGO physical or graphical turtle, or interactive video-based game programs involving
bumping, shooting, eating, avoiding, etc., often with accompanying swishes, bangs, thumps and
other entertaining noises. The tasks and the programming environments supporting these can
vary from very elementary to professional.

Gadgety Programming

These are programming tasks concerned with controlling devices outside a computer (e.g. the
Arduino). Some gadgets merely respond to output from the computer, e.g. a gadget that flashes
lights or makes noises under the control of the computer.

Arty Programming

E.g. for generating poetry, stories, pictures, music, dancing robots and other works of art?

There are several kinds of programs designed to produce something funny, e.g. puns, acronyms,
limericks, etc. These could be put in a separate category or treated as a sub-category of "arty"
programs.

Lifey Programming

These are programs written using 2-D patterns in a 2-D grid, which when run generate new
patterns. The most famous example of this sort of thing is Conway's 'Game of Life'. The

Modelling Programming

These are attempts to model the structure or behaviour of some previously existing system -- e.g.
the solar system, ant foraging, insect swarms, water pouring out of a jug, sand castles collapsing,
traffic "pressure waves" on a motorway, traffic flow in a busy city, financial transactions, and
many more. Some of the tasks for learners can be fairly elementary, especially if based on well-
designed libraries. Others can tax even advanced researchers, e.g. modelling weather patterns.

Exploratory Programming

This notion is orthogonal to the other types of programming: any of them could include
exploratory programming, but need not -- if used to program a solution to a well understood
problem.
Programming is exploratory when programs are not written with some well defined initial
specification of what is required, against which the programs are to be evaluated. Instead,
exploratory programming is used as a way of trying out ideas, to see what happens.

Utility (or "Application" or "Appy") Programming:

A great deal of human effort now goes into making utility programs. These may be simple but
frequently used applications e.g. a program to set an alarm to go off after a set time, or very
complex utilities written to solve a particular problem, e.g. searching for a way of decoding a
particular coded message.

Gamey Programming:

These are programs that either play a game with a user (e.g. chess, Go-Moku, Nim) or support a
game being played by two or more players (e.g. managing a game of chess, or monopoly) or
present users with some puzzle solving activity, or test of some kind of skill, e.g. Solitaire, or
Tetris

Teachy (tutorial) Programming:

These are programs that teach a user something, which may be factual, e.g. about a geographical
region, or a period of history, or some branch of chemistry or biology, or which develop a
practical or intellectual skill, such as typing, spelling, doing arithmetic, doing logic, speaking
grammatically, understanding geometry, etc

Thinky Programming:

The aim of a "Thinky" program is not usually to produce a working system whose behaviour is
useful or entertaining, or helps the programmer understand some piece of science or
mathematics, but to teach learners about ways of getting machines to do some of the things
humans and other animals do when they perceive things, learn things, solve problems, achieve
goals, make and execute plans, solve puzzles, communicate in sentences, compose poems or
music, or engage in competitive games where winning is not a matter of being, big, fast, or
physically skilled, but requires use of intellectual powers.
WHAT IS A COMPUTER PROGRAM.

A computer program is a sequence of instructions that a computer can interpret and execute via a
programming language.

Operating Systems.
An operating system is a computer program that provides a standard environment for users and
for running other computer programs. For example, linux, android, iOS and windows are
operating systems.
Applications.
An application is any computer program that is written primarily for people to use. This includes
broad categories such as office productivity, business software and media software.Mobile Apps
Applications written for mobile devices. These tend to be lightweight and may offload
processing to cloud services.
Cloud Services.
Cloud services are computer programs that work from data centers to provide services to devices
such as phones, applications and systems. For example, a cloud service that provides weather
data to a weather app.
Systems.
Systems are computer programs that are primarily designed for automation as opposed as acting
as a tool for people to use. For example, a payment system that performs transaction processing
for purchases.

Platforms
Platforms are environments for building systems and applications for the cloud or a particular
device.
Servers
Servers are computers that provide services without being used directly by users. For example, a
mail server that handles email for an office.
Clients
A program that connects to a server. For example, a web browser is a client that connects to web
servers to request web pages and media.

Embedded Systems
Embedded systems are computers and computer programs that are placed in everyday devices
such as a vacuum cleaner or bottle of water.
Internet of Things
Internet of things is a term for embedded systems that connect to the internet. For example, a
smart television that records sounds in a room and sends them to a cloud service to interpret
voice commands.

Scripts
Scripts are languages that make it easy to write simple computer programs to automate things.
For example, a graphic designer who writes a script that converts a large number of images from
one format to another.
Automation
Automation is a broad category of computing that does work and produces value. This includes
the automation of physical work in areas such as robotics.

WHAT IS A PROGRAMMING LANGUAGE?

A programming language is a computer language that is used by programmers (developers) to


communicate with computers. It is a set of instructions written in any specific language ( C, C++,
Java, Python) to perform a specific task.

TYPES OF PROGRAMMING LANGUAGE

1. Low-level programming language

Low-level language is machine-dependent (0s and 1s) programming language. The processor
runs low- level programs directly without the need of a compiler or interpreter, so the programs
written in low-level language can be run very fast.
Low-level language is further divided into two parts -

i. Machine Language

Machine language is a type of low-level programming language. It is also called as machine code
or object code. Machine language is easier to read because it is normally displayed in binary or
hexadecimal form (base 16) form. It does not require a translator to convert the programs
because computers directly understand the machine language programs.

ii. Assembly Language

Assembly language (ASM) is also a type of low-level programming language that is designed for
specific processors. It represents the set of instructions in a symbolic and human-understandable
form. It uses an assembler to convert the assembly language to machine language.

2. High-level programming language

High-level programming language (HLL) is designed for developing user-friendly software


programs and websites. This programming language requires a compiler or interpreter to
translate the program into machine language (execute the program).

A high-level language is further divided into three parts -

i. Procedural Oriented programming language

Procedural Oriented Programming (POP) language is derived from structured programming and
based upon the procedure call concept. It divides a program into small procedures called routines
or functions.

ii. Object-Oriented Programming language

Object-Oriented Programming (OOP) language is based upon the objects. In this programming
language, programs are divided into small parts called objects. It is used to implement real-world
entities like inheritance, polymorphism, abstraction, etc in the program to makes the program
reusable, efficient, and easy-to-use.

iii. Natural language


Natural language is a part of human languages such as English, Russian, German, and Japanese.
It is used by machines to understand, manipulate, and interpret human's language. It is used by
developers to perform tasks such as translation, automatic summarization, Named Entity
Recognition (NER), relationship extraction, and topic segmentation.

3. Middle-level programming language

Middle-level programming language lies between the low-level programming language and
high-level programming language. It is also known as the intermediate programming language
and pseudo-language.

PROGRAMMING LANGUAGE

As we all know, the programming language makes our life simpler. Currently, all sectors (like
education, hospitals, banks, automobiles, and more ) completely depend upon the programming
language.

There are dozens of programming languages used by the industries. Some most widely used
programming languages are given below -

1. Python

Python is one of the most widely used user-friendly programming languages. It is an open-source
and easy to learn programming language developed in the 1990s. It is mostly used in Machine
learning, Artificial intelligence, Big Data, GUI based desktop applications, and Robotics.

2. Java

Java is a simple, secure, platform-independent, reliable, architecture-neutral high-level


programming language developed by Sun Microsystems in 1995. Now, Java is owned by Oracle.
It is mainly used to develop bank, retail, information technology, android, big data, research
community, web, and desktop applications.

3. C

C is a popular, simple, and flexible general-purpose computer programming language. Dennis M


Ritchie develops it in 1972 at AT&T. It is a combination of both low-level programming
language as well as a high-level programming language. It is used to design applications like
Text Editors, Compilers, Network devices, and many more.

4. C++

C++ is one of the thousands of programming languages that we use to develop software. C++
programming language is developed by Bjarne Stroustrup in 1980. It is similar to the C
programming language but also includes some additional features such as exception handling,
object-oriented programming, type checking, etc.

5. C#

C# (pronounced as C sharp) is a modern, general-purpose, and object-oriented programming


language used with XML based Web services on the .NET platform. It is mainly designed to
improve productivity in web applications. It is easier to learn for those users who have sufficient
knowledge of common programming languages like C, C++, or Java.

6. JavaScript

JavaScript is a type of scripting language that is used on both client-side as well as a server-side.
It is developed in the 1990s for the Netscape Navigator web browser. It allows programmers to
implement complex features to make web pages alive. It helps programmers to create dynamic
websites, servers, mobile applications, animated graphics, games, and more.

7. R

Currently, R programming is one of the popular programming languages that is used in data
analytics, scientific research, machine learning algorithms, and statistical computing.

8. PHP

PHP stands for Hypertext Preprocessor. It is an open-source, powerful server-side scripting


language mainly used to create static as well as dynamic websites. It is developed by Rasmus
Laird in 1994. Inside the php, we can also write HTML, CSS, and JavaScript code. To save php
file, file extension .php is used.

9. Go
Go or Golang is an open-source programming language. It is used to build simple, reliable, and
efficient software. It is developed by Robert Griesemer, Rob Pike, and Ken Thompson in 2007.

10. Ruby

Ruby is an open-source, general-purpose, and pure object-oriented programming language


released in 1993. It is used in front-end and back-end web development. It is mainly designed to
write CGI (Common Gateway Interface) scripts.

You might also like