You are on page 1of 17

KYAMBOGO UNIVERSITY

FACULTY OF ENGINEERING

DEPARTMENT OF ELECTRICAL AND ELECTRONIS


ENGINEEERING

BACHELOR OR ENGINEERING IN MECHATRONICS


AND BIOMEDICAL ENGINEERING

TEMB 3101: MICROELECTRONICS

NAME: MAKAFU JOSEPH JAMES

REGISTRATION NUMBER: 19/U/BIO/178/GV

LECTURER: Mr. KIBUUKA JULIUS

DATE: 1ST/08/2022

1
PROGRAMMING
Computer programming is the process of writing a code or set of instructions to be interpreted
and executed by a computer or another electronics device.

Computer program
A computer program is a sequence of instructions that a computer can interpret and execute.

Computer programs can be characterized as interactive or batch in terms of what drives them and
how continuously they run.

 Interactive programs. These programs receive data from an interactive user or possibly
from another program that simulates an interactive user. A command interpreter or a
web browser are examples of an interactive program.
 Batch programs. These programs run, do their work and then stop. A batch program can be
started directly by a user, or it can be invoked to run by an interactive program. A program
that computes and prints out a company payroll is an example of a batch program. Print jobs
are also batch programs.

1. 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.

2. Application

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.

3. 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.

2
4. Platforms

Platforms are environments for building systems and applications for the cloud or a particular
device.

5. Embedded Systems

Embedded systems are computers and computer programs that are placed in everyday devices
such as a vacuum cleaner or bottle of water.

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, and Python) to perform a specific task.

A programming language is mainly used to develop desktop applications, websites, and mobile
applications.

Types of programming languages

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. It does not require a translator to convert the programs because computers
directly understand the machine language programs.

The advantage of machine language is that it helps the programmer to execute the programs
faster than the high-level programming language.

3
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.

The advantage of assembly language is that it requires less memory and less execution time to
execute a program.

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). The main advantage of a
high-level language is that it is easy to read, write, and maintain.

High-level programming language includes Python, Java, JavaScript, PHP, C#, C++, Objective
C, COBOL, Perl, Pascal, LISP, FORTRAN, and Swift programming language.

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.

Procedural Oriented programming language is used by a software programmer to create a


program that can be accomplished by using a programming editor like IDE, Adobe
Dreamweaver, or Microsoft Visual Studio.

The advantage of POP language is that it helps programmers to easily track the program flow
and code can be reused in different parts of the program.

Example: C, FORTRAN, Basic, Pascal, etc.

4
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.

The main advantage of object-oriented programming is that OOP is faster and easier to execute,
maintain, modify, as well as debug.

Note: Object-Oriented Programming language follows a bottom-up approach.

Example: C++, Java, Python, C#, etc.

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.

The main advantage of natural language is that it helps users to ask questions in any subject and
directly respond within seconds.

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.

A middle-level programming language's advantages are that it supports the features of high-level
programming, it is a user-friendly language, and closely related to machine language and human
language.

Example: C, C++, language

5
Most commonly used Programming Language

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

1. Python Programming Language

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.

Advantages

 Python is easy to read, easy to understand, and easy to write.

 It integrates with other programming languages like C, C++, and Java.

 Python executes code line-by-line, so it is easy for the programmer to find the error that
occurred in the code.

 Python is platform-independent means you can write code once and run it anywhere.

Disadvantages

 Python is not suitable for developing mobile applications and games.

 Python works with the interpreter. That's why it is slower than other programming
languages like C and C++.

2. Java programming language

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


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

6
Advantages

 Java is easy to write, compile, learn, and debug as compared to other programming
languages.

 It provides an ability to run the same program on different platforms.

 It is a highly secured programming language because in java, there is no concept of


explicit pointers.

 It is capable of performing multiple tasks at the same time.

Disadvantages

 Java consumes more memory and slower than other programming languages like C or
C++.

 It does not provide a backup facility.

3. C Programming Language

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.

Advantages

 C language is easy to learn.

 It is fast, efficient, portable, easy to extend, powerful, and flexible programming


language.

 It is used to perform complex calculations and operations such as MATLAB.

Disadvantages

 In the C programming language, it is very difficult to find the errors.


7
 C does not support the concepts of constructors, destructors, abstraction, polymorphism,
encapsulation, and namespace like OOPs.

4. C++ Programming Language

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

Advantages

 C++ is a simple and portable structured programming language.

 It supports OOPs features such as Abstraction, Inheritance, and Encapsulation.

 It provides high-level abstraction and useful for a low-level programming language, and
more efficient for general-purpose.

 C++ is more compatible with the C language.

Disadvantages

 C++ programming language is not secured as compared to other programming languages


like Java or Python.

 C++ cannot support garbage collection.

 It is difficult to debug large as well as complex web applications.

5. C# Programming Language

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.

Advantages

8
 C# is a modern, type-safe, easy, fast, and open-source programming language that is
easily integrated with Windows.

 The maintenance of C# (C sharp) is lower than the C++ programming language.

 C# is a pure object-oriented programming language.

 C# includes a strong memory backup facility. That's why it avoids the problem of
memory leakage.

Disadvantages

 C# is less flexible because it is completely based on Microsoft .Net framework.

 In C#, it is difficult to write, understand, debug, and maintain multithreaded applications.

6. JavaScript Programming Language

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 helps programmers to
create dynamic websites, servers, mobile applications, animated graphics, games, and more.

Advantage

 It can be used to decrease the loading time from the server.

 It has the ability to create attractive, dynamic websites, and rich interfaces.

 JavaScript is a simple, versatile, and lightweight programming language.

 JavaScript and its syntax are easy to understand.

Disadvantage

 JavaScript is completely based on the browser.

 It does not support multiple inheritance.

 It is less secure compared to other programming languages.


9
DEBUGGING.
Debugging is the process of identifying a problem, isolating the source of the problem, and then
either correcting the problem or determining a way to work around it.

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.

Types of bugs.

1. Functional errors

This is a broad type of error that happens whenever software doesn’t behave as intended. For
example, if the end user clicks the “Save” button, but their entered data isn’t saved, this is a
functional error. After some investigation, a software tester may identify a more specific culprit
behind the error and reclassify it as a different type of bug.

2. Syntax errors

A syntax error occurs in the source code of a program and prevents the program from being
properly compiled. This type of error is very common and typically occurs when there are one or
more missing or incorrect characters in the code. For example, a single missing bracket could
cause a syntax error.

Compiling programs typically indicate where a syntax error has occurred so the programmer can
fix it.

3. Logic errors

A logic error represents a mistake in the software flow and causes the software to behave
incorrectly. This type of error can cause the program to produce an incorrect output, or even
hang or crash. Unlike syntax errors, logic errors will not prevent a program from compiling.

A common logic error is the infinite loop. Due to poorly written code, the program repeats a
sequence endlessly until it crashes or halts due to external intervention, such as the user closing a
browser window or turning the power off.

10
4. Calculation errors

Anytime software returns an incorrect value — whether it’s one the end user sees or one that’s
passed to another program — that’s a calculation error. This could happen for several reasons:

 The software is using the wrong algorithm to calculate the value.


 The calculation has a data type mismatch.
 The developers have coded the calculation or value hand-off to another program
incorrectly.

While such an error can be costly in certain contexts — like in banking, where an incorrect
calculation can result in the loss of money — hunting down the calculation error is typically just
a matter of math.

5. Unit-level bugs

Unit-level software bugs are the most common. They’re also typically the easiest to fix.

After your software is initially coded, you need to see how it works through unit testing —
taking a small, logical section of code and verifying that it performs as designed. This is where
various forms of state machine bugs, calculation errors, and basic logic bugs are often
uncovered.

6. System-level integration bugs

This type of bug occurs when two or more pieces of software from separate subsystems interact
erroneously. Often the two sets of code are written by different developers. LaVine explains that
even when there’s a solid set of requirements for developers to follow, there’s usually some level
of interpretation required or details that get overlooked, causing the interaction between two
pieces of software to fail.

“System-level integration bugs are harder to fix because you’re dealing with more than one piece
of software, so the complexity increases while overall visibility decreases,” LaVine says. “This
class of bug is often caused by things like byte-swapping, message parsing, or memory overflow
issues.”

7. Out of bounds bugs

LaVine notes that these types of software bugs show up when the end user interacts with the
software in ways that weren’t expected. This often occurs when the user sets a parameter outside
the limits of intended use, such as entering a significantly larger or smaller number than coded
for or inputting an unexpected data type, like text where a number should be.

11
The 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. Analyze 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:

Brute force method: It is the most common method of debugging but is the least efficient
method. In this approach, print statements are inserted throughout the program to print the
intermediate values with the hope that some of the printed values will help to identify the
statement in error. This approach becomes more systematic with the use of a symbolic debugger
is also called a source code debugger.

Backtracking: This is also a fairly common approach. In this approach, starting from the
statement at which an error symptom has been observed, the source code is traced backwards
until the error is discovered. Unfortunately, as the number of source lines to be traced back
increases, the number of potential backward paths increases.

Cause elimination method: In this approach, once a failure is observed, the symptoms of the
failure are noted. Based on the failure symptoms, the causes which could have contributed to the
symptom is developed and tests are conducted to eliminate each. A related technique of
identification of the error from the error symptom is the software fault tree analysis.

4. Program slicing: This technique is similar to backtracking. In the backtracking approach, one
often has to examine a large number of statements. However, the search space is reduced by
defining slices. A slice of a program for a particular variable and at a particular statement is the
set of source lines preceding this statement that can influence the value of that variable. Program
slicing makes use of the fact that an error in the value of a variable can be caused by the
statements on which it is data-dependent.

Debugging Tools
There are two debugging tools. The first is a trace mechanism that can be used on the global
functions in the top-level loop.

12
The second tool is a debugger that is not used in the normal top-level loop. After a first program
run it is possible to go back to breakpoints, and to inspect values or to restart certain functions
with different arguments.

This second tool only runs under UNIX, because it duplicates the running process via a fork

13
PROGRAM TESTING
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. If testing is done successfully it will remove all the
errors from the software.

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 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.

2. Integration Testing

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

14
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. 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:

i. Testing of Requirements,

ii. Design and Analysis of Testing,

iii. Testing of Code,

15
iv. Integration testing,

v. System testing,

vi. User Testing.

Testing tools for program testing.


1. Testing Whiz

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

3. Test Complete

4. Ranorex

5. Sahi

6. Watir

7. Tosca Test suite

8. Telerik Test Studio

9. Katalon Studio

16
https://www.jotform.com/blog/types-of-software-bug/

https://www.techtarget.com/searchsoftwarequality/definition/debugging/

17

You might also like