You are on page 1of 127

Programming 2020

Contents:
1. Introduction to algorithm
2. Features of algorithm
3. Advantages of algorithm
4. Disadvantages of algorithm
5. Basic example of algorithm with flowchart
6. Outline process
7. Development environment
8. Software that I prefer for design an application
9. Programming language
10. Platform environment
11. Architecture design of inventory management system
12. Data dictionary
13. Algorithm and flowchart of inventory management system
14. Step taken from writing code to execution
15. Implementation of algorithm
16. Implementation of algorithm in IDE
17. Relationship between algorithm and code variant
18. Suitability of language
19. Limitation of language
20. Conclusion

Name (HND / First Semester) 1


Programming 2020

Introduction to Algorithm:
Suppose computers were infinitely rapid and computer memory was free. Would you have any
reason to take a look at algorithms? The answer is sure, if for no other reason than that you would
still like to demonstrate that your solution method terminates and does so with the correct answer.
So, Algorithm is the step by step representation of program written in simple language just to
understand how the program actually work. They are generally created independent of underlying
language, i.e. it can be implemented in more than one programming language. The concept of
algorithm has existed for centuries.

Here are some features of algorithms,

Features of Algorithm:
• Input /Output

Algorithm must have 0 or more well-defined inputs. Some algorithm may not take any input
but also algorithm can take 0 or more input. Similarly, it must generate at list one output like
a function algorithm must generate some result. Otherwise no use of making algorithm.

• Definiteness

Every instruction should be unambiguous and it should have clear and exact meaning. We
can’t write statement which can’t understand and which have no meaning.

• Finiteness

The duration of algorithm must be finite. Algorithm should always terminate after certain
steps like a function.

• Independent

Algorithm should have step by step direction which should be independent to any other
programming code.

Now here are some advantages and dis-advantages of algorithms,

Advantages of Algorithm:
➢ Easily written and Easy to understand

Algorithm is written in simple language without using code and it is not dependent in any

Name (HND / First Semester) 2


Programming 2020

language. So, it can be easily written and easy to understood anyone even without
programming knowledge.

➢ Easy to debug And Easy to convert into program

Every step in an algorithm has its own logical sequence. So, it is easy to debug. By using
algorithm, the problem is broken down into smaller pieces or steps hence, it is easier for
programmer to convert it into an actual program.

➢ Less error

When we write a program, if it is based on a correct algorithm, it has less error or no error.
So, with the help of this less reediting can be minimized.

➢ Concentration on solving problem

While writing an algorithm we only concentrate on solving problem rather than syntax error
and code error. If we do program without algorithm, listing of problem might be appear one
after the other like syntax errors, code errors, query trouble and so on. So, it helps to
concentrate on problem only while writing algorithm.

Dis-advantages of Algorithm:
➢ Time Consuming

First writing algorithm and then converting it into flowchart and then finally writing program
or coding. It takes more time.

➢ Difficult to show big tasks, looping and branching because they are complicated to create.
➢ Virtualization

It is written in easy language without using any programming language. So, it is just a
virtualization of program, it mayn’t feature like actual program.

➢ Lack of clarity

It only command to do something however doesn’t offers information about that.

Name (HND / First Semester) 3


Programming 2020

Basic Example of Algorithm: Flowchart

Find the largest among two number

Step 1 – Start

Step 2 – Output largest number

Step 3 - Output Input two number

Step 4 – Input a & b

Step 5 – If (a > b)

Step 6 – Output Largest is a

Step 7 – Else

Step 8 – Output Largest is b

Step 9 – Stop

Outline process of software development:


Outline process is the process that produces software with the highest quantity and lowest price
inside the shortest time. It actually defines all the task that are required to develop and maintain a
software. Outline process involves several distinct stages, including planning, design, development,
testing, and deployment. Popular outline process models consist of the waterfall model, spiral model,
and Agile model.

Outline process works by reducing the fee of software program while simultaneously improving
quality and shortening production time. Outline process achieves goals by following a plan that
removes an unsuspected difficulty of software development projects. That plan starts by evaluating
existing systems for deficiencies. Next, it defines the requirements of the new system. It then creates
the software through the stages of design, development, testing, and deployment which are describes
below:

Name (HND / First Semester) 4


Programming 2020

• Planning

The purpose of the first phase is to consist a details steps from the beginning of the process to
until the end. The study of economical, technological and other problem while designing and
developing project or product. It also finds out the scope of the problem and determine
solutions resources costs, time, benefits and other items should be considered here.

• System Analysis and Requirements

The second phase is where getting input from all stakeholders, including customers,
salespeople, industry experts, and programmers. It’s also where system analysis takes place
or analyzing the needs of the end users to ensure the new system can meet their expectations.
Systems analysis is vital in determining what a business’s needs are, as well as how they can
be met, who will be responsible for individual pieces of the project, and what sort of timeline
should be expected.

Name (HND / First Semester) 5


Programming 2020

• System Design

The third stage describes, in detail, including screen layouts, features and operations that will
satisfy the functional requirements of the proposed system. It clearly defines all the
architectural modules of the product along with its communication, entity relationship
diagram and data flow representation with the external the third modules (if any).

• Development3

Now the real work begins! The development stage marks the end of the initial section of the
process. Additionally, this stage signifies the start of the production by writing code for
product. Different high-level programming languages such as C, C++, C#, Java and PHP are
used for coding. The development stage also characterized by instillation and change.

• Integration and Testing

This stage involves system integration and system testing (of programs and procedures)
normally carried out by a Quality Assurance (QA) professional to determine if the proposed
design meets the initial set of business goals. However, this stage refers to the testing stage of
the product where product defects are reported, tracked, fixed and retested, until the product
meets original specifications.

• Deployment and Maintenance

As soon as product is given to the customer, they will first do beta testing. If any changes
required or if any bugs are caught, then they will report to the engineering team. Once those
changes are made or bugs are fixed then the final deployment will happen.

Once when the customers start using the developed system then the actual problem comes up
and needs to solve from time to time. The process where the care is taken for the developed
product is called maintenance.

Development Environment:
A development environment is a group of strategies and tools for developing, checking out and
debugging an application or program. The development environment has three server tiers, called
development, staging and production. All three tiers together are normally referred to as the DSP.

▪ Development Server: Here the developer tests code and checks whether the application runs

Name (HND / First Semester) 6


Programming 2020

successfully with that code.


▪ Staging Server: This environment is made to look just like the production server
environment. The application is tested on the staging server to check for reliability and to
ensure it does not fail on the actual production server.
▪ Production Server: Once the approval is finished, the application then becomes a part of this
server.

Software that I prefer for design an application:


Microsoft Visual Studio

Microsoft Visual Studio is an integrated development environment (IDE) product from Microsoft. It
is commonly used to develop computer programs, as well as websites, web apps and mobile apps.
An example of an IDE product is Microsoft’s Visual Studio .NET. This software uses Microsoft
software development platforms such as Windows form, Windows API, Windows Store and so on.

Fig: Microsoft visual studio

Name (HND / First Semester) 7


Programming 2020

Visual Studio enable to write code accurately and efficiently without losing the current document
context. It guides with live assistance as write code, no matter what language is use, from C#/VB and
C++ to JavaScript and Python. It can easily zoom into details such as call structure, related functions,
check-ins, and test status. It can also identify, and fix code issues. It can produce both local and
managed code. It can create database connectivity to store data by using MySQL Workbench. So, I
have used Visual Studio to design application.

MySQL Workbench

MySQL is an open source software. As I said before it helps to create database connectivity to store
data. MySQL for Visual Studio provides entry to MySQL objects and data from Visual Studio. As a
Visual Studio package, MySQL for Visual Studio combine directly into Server Explorer providing
the ability to create a new connections and work with MySQL database objects. Here data can be
easily insert, update, retrieve and delete. PHP (Hypertext Preprocessor) is an open source software
and works fine with MySQL Server. It is a server-side scripting language that help to create dynamic
websites. What actually happens here is, the PHP code will be executed on the server and at the
browser side its HTML code will be displayed.

XAMPP

XAMPP is an open source free software developed by Apache friends. XAMPP software package
contains Apache distributions for Apache server, PHP, Perl etc. And it is normally a local host or a
local server. This local server works on desktop or laptop computer. It gives appropriate environment
for testing MYSQL, PHP, Apache and Perl projects on the local computer.

Programming Language:
A programming language is a special language programmer use to develop software programs that
implement specific algorithms. It is also a set of instructions for computers to execute. Computer
programming languages allow to provide instructions to a computer in a language the PC is familiar
with. There is an array of computer programming languages that programmers can use to
communicate with a computer just as many human-based languages exist. The part of the language
that a computer can understand is known as a “binary.” There are dozens of programming languages
used in the industry today. Some of them are Python, C, Java, C++, C#.NET, JavaScript, Swift and
so on.

Name (HND / First Semester) 8


Programming 2020

Among those all programming language I prefer C#

C# (pronounced C-sharp) is a programming language based on C++ and C developed by Microsoft.


It was introduced to the public in June 2000 with the announcement of the .NET ("dot
net") framework. In 2003, the C# language became an ISO standard. It is an object-oriented
programming language used with XML-Based services on the .NET platform and designed for
improving productivity in the development of Web applications.

Advantages C# language (Features of C#)

However, there are many advantages of C# language but some are the important advantages of C#
language which are described here.

• Object-oriented

C# programming language is a pure object-oriented language so that it allows to create


modular maintainable applications and available codes. It is one of the biggest advantages of
C# over C++ languages.

• Cross platform

.NET framework is most important requirement for C# programming. You have to install the
.NET framework to run application well.

• Computerized rubbish collection

In C# programming, a very efficient system installed that collect and erase rubbish
automatically present on the system. However, we called that C# language is very efficient in
managing the system because it doesn’t create a mess in the system, and the system doesn’t
get hanged during execution.

• Avoid the problem of memory leak

The major benefit of C# language is its strong memory backup. C# programming language
contains high memory backup in order that memory leakage problem and other such types of
problem isn’t always taking place because it occurs within the case of C++ language.

Name (HND / First Semester) 9


Programming 2020

• Easy to development

C# language has a rich class of libraries that make many functions easy to be carried out The
C# programming language has a power on maximum of the programmers of the world and
has a record inside the programming world.

• Better integration

An application written in .NET will have could have higher integration and interpretability as
compared to other NET Technologies. Actually, C# programming runs on CLR which
making it easy to integrate with components written in other languages.

• Cost-benefit

Protection cost is much less and is much secure to run in comparison to other language.

• Familiar syntax

It is pretty easy to pick up and work in productively with a working knowledge of languages
like C, C++, Java due to the fact its core syntax is much like C-style languages.

• Programming support

We can purchase assist from the Microsoft in C# programming. If any trouble happens, we
can clear up it with the help of Microsoft.

• Properties and indexers

C# programming has features like Properties and Indexers which are not available in Java
language.

• Most powerful

It is the most powerful programming language for the .NET Framework.

• Motivated towards work


We already discussed that .NET applications work on Windows platforms only and Microsoft
keeps retiring support for old Windows platforms. So constantly you'll need to upgrade you
.net framework. But after the upgrade, this will be an advantage or a drawback as well.
Hence, it usually motivates to work hard and excel in our field and this is good things in my

Name (HND / First Semester) 10


Programming 2020

point of view.

So, C# is a modern, type safe programming language, object-oriented language that allows
programmers to quick and without difficulty build solution for the Microsoft .NET platform. Due to
those benefits and features that I mention, I choose C# programming language with .NET
Framework to design and develop my project.

Platform Environment:
Platform environment is an environment where the development of piece of the application or
software is carried out. While developing a new desktop application for windows PCs, you have to
make sure which application platform are you going to use. All Windows application platforms let
you create desktop apps like Word, Excel, and Photoshop that run in the classic Windows desktop
and take full advantage of that environment's specific features.

UWP, WPF and Windows Forms are the platforms provide managed runtime environments (the
Windows Runtime for UWP, and.NET for Windows Forms and WPF) with many advantages,
especially inside the areas of productivity Customizable UI and application security. Among these I
used Windows Forms platform to design and develop inventory management system because it is
fast and secure for the .NET Framework. This is a forms-based, fast application development
platform with a large built-in collection of visual and non-visual drag-and-drop controls. Windows
Forms contains a variety of controls/tools like text boxes, buttons, radio buttons, data grid views to
display data from database, toolstrip and menu strip for toolbar and menus, picture box to add picture
etc. The .NET Framework introduces an infrastructure called Code Access Security that lets you
differentiate the permissions, that code has from the rights that the user has. While using Visual
Studio you can create a window forms smart client application that display data, request input from
user and communicate with remote computers over a network.

Architecture design of Inventory management System:


Application architecture is the organizational layout of an entire software application, including all
sub-components and external applications interchanges. There are several layout patterns which can
be used to outline this form of architecture, and these patterns help to communicate how an
application will complete the necessary business processes as defined in the system requirements.
One of the essential tasks for IT projects chief or architect is to have software diagram created. it
may be both application flow, infrastructure diagram or software program design.

Name (HND / First Semester) 11


Programming 2020

Fig: architecture design of inventory management system

Data Dictionary:
A Data Dictionary is a group of names, definitions, and attributes about records elements which
might be being used or captured in a database, information system, or a part of a research project. A
Data Dictionary provides information about each attribute, of a data model. It is used by SQL Server
to execute queries. It is automatically updated when the objects are added, removed, or changed in
the database. An attribute is an area within the database that holds information. It helps to make
easier to analyze. Here, I have designed a data dictionary of Inventory Management System. It’s.
You can get detail information about each field name with their attributes, datatype, length,
constraint and description.

Name (HND / First Semester) 12


Programming 2020

Field Attributes Datatype Length Constraint Description


Name
UserID Int 10 PK, NOT NULL Unique ID of each staff
Unsigned
Name Varchar 255 NULL Name of staff
Address Varchar 255 NULL Address of staff
Staff Phone Varchar 10 NULL Phone number of staff
UserName Varchar 255 NULL UserName of staff
Password Varchar 255 NULL Secret password of staff
Remarks Varchar 255 NULL Important remark of
staff
SupplierID Int 10 PK, NOT NULL Unique ID of supplier
Unsigned
SupplierName Varchar 255 NULL Name of supplier
Supplier Address Varchar 255 NULL Address of supplier
Telephone varchar 10 NULL Telephone number of
supplier
Remarks varchar 255 NULL Remark of supplier
ProductID Int 10 PK, NOT NULL Unique ID of product
Unsigned
Product ProductName Varchar 255 NULL Name of the product
Unit Int 11 NULL Unit of product
SellingPrice Int 11 NULL Selling price of product
CostPrice Int 11 NULL Cost price of product
StockQuantity Int 11 NULL Quantity of Stock
CustomerID Int 10 PK, NOT NULL Unique ID of each
Unsigned customer
CustomerName Varchar 255 NULL Name of the customer
Customer Address Varchar 255 NULL Address of the customer
Telephone Varchar 10 NULL Telephone number of
customer

Name (HND / First Semester) 13


Programming 2020

Remarks Varchar 255 NULL Important remark of


customer
SalesID Int 10 PK, NOT NULL Unique ID of sales
Unsigned
InvoiceNo Int 10 NULL Invoice number of sales
Sales CustomerID Int 150 FK, NULL Unique ID of customer
DateofSales Date NA NULL Date of sales
AmountofIncoice Int 11 NULL Amount of Sales
Remarks Text NA NULL Remark of sales

PurchaseID Int 10 PK, NOT NULL Unique ID of purchase


Unsigned
InvoiceNo Int 11 NULL Invoice number of
Purchase purchase
SupplierID Int 10 FK, NULL Unique ID of supplier
DateofPurchasse datetime NA NULL Date of purchase
AmountofInvoice Int 11 NULL Amount of invoice
Remarks Varchar 255 NULL Remark of purchase
SalesDetailsID Int 10 PK, NOT NULL Unique ID of
Unsigned salesdetails
ProductID Int 10 FK, NULL Unique ID of product
Salesdeta Quantity Int 10 NULL Quantity of sales
ils
SalesRate Int 10 NULL Rate of sales

SalesID Int 10 NULL Unique ID of sales


PurchaseDetailsI Int 10 PK, NOT NULL Unique ID of
D Unsigned purchasedetails
ProductID Int 10 FK, NULL Unique ID of product
Purchase
details
Quantity Int 11 NULL Quantity of purchase
PurchaseRate Int 11 NULL Rate of purchase
PurchaseID Int 10 NULL Unique ID of purchase

Name (HND / First Semester) 14


Programming 2020

Algorithm and Flowchart of Inventory management system:

Login Module:

Step 1: Start

Step 2: Run application

Step 3: Enter username and password correctly

Step 4: Press the Login button

Step 5: If the user is authorized then login successful, go to


dashboard

Else login unsuccessful, go back to step 3

Step 6: Stop

Transaction Sales Form:

Step 1: Start

Step 2: After Successful login, dashboard loads

Step 3: Click on Transaction and then Sales button to enter


into Sales form

Step 4: Sales form opens then, provide required information

Step 5: If the required information sufficient, Click add button


to save data.

Else Save unsuccessful, go back to step 3

Step 6: Stop

Name (HND / First Semester) 15


Programming 2020

Data Entry Staffs Form:

Step 1: Start

Step 2: After login, Dashboard loads

Step 3: Click on Data Entry and then Staff button to enter


into Staffs form

Step 4: Staffs form opens then, provide necessary


information

Step 5: If the required information sufficient, Click add


button to save data

Else Save unsuccessful, go back to step 3

Step 6: Stop

A flowchart is a graphical representation of a process. Each step in the process is represented by a


different symbol which contains a short description of the process step. The flowchart symbols are
linked together with arrows that shows the process flow direction. In this application, flowchart help
us to know how the application runs or flows and provides blueprint of this application. At first, we
have to run our application which provide us a Login Form. If we are already an admin user of
inventory management system, we have to enter email or username and password which bring us to
the dashboard Else we have to create an account and after becoming admin user we can now Sign Up
and move to dashboard. Dashboard provides facilities like adding, deleting, updating, and view of all
the employees and product and the data can be saved in a database as well. The following is the
flowchart which I have made for Chaudhary Trades.

Name (HND / First Semester) 16


Programming 2020

Fig: flowchart of inventory management system

Steps taken from writing code to execution


When our program is converted to binary, which is machine language. We need to execute it to see
the output. So, Execution is the process by which a computer explains our program or performs the
instructions of our program. For example, when we written a program to print your name. Then it
first converts into machine language by complier and after that your program will be executed. i.e.
the computer will perform the instructions of your program which say to print your name.

Generation process of code:

In the computing, code generation is the process by which a complier’s code generator converts
source code into the form of 0 and 1 i.e. binary which can be executed by the system. System doesn’t
understand other language written by source except binary. So, to translate source code into machine

Name (HND / First Semester) 17


Programming 2020

language generation process of code is used. And then system accept and execute the converted
code. After complication take place complied program is displayed in the screen in high level
language by take some space from memory. The process that take place while executing the program
is describes below:

fig: program execution process

o Editor

This is the environment where programmer write a code. Like Dev-cpp (for C, C++), Visual
Studio (for C#, python), Python (for python) and so on.

o Role of Pre-processor

The source code passed through the pre-processor produces a source code file with its
preprocessing commands and sorted out properly. Then it is finalized for the compiler and
goes for further processing. The main three roles of the preprocessor are: it performs as
comment remover. If there is comment code present in program, it removes comment code.
Then it also helps in execution process by replaces macro name with the code. Then finally it
includes header file in source code.

Name (HND / First Semester) 18


Programming 2020

o Role of Complier

A complier is a program that reads a program which is written in high level language and
translates into an equivalent program in binary language. Scans the whole program and
translates it into machine code. Commonly, programmer writes program in a programming
language like java, pascal, python, C, C++, C# and so on. It helps in conversation with
machine and human by translating high level language to machine language. So, it plays role
like linker between computer and human. The translation process should also detect and
report the presence of errors in the sources program.

o Role of Interpreter

Interpreter perform line by line execution of the source code which is written in high level
language. Interpreter read code line by line, convert it into machine understandable from,
execute the line, and then proceeds with the next line. The main role of the interpreter is to
convert the source code directly and execute it.

o Role of Assembler

An assembler is a program that takes basic computer instruction which is written in assemble
language and converts them into the machine code which is direct understandable by system.

o Role of Linker

The linker links all the functions and files required by the object code and converts the object
code to executable code. The converted code is stored with a .exe extension. The linker gives
error if the file or function that has to be linked does not exist.

o Role of Loader

A loader is the part of operating system that is responsible for loading programs. It is one of
the essential stages in the process loader loads the executable files into main/primary memory
and prepares them for execution. In this stage it can also generate errors. These errors are

Name (HND / First Semester) 19


Programming 2020

called as a run time error.

o Role of Memory

Loaded executable files take some space from the main/primary memory to display output
whenever programmer execute a program. Main memory is essentially the RAM (Read Only
Memory) of the PC, laptop, computer or any machine that you are running the code.

This is all about the code or program execution process. This document helps you to know the
background process of code execution or how the actual program works.

Implementation of an algorithm:
Algorithm is the step by step representation of program written in simple language just to understand
how the program actually works that helps to write the code and flowchart is the blueprint of the
program where we depend on to make the original. Both algorithm and flowchart help in coding in
logical way. It helps to understand the flow of program. It plays important role in deployment of the
application. Here you can see the connection between algorithm and code and the important role of
algorithm, flowchart and code that how I have used them to design the application.

Example of algorithm and flowchart to find greater number:


Step 1: Start
Step 2: Read the numbers, say A, B,
C
Step 3: If (A>B) and (A>C) then A
is the largest number Else C is the
largest number, go to Step 5.
Step 4: If (B>A) and (B>C) then B
is the largest number Else C is the
largest number.
Step 5: Stop

Name (HND / First Semester) 20


Programming 2020

Implementation of algorithm in IDE:


An integrated development environment is a software that provides facilities to computer
programmers for software or application development. An IDE commonly consists of a source code
editor, build automation tools, and a debugger. Most of the modern IDEs have intelligent code
completion. I have used this software during my task to write code, test for errors and translate a
program. I have used different tools which helped me to design an application for Chaudhary Trades.
I have used UI tools to make user-friendly application. Algorithm is the step by step representation
of program written in simple language just to understand how the program actually work and also
helps in developing the application. It shows me best direction and logical way during coding time to
develop an application. You can see the example of the algorithm and UI development process which
is given below:

Login Module:
Algorithm UI Design
Step1: Start
Step2: Run application
Step3: Enter email and password
Step4: Press the Sign-Up button
Step5: If the user is authorized then login
successful, go to dashboard
Else login unsuccessful, stay in login
Page
Step6: Stop

I have designed a User Interface for Login Form which is based on algorithm that you can see in
above table. At first, we have to run our application which provide us a Login Form. If we are
already an admin user of inventory management system, we have to enter email or username and
password which bring us to the dashboard Else we have to create an account and after becoming
admin user we can now Sign Up and move to dashboard. In case I have not used algorithm then I
never know how it works because algorithm help us to understand the flow of program of
application. It helped me during development process because each and every form of my

Name (HND / First Semester) 21


Programming 2020

application I have applied algorithm. So, implementation of algorithm with IDE is very important.

Relationship between algorithm and code variant:


Algorithm is like a way map of certain place. As we know map shows us way to reach into place. It’s
like blueprint by following it we can get to the place. Similarly, algorithm is like a map which show
the logical path or direction. So that, programming code depends on it. It is also a blueprint of an
application. It shows us how the actual program works. It is independent to any programming
language so that it is written in simple language. While developing an application algorithm is
necessary to understand the flow of program and how its works. As shown in the above table first I
have written algorithm and by implementing that instructions I have design a Login Form. So, the
algorithm is the process, the coding is the implementation, which is specific to our programming
language, environment, and how the rest of our app works. Algorithm are made to solve the problem
and it not necessary to write an algorithm for every task like to print “THIS IS MY FIRST
PROGRAM” where algorithm is not needed but to solve problem code should work as an algorithm
because it is practical implementation of algorithms that describe as set of instruction for a computer
deliver through the use of specific programming languages. Coding is the implementation of that
algorithm in a particular language. Hence this is the relation between the algorithm and code.

Suitability of language:
I have been playing with .NET Core for six months now and have been very impressed with it. C#
language is the most powerful programming language for the .NET Framework and easy to learn.
And it is also one of the top five programming language among the world. The best thing about C# is
wide versatility of it that can be used for a wide variety of types of applications. Its protection cost is
much less and is much secure to run in comparison to other language. It is pretty easy to pick up and
work in productively with a working knowledge of languages like C, C++, Java due to the fact its
core syntax is much like C-style languages. I am not so much familiar with other programming
language than C#. So, even it has some limitation I find C# programming language is suitable.

Limitation of language:
Although C# is suitable it has some disadvantage. They are:

• C and C++ runs very much faster than C# because the compilation of codes goes two way,
from C# code to IL (intermediate language) then from IL to machine code.
• C# is less flexible than C++. C# depends on .NET framework, anything that is not found in

Name (HND / First Semester) 22


Programming 2020

the .NET framework will be difficult to implement.

Conclusion:
Hence, this report describes about the algorithm along with their advantages, features, disadvantages,
uses and example. Also, this report tells about the important software, outline process, suitable
language, data dictionary, architecture design along with algorithm and flowchart of the project we
developed i.e. inventory management system. And this document shows that code variant and
algorithm are interrelated to each other.

Presentation on mini research project

Name (HND / First Semester) 23


Programming 2020

Name (HND / First Semester) 24


Programming 2020

Name (HND / First Semester) 25


Programming 2020

Name (HND / First Semester) 26


Programming 2020

Name (HND / First Semester) 27


Programming 2020

Conclusion:
Hence, I have produced a report that describes about the algorithm along with their advantages,
features, disadvantages, uses and example. Also, this report tells about the important software,
outline process, suitable language, data dictionary, architecture design along with algorithm and
flowchart of the project we developed i.e. inventory management system. And this document shows
that code variant and algorithm are interrelated to each other. I have also presented a mini project
presentation on application development process that include algorithm, flowchart,
encryption/decryption, compression/decompression and outline process of software development.

Name (HND / First Semester) 28


Programming 2020

Part 2
The research and development team you work with have been tasked with further
investigation into how best to build more efficient, secure software. You have been asked to
look into programming paradigms and the advantages and disadvantages of using different
programming language approaches.

You will need to create a report covering findings from research into the characteristics of
different programming paradigms – procedural, object-orientated and event-driven
programming.

Your report should include an explanation of each paradigm, an analysis of suitable IDEs,
and an evaluation of source code that would be generated for an application.

In this part, I am going to produce a report explaining about procedural, object oriented and event
driven paradigms along with some characteristics and the relationship between them. Here in this
report I will provide all the required details about of process of outline to be function while using or
building application. I will analyze the common features that a developer has access to in an IDE.
Furthermore, I will critically evaluate the source code of an application which implements the
programming paradigms, in terms of code structure and characteristics.

Name (HND / First Semester) 29


Programming 2020

Report on different programming paradigms – procedural, object-orientated and event-driven


programming with explanation of each paradigm, an analysis of suitable IDEs, and an
evaluation of source code that would be generated for an application.

Report:

Report on different programming paradigms – procedural, object-orientated and event-driven


programming with explanation of each paradigm, an analysis of suitable IDEs, and an
evaluation of source code that would be generated for an application.

Student Name

19th April 2019

Name (HND / First Semester) 30


Programming 2020

Contents:
1. Procedural programming language
2. Basic I/O
3. Control Structure
4. Conditional structure
5. Structure and Union
6. File handling
7. Pointer
8. Array
9. Function
10. Object oriented programming
11. Class and Object
12. Data encapsulation
13. Inheritance and its type
14. Polymorphism
15. Abstraction
16. Delegates
17. Event driven programming
18. Relation between OOP, PPL and Event driven programming languages
19. Example of OOP, PPL and Event driven programming languages
20. .NET database connectivity
21. Evaluation of source code of application
22. Conclusion

Name (HND / First Semester) 31


Programming 2020

Introduction:
Programming paradigm is a method to solve problem using some programming language.
Programming paradigms are a way to categorize programming languages based on their features.
Languages can be classified into multiple paradigms.

Procedural programming language (PPL):


A program in a procedural language is a list or set of instructions where each statement tells the
computer what to do step by step and how to perform from the first code to the second code.
Procedural programming languages are also known as third generation languages. In these
programming languages, program is a predefined set of instructions. Computer executes those
instructions in the same sequence in which the instructions are written. Each instruction tells the
computer what to do and how to do. Each procedure contains a series of instructions to perform a
specific task. The major emphasis of these language is on the procedures and not on the data. PPL
allow the data to move freely around the system. Top down program design approach is used by
procedural programming languages. It includes Cobol, Go, Fortran, Pascal, BASIC, C and so on.

Characteristics and Features of PPL:


1. Importance is an algorithm (method).
2. Focus on the procedures and not on the data.
3. Global data is often shared by all functions.
4. Data moves freely around the system from function to function.
5. The whole program is implemented based on actions such as reading, calculating and printing
so top down program design approach is used.
6. Main function is divided into smaller component is known as function and each function has
clearly defined purpose.

Limitations of PPL are:


1. In PPL, global data can be accessed and changed by any procedure. So, there is no data
security. In case if we want to chance type of data of global data then we also need to revise
all functions that access the data. Due to this it may happened that some errors will occurs.
2. PPL does not model real word problems very well. Because functions are action oriented
and don’t corresponding to the elements of the real problems.
3. It is difficult to create new data types. The ability to create the new data type of its own is
called extensibility. Structured programming languages are not extensible.

Name (HND / First Semester) 32


Programming 2020

Basic I/O:
I/O stands for Input and Output in the system. Input is the user giving something to the program,
and output is the program giving something to the user. In programming, the most basic form of
input/output (I/O) is displaying some text to a user and allowing the user to enter some text back. For
example, let's say we wanted to write a simple calculating program where the user inputs two
number 3 and 5, and the system outputs the sum of those two number i.e. 8. In C programming, the
most basic function to output text to the screen is printf() and take user input typed on the keyboard
is scanf(). So, let's write a program in C that simply displays our sum of two number. We will use the
printf() function.

Conditional Structure:
Condition are those in which we can choose either this or another. Conditional statements help you
to make decision based on certain conditions. In programming there will also be condition like
during login account where if username and password given by users match to database, the user is
successfully logged else user is not logged in and permission is denied. These conditions are
specified by a set of conditional statements having Boolean expressions which are evaluated to a
Boolean value true or false. There are following types of conditional statements in C.

1. If statement
2. If-Else statement
3. If-Else-If statement
4. Switch

Name (HND / First Semester) 33


Programming 2020

If-statement:

The “if” statement is used to execute a statement or a block of statement if the given condition is
true. If test expression is evaluated to true, statements inside the body of If will be executed and if
test expression is false than statements inside the body of If will be skipped. It is commonly used in
the scenario where we need to perform the different operations for different conditions. The syntax
of the if statement is given below:

Flowchart of if statement:

Let's see a simple example of C language if statement:

Here, I have written a program to find a number weather it is greater than 10 or not by using if
statement. There is condition a>10 so if the user inputs value of a is greater than 10, “a is greater”
will print.

Name (HND / First Semester) 34


Programming 2020

Output of the example:

I enter value of a is 11. Because it is greater than 10, program execute and print “11 is greater”.

If-Else statement:

The basic “if” statement can be extended by adding an “else” statement. This provides a second
choice of statement to be executed if the condition is false. If test expression is evaluated to true,
statements inside the body of If will be executed else statements inside the body of If will be skipped
and statements inside the body of else will be executed. The if-else statement is used to perform two
operations for a single condition. Here, the main point is that if and else block cannot be executed
simultaneously. Its general form is:

Name (HND / First Semester) 35


Programming 2020

Flowchart of if-else statement:

Let's see a simple example of C language if-else statement:

Here, I have written a program to find a number weather it is odd or even by using if-else statement.
If the user inputs number is divisible by 2 i.e. reminders come 0 when it is divided by 2, “enter
number is even” will be print. And if input number is not divisible by 2 than else code will be
execute and “enter number is odd” will be print.

Name (HND / First Semester) 36


Programming 2020

Output of the example:

When I enter 8, first it checks the condition weather it is true or false. As well all know 8 is divisible
by 2, condition become true than if code execute and print “8 is an even”.

If Else-If ladder statement:

The If-Else If ladder statement allows us to create a chain of else-if statements. It is used in the
scenario where there are multiple cases to be performed for different conditions. In If Else-If ladder
statement, if a condition is true then the statements defined in the if block will be executed, otherwise
if some other condition is true then the statements defined in the else-if block will be executed, at the
last if none of the condition is true then the statements of else block will be executed. There are many
else-if blocks possible. It is similar to the switch case statement where the default is executed instead
of else block if none of the cases is matched. The syntax of the if else-if ladder statement is given
below:

Name (HND / First Semester) 37


Programming 2020

Flowchart of If Else-If ladder statement:

Let's see a simple example of C language If Else-If ladder statement:

I have written a program to find the grade based on obtained marks in subjects by using If Else-If
ladder statement. If the user inputs mark is greater than 80 it will print “grade a”. Similarly, if mark
is greater than 70 and above 80 it will print “grade b” and this process will continue until get match
with any if or else if condition likewise in code. When it gets match it will print the statements
related to the condition and if it doesn’t get match with any condition than it will execute else
statement and print “invalid marks”.

Name (HND / First Semester) 38


Programming 2020

Output of the example:

As I already said above, when I enter 72 number as obtained mark it shows me “grade b”.

Switch:

A switch statement is used to select from multiple choices based on a condition or expression. The
expression must produce a result of type char int. Otherwise the statement will nit compile. It is an
alternate to if-else-if ladder statement which allows us to execute multiple operations for the different
possible value of a single values. The break statement is necessary to come out of the switch
statement after executing particular case. The default case is option and is executed when the
expression doesn’t evaluate to any of the case. The syntax of the if else-if ladder statement is given
below:

Name (HND / First Semester) 39


Programming 2020

Flowchart of switch:

Let's see a simple example of C language Switch:

I have written a program to add, subtract and divide two number using switch. After you enter two
numbers, it will ask you for operator and when you give operator if operator gets match with any of
those cases it will execute related statement otherwise it will execute default and print “wrong input”.

Name (HND / First Semester) 40


Programming 2020

Output of the example:

I enter 6 and 8 number and I choose subtract operator. So, that it prints “-2” as a result. If I give any
others operator except those which I include in program, it will print “wrong input”.

Control Structure:
‘Control Instructions’ enable us to specify the order in which the various instructions in a program
are to be executed by the computer. In programming, “control structures” are the structures used to
alter the flow of execution of the program based on the given parameters. To make decision we need
to alter the program flow. In a program, we use control structures to make decisions and alter the
direction of program flow in one or the other path or paths available. Looping is the one of the useful
control structures.

Loops: A loop is used to execute a statement or block of statement repeatedly. The number of times
the statement or blocks of statements is executed and controlled by a condition and the loop executes
until that condition is satisfied. There are four loop statements:

1. For loop
2. While loop
3. Do…while loop
4. Nested loop

For Loop:

A for loop has 3 parts separated by semicolons (;). The first part, initialization, is executed before the
execution of loop starts. This is used to initialize a counter for the number of loop iterations.
Execution of the loop statements continuous as long as the condition, in second part is true. This
condition is checked at the beginning of each loop iteration. The altering expression is for increment

Name (HND / First Semester) 41


Programming 2020

or decrement the loop counter. This is executed at the end of each loop, iteration.

Syntax:

Flowchart of For loop:

Example of For Loop:

Name (HND / First Semester) 42


Programming 2020

Output of the example:

While Loop:

While loop is an entry-controlled loop. In an entry-controlled loop, conditional expression is


evaluated first. If the conditional expression evaluates to true, then the block of statements enclosed
in the loop are executed. After execution of these statements, the conditional expression is again
evaluated. If the result of evaluation is true, then the loop statements are executed once again. This
process continues until the expression is evaluated to false. When the conditional expression is
evaluated to false, the flow of control is passed to the statement immediately after the while loop.

Syntax:

Name (HND / First Semester) 43


Programming 2020

Flowchart of While loop:

Example of While Loop:

Output of the example:

Name (HND / First Semester) 44


Programming 2020

Do…While Loop:

The do-while loop is called as an exit-control loop. In an exit-control loop, the statement or block of
statements are executed first. Then, the conditional expression is evaluated. If it is true, then the
block of statements is executed once again. This process continues as long as the conditional
expression is evaluated to true. When the conditional expression is evaluated to false, the control is
passed to the statement immediately after the while loop. The body of a do while loop is executed at
least once, because the program floe has to pass through the body of the loop before reaching the
conditional expression.

Syntax:

Flowchart of do...while loop:

Name (HND / First Semester) 45


Programming 2020

Example of do…while loop:

Output of the example:

Name (HND / First Semester) 46


Programming 2020

Nested Loops:

The loop which contains a loop inside another loop is known as the nested loop. When we " nest "
two loops, the outer loop takes control of the number of complete repetitions of the inner loop. It can
contain the for loop inside a for loop or a while loop inside a while loop. It is also possible that a
while loop can contain the for loop and vice-versa. The most commonly nested loops are For Loops.

Syntax of nested for loop:

Flowchart of nested for loop:

Name (HND / First Semester) 47


Programming 2020

Example of the nested for loop:

Output:

Structure:
Structure is one of the user defined data type in C/C++ that allows to combine data items of different
kinds. It is used to represent a record. ‘struct’ keyword is used to create a structure. It contains
several named variables inside. Example: you want to store information about person: his/her name,
age and salary. You can create different variables name, age, salary to store this information
separately. if you need to store information of more than one person than you need to create different
variables for each information per person.

Syntax:

Name (HND / First Semester) 48


Programming 2020

Example of Structure:

Output of the example:

Union:
A union is a special data type that allows to store different data types in the same memory location.
To define a union, we must use the ‘union’ statement in the same way as we did while defining a
structure. We can define a union with many members, but only one member can contain a value at a
time. It is an efficient way of using the same memory location for multiple-purpose.

Syntax:

Name (HND / First Semester) 49


Programming 2020

Example of Union:

Output of the example:

File Handling:
A file is a storage area on the disk where a group of related data is stored, and that data is referenced
by a common name which is called as file-name. This process is called file handling. Data of file is
stored in secondary storage like hard disk, floppy disk etc. each file must have a unique name. the
data stored in a file is stored permanently and is non-volatile in nature. The four basic operations that
can be performed on a file are read, write, open and close.

File Operation Syntax


fopen() – to open file Syntax:
*fp=fopen(“filename”, “mode”);

fclose() – to close file Syntax:


int fclose(Filepointer);

Name (HND / First Semester) 50


Programming 2020

fgets() – to read a file Syntax:


char *fgets(char *string, int n, FILE *fp);

fputs() – to write into a file Syntax:


int fputs(FILE *fp, const char *format, …);

Example of file Handling (open, read, write and close):

Output of the example:

Name (HND / First Semester) 51


Programming 2020

Pointer:
Pointers is a variable that stores/holds the memory address of another variable. A Pointer is used to
allocate memory dynamically i.e. at run time.

General syntax:

The pointer variable might be belonging to any data type such as int, float, char, double and so on.
Here are some few examples:

The process of assigning address of a variable to a pointer variable is called Pointer Initialization.
Pointer variable can only store address of a variable of the same data type. In C language ‘&’
operator is used to determine the address of variable.

Example of pointer:

Name (HND / First Semester) 52


Programming 2020

Output of the example:

Function:
A function is a block of code that performs a specific task. During programming there are might
occur many situations where we might need to write same line of code for more than one. This may
lead to unnecessary repetition of code and becomes boring for the programmer. So, we can declare
and define a group of statements once in the form of a function and it can be called and used
whenever required. It is user defined functions. Types of function:

Return Function: A return function is a function which returns some value after the implementation
of the function. The return function is used when we pass user defined function.

Syntax:

Example of Return Function:

Name (HND / First Semester) 53


Programming 2020

Output of the example:

Void Function: A void function are created and used just like return function except it doesn’t
returns any value after the implementation of the function. Instead of a data type, void functions use
the key ‘void’. It performs a task, and then control returns back to the caller but, it doesn’t return a
value.

Syntax:

Example of Void Function:

Name (HND / First Semester) 54


Programming 2020

Output of the example:

Array:
An array is a collection of elements of similar data type referenced by a common variable name.
Example: we can define an array named ‘marks’ to represent the individual subject marks of a
student.

Declaration an array: we can declare an array by specifying its data-type, name and number of
elements that it can hold.

Syntax:

Types of array:

Single Dimensional Array: A single-dimensional array is the easiest form of an array that requires
only one subscript to access an array element.

Syntax:

Name (HND / First Semester) 55


Programming 2020

Example of Single Dimensional Array:

Output of the example:

Multi-Dimensional Array: A multi-dimensional array has more than one dimension. It is an array
of arrays, an array that has multiple levels. The simplest multi-dimensional array is two-dimensional
array. Two-dimensional array is also called a matrix, or a table of rows and columns.

Syntax:

Name (HND / First Semester) 56


Programming 2020

Example of Multi-Dimensional Array:

Output of an example:

Name (HND / First Semester) 57


Programming 2020

Object Oriented Programming:


“Object Oriented Programming (OOP) refers to a type of programming (software design) in which
programmers define not only the data type of a data structure, but also the type of operations
(functions) that can be applied to the data structure” (webopedia, n.d.). It is a new programming
language model organized around objects rather than action and methods rather than logic. OOP was
introduced to overcome flaws in the procedural approach to programming such as reusability and
maintainability. Before the concept of OOP, Program is simply a logical procedure which takes input
as a data, process it and gives us a finite result as an output. OOP is a new concept where programs
are based on the objects and methods. The first OOP language as Simula. Java, Python, C++,
VisualBasic.NET, Ruby are the most popular OOP based languages.

Characteristics and Features of OOP:


Some of the key features and characteristics of OOP are, programs are divided into entities called
objects. Data can’t be accessed by external function because data are hidden. It is easy to add new
data and function whenever necessary. Function which is based on the data of the objects which ties
together in data structure. Sending and receiving information among objects through function
parameters. And It follows button-up approach of design.

Limitation of OOP:
Some of the limitation of object-oriented programming are, solving a problem using OOP approach
takes more time than the time taken by structured programming approach. It requires intensive
testing procedures. Without proper design and planning, it is difficult to apply. It is inefficient and
can cause duplication.

Class and Object:


A class is the collection of variables and functions under a single name. Class is a user defined data
type, once if we defined the class then we can use as a data type like int, float etc. Data is
encapsulated in a class by placing variables inside the body of the class definition. Function can be
also declared inside the class. A class is defined by the use of ‘class’ keyword.

Syntax:

Name (HND / First Semester) 58


Programming 2020

Object is a variable of class type. It is an instance of a class. Any number of objects can be created
from a single class. When program is executed, objects communicate by sending message to one
another without knowing details of each other data or code.

Syntax:

Example of Class and object:

Output of the example:

Data Encapsulation:
Encapsulation is an OOP concept, which packs the data and the code that manipulates the data into a
single unit. It keeps the data safe from outside access and misuse. The implementation details of a
class are kept hidden from user so it is also known as data hiding. Only user can perform a restricted
set of operations on hidden class members by executing special functions called methods. In C++,
the basic of encapsulation is a “class”. Encapsulation will not have any syntax.

Name (HND / First Semester) 59


Programming 2020

Example of Data Encapsulation:

Output of the example:

Inheritance and its type:


The ability of a class to derive characteristics and properties from existing classes is called
inheritance. Inheritance is the concept by which new class created from existing classes. The new
class is called as the derived class and the existing classes as the base class. The derived class can
inherit some or all the properties of the base class.

Syntax:

Name (HND / First Semester) 60


Programming 2020

Types of Inheritance:

1. Single inheritance: A derived class with only one base class is called as single inheritance.
The derived class will have all the properties of base class along with its own members.

Class A is called base class whereas Class B is derived class.

Syntax:

2. Multilevel inheritance: Deriving a class from a derived class is called as multilevel


inheritance.

Syntax:

Name (HND / First Semester) 61


Programming 2020

3. Multiple inheritance: A class can inherit the properties of two or more classes. This is called
multiple inheritance. The derived class then contains all properties of base classes and its own
members.

The syntax of derived class with multiple base classes is:

4. Hybrid inheritance: When more than one type of heritance is applied or used, then it is
called as hybrid inheritance.

Name (HND / First Semester) 62


Programming 2020

Syntax:

5. Multipath inheritance: Class derived from two classes and those two base classes have one
common base class is called multipath inheritance.

Syntax:

Name (HND / First Semester) 63


Programming 2020

6. Heirarchical inheritance: when multiple classes derived with same base class is called
Heirarchical inheritance.

Syntax:

Example of inheritance:

Name (HND / First Semester) 64


Programming 2020

Output of the example:

Polymorphism:
Polymorphism is a Greek word which means “taking many forms”. It means different objects
respond differently to the same message. It is the ability of a message to be displayed in more than
one form. Example: A man at a same time can have different behavior. Same as a man at a same time
is a father, a husband, an employee. So, same man has different behavior in different conditions. This
is known as polymorphism. In C++, this is implemented in two ways. They are:

1. Static (compile time) polymorphism: A polymorphism which occurs at compile time is


called static polymorphism. In static polymorphism the complier know which method is
going to call at compile time. It can be achieved by using method overloading. Method
overloading means same method name with different signature. It can be done in same class
or parent child class.
Example of static polymorphism:

Name (HND / First Semester) 65


Programming 2020

Output of the example:

2. Dynamic (run time) polymorphism: A polymorphism which occurs at run time is called
static polymorphism. In dynamic polymorphism the complier known which method is going
to call at run time. It can be achieved by using method overriding. Method overriding means
creating same method with same signature in parent and child class. It can be done in parent
and child class.
Example of dynamic polymorphism:

Output of the example:

Name (HND / First Semester) 66


Programming 2020

Data Abstraction:
Data abstraction is the key feature in the OOP that refers to the act of hiding implementation details
while just presenting the essential information to the outside world. It reduces code complexity. It
hides unnecessary details and expose the essential parts to the user. By hiding unnecessary details, it
helps to reduce complexity and effort. Example: database system hides the details of how is stored,
created and maintained.

Example of abstraction:

Output of the example:

Name (HND / First Semester) 67


Programming 2020

Delegates:
A delegate is an object-oriented, managed, secure and kind-safe feature pointer inside the .net
framework. A delegate signature consists of its name, return type and arguments passed to it. Instead
of passing method, a delegate passes a method to some other method. Delegates are used in lots of
contexts, along with implementing callbacks and occasion handlers, access thread factors and
multiple kinds of approach specifications. Due to the fact a delegate does not recognize the class of a
referenced object, it is used for anonymous invocation. The problem with events is how objects talk
with each other and recognize what information is being sent during event occurs, delegates come
into play here. A delegate defines a unique function pointer template or blueprint that both the sender
and receiver use to speak on the same level.

Event Driven Programming Language:


Event-driven programming is a computer programming paradigm in which the flow of the program
is determined by the occurrence of events. Such as user actions (key press, mouse clicks), sensor
outputs from other programs are monitored by the code written in the source know as event listener
that detects weather the event has occurred or not. Event-driven programming language is the
dominant paradigm used in graphical user interfaces (GUI) and other applications like java script that
are centered around performing certain actions in response to user input. In an event-driven
application, there is generally a main loop that listens for events, and then triggers by handler which
is a callback function when one of those events is detected. Event-driven programs can be written in
any programming language but they may different in the way of implement it, although the task is
easier in languages that provide high-level abstractions, such as closures.

Characteristics and Features of Event Driven Programming languages:


Some of the key features and characteristics of event-driven programming are:

Service Oriented

It is one of the key features of the event driven programming that used to write programs which slow
down the computer as a service oriented by consuming little of the computer processing power and
run in the background of OS.

Name (HND / First Semester) 68


Programming 2020

Time Driven

In event driven programming, time driven is a code that run in the time trigger. It can be specific
code that runs on a specific time. The example of event-driven programming language is windows
update, which user can set when to update or when to check and download the update.

Event Handlers

When user click button, it will display a message, and it will close the message when user click the
button again, this is an event handler. In event driven programming, event handler is a function or
method that run a specific action when a specific event is triggered.

Trigger Functions

Triggers functions is an important features of an event-driven programming functions that decide


which code to run when specific event occurs and which event handlers to select.

Events

Events such as mouse, keyboard and user interface, that needs to be triggered in the program in order
to happen, so that user interacts with an object in the program, for example, click a button by a
mouse, press key by a keyboard etc.

Simplicity of programming and Ease of Development

Event-driven programming is simple and easier because it is very visual, for example you can place a
button by just select it and place it onto a form and write a code for it. User can insert a code scripts
into an existing application by pausing the code while it’s running that make developing using event-
driven programming is easy. So, it is simple and easier program compared to other type of
programming.

Limitations:

Limitations od the event-driven programming languages are: it is only useful in GUI programming.
Classes are often hard to implement in other applications. It is complex to master. It is often not
portable to another Operating System. In the case of the .NET framework under windows that uses
event driven programming.

Name (HND / First Semester) 69


Programming 2020

Relationship between Procedural, Object Oriented and Event Driven programming:


Differences:

Procedural programming Object Oriented Programming Event driven programming


It provides character user It provides command writing in It provides graphical user
interface to code the modules. interface to create programs.
commands.
It focuses on sequential It focuses on data and it facilitate It focuses on selecting user
execution of steps. secure data or object from interface.
unauthorized access.
Commands are written and Objects and functions are Actions like mouse clicking
executed in liner fashion. prepared to perform task. and moving, pressing keys are
defined on events.
Common languages which Common languages which are Common languages to follow
follow this paradigm are used by this paradigm are C++, this paradigm are Visual Basic
Basic, Fortran and COBOL. JAVA and Smalltalk. and C#.

Similarities:

• Procedural, Object Oriented and Event Driven programming paradigms are used complete
task and solve problems.
• All of them are programming languages.
• They have controllers to manage the overflow of control of program.

Name (HND / First Semester) 70


Programming 2020

Example of a simple program using procedural programming language:


In a procedural programming language, when we need to carry out a task, especially one that might
be carried out multiple times, we pass the control to a function, which does a specific set of actions,
and then returns a value.

In the above program we have got two variables, firstnum and secondnum. Each gets declared and
assigned a numeric value. Another variable called sum is also declared. Then sum is assigned that
result of the add() function. The control flow jumps to the add() function down below, where the two
number are added, and then the result is returned, and the program picks up where it left off, printing
out the result and then terminating.

Example of object-oriented programming language:


An OOP needs something to model, or else it looks a lot like a PPL. The bulk of the code is taken up
with defining the model of the Dog() class. All the action in this example goes on in the main()
method, where a cat object named Sher is created. The cat’s Bark() function is used, and then the
GetAge() function is used to access a data member. If you follow the control flow of this code,
you’re constantly jumping back and forth between the instructions in main() and the functions in the
class definition, which then access data that’s defined somewhere else.

Name (HND / First Semester) 71


Programming 2020

Example of Event driven programming language:


This program is performed in visual studio. For this program, firstly I have created form using
different tools. This program was developed to find the total and percentage of five subjects. If we
click on the Find Total and Percentage button in the output, then total and percentage is calculated
automatically. As I entered the marks in five subjects and clicked on Find Total and Percentage
button, total and percentage is shown.

Name (HND / First Semester) 72


Programming 2020

Name (HND / First Semester) 73


Programming 2020

IDE (Integrated Development Environment):


IDE stands for Integrated Development Environment which is an application that is used by a
programmer to create a computer program and applications. An IDE consists of build automation
tools, a debugger and source code editor. An example of an IDE product is Microsoft’s Visual Studio
.NET. This software uses Microsoft software development platforms such as Windows form,
Windows API, Windows Store and so on. We can simply say that IDE is a software that is used for
software development. Some of the example of IDE are: Visual Studio, NetBeans, XCode, Eclipse
etc. Among them, I have developed the application with the help of Visual Studio. The environment
provided by Visual studio is really awesome as there is lots of features and tools to build an
application.

Benefits of Using IDE:


An IDE can improve the productivity and efficiency of software developers to fast setup and
standardization across tools with less efforts. Without an IDE, developers spend time deciding what
tools to use for given tasks, how to use and configure them. All the important and necessary tools are
included in integrated development environment. IDEs are also designed with all their tools under
one user interface (UI). An IDE can organize the necessary features to standardize software
development in the UI.

Tools available in IDE:


There are different tools and functions that assist a developer in the creation of software.

• Code Editor
The shell is the environment where programmer write code. Sometimes code goes wrong
while developing a software. So, there comes code editor role play. Code editor is a text edit
area where programmers write, edit and save a document of code. It is the best tools of IDE
which help programmer or developer to correct the code. Programmers can execute the code
one step at a time which helps to test the code line by line before creating the final
completion program. It has features that assist with the writing and edition of code that
includes:
✓ Auto-completion:
While you start to write the first part of the function, it suggests or completes the
function and any arguments or variables. These features designed save time while
writing code.

Name (HND / First Semester) 74


Programming 2020

✓ Bracket matching:
This feature helps to detect missing brackets if you forget to close a bracket while
coding. It is used for languages that need pairs of brackets to mark out blocks of code.
It helps to read and understand code faster.
✓ Syntax checks:
This feature helps to correct the code by recognizing incorrect syntax. It highlights
errors or bugs if present.
• Compiling
This is another tool of IDE that reads a program which is written in high level language and
translate it into an equivalent program in binary language. Commonly, programmer writes
program in a programming language like java, pascal, python, C, C++, C# and so on. It helps
in conversation with machine and human by translating high level language to machine
language. In this process, if errors are present it will detect and report the presence of errors
in the sources program. Depending on how big the program is it takes a time to compile and
if no errors are present in program an executable file will create.
• Debugging
This is a tool of IDE that is used to detect errors in program. It may suggest the type of error
and which line it is on if debugger find errors so finding bugs is easy using this feature.
Breakpoints is a debugging tool. It helps to debug the program easily. Debugging is done
when the program fails to work. Some of the steps for debugging are:
1. Replicating of the bugs
2. Understanding the bug
3. Locating the bug
4. Finding the root cause
5. Fixing the bug and restarting the program
• Auto Documentation
This tool describes the structural function and purpose of the code by observing the modules
and variables and its expected behavior are collects into a text file that can be used by the
other programmers or developers to understand why and how the code was created.
• Libraries
Libraries provide functions that can be imported and used at the start of the program. Those
function are not including in the core part of the programming language. Example: turtle
graphics library is a function that provides access to graphics tools in python.

Name (HND / First Semester) 75


Programming 2020

• Automation tool
This tool is useful when a program has many thousands of lines of code. It includes testing or
compiling code. The purpose of automation is to minimize bad software, increase the quality
of the software and save time and money. These tools automatically do the process that that
might in any other case be executed by means of hand.

.NET Database Connectivity (ADODB)


Database connectivity is an interface communication medium between database and application or
web through which various applications or functionalities of web manage can be done. .NET
application can connect data in a SQL Server. Connection string or object is required for connection
to a database. This String contains information about server that you are going to connect, database
you will require and the credentials that you can use to connect. The SqlConnection is an object that
takes Connecting Sting as argument and pass the value. SQL Command may be executed with the
help of Connection object when connection is established. Every database has their own server,
name, properties and type of login information which helps you to connect to database to read stored
data from database. Connection should be closed, when the database activities over.

Functionalities:

Important functionalities of database connectivity are: it helps in database binding, session


mechanism and basic operation of SQL. It accesses data that is stored in database. It helps to solve
problems of user registration form.

Steps for connectivity between C#.Net and database

At first, we have to import mysql connector file. The step to import that file into the visual studio file
is given below:

Name (HND / First Semester) 76


Programming 2020

Step1: First download MySQL connector zip file. Step2: Then, open Microsoft Visual Studio.
You can see MySQL.data.dll file name inside the
zip file.

Step3: Go to file, click on new menu Step4: Make any form or click on console
application. Then, put name of the project.

Step5: There you can see the solution explorer menu Step6: Right click on the reference. Then, add
at the right-hand side. reference.

Name (HND / First Semester) 77


Programming 2020

Step7: Open the folder where you have saved the Step8: Add MySQL.data.dll in the reference. Then,
MySQL connection file. browse and press ok.

Step9: You can see the reference in the visual studio. Step10: After that Create a DBConnect class.

After importing that file, we need to keep code to create a connection to a database. Let’s look at an
example, we will connect to a database which has name of inventory_management_system.
Username and password that are used to connect to database is given below:

• Username: inventory_management_system
• Password: programming

Here I have designed a simple windows forms application where “Connect” button is used to connect
to the database.

Name (HND / First Semester) 78


Programming 2020

Step – 1. First step is to create a new project in Visual Studio. After opening Visual Studio, you
need to click menu option New->Project.

Step – 2. The next step is to choose the project type as a Windows Forms Application. We also need
to set name and location of our project.

Name (HND / First Semester) 79


Programming 2020

Step – 3. After creating a new project, import that mysql connector dll file to this new project file.
And then from toolbox add a button to the Windows Form. Put the text name of the button as
Connect. This is how it will look like

Step – 4. Now it’s time to write code to connect to database. In this step, double click on the form to
add event handler to the code for the button click event. Again, double click on button Connect and
add the below code.

Name (HND / First Semester) 80


Programming 2020

Code Explanation:

The first step variable declaration. It will be used to create the connection sting and the connection to
the SQL Server database.

The next step is to set or create the connection string that needs to be specified clearly for C# to
understand the connection sting. It contains three important parts: first one is Server or Data Source
which is the name of the server on which the database resides. In our case, localhost is the name of
server. Second part is database name which you are going to connect. And third part is User ID and
Password that are required to connect to the database. in our case, User ID is root and Password is
programming.

The third step is to assign the connecting string to the variable cnn. SqlConnection object contain
connecting string to the variable cnn that is used to established connection to the database.

After that, we use open method of the cnn variable to open connection to the database and display a
message to the user that the connection is established. When the operation complete successfully
then we close the connection to the database.

When the above code is executed in Visual Studio, click on connect button once the form displayed.
And then you can see that database connection was established. Hence, the message box was
displayed.

Name (HND / First Semester) 81


Programming 2020

Output:

Evaluation of source code of application


Writing code, finding error and debugging the code is really though work, therefore developing an
application is not so easy. After designing all pages, I started working with code and there are lots of
bug or error in my code. I have used breakpoint to solve the error and the source code was hardest
part among all so that it consumed a lot of time to build the application.

Object-oriented programming paradigm:

I have used concept of object-oriented programming language to build source code because it is
based on the objects rather than action and methods rather than logic. Object-oriented programming
is structured into class and objects and through the objects class can be called easily so the
reusability and maintainability of the code can be done. It is easy to add new data and function
whenever necessary and adding new tools is also easy comparing to the procedural programming. It
facilitates secure data or object from unauthorized access. As you can see in the example, I have
created a public class DBConnect. Class is created to set connection between database and form.

Name (HND / First Semester) 82


Programming 2020

Event driven programming paradigm:

I have used Event Driven Programming paradigm based on UI programming to design user friendly
pages. Events such as click, hover effect, mouse click, key pressed etc. and its other tools are used in
my application to satisfy the company. It is a computer programming paradigm in which the flow of
the program is determined by the occurrence of events. Such as user actions (key press, mouse
clicks), sensor outputs from other programs are monitored by the code written in the source know as
event listener that detects weather the event has occurred or not. It is the dominant paradigm used in
graphical user interfaces (GUI) and other applications like java script that are centered around
performing certain actions in response to user input. In event driven programming all the events are
given job to do and the events are directed as per the source code and all the events action performed
are defined in the source.

Name (HND / First Semester) 83


Programming 2020

To design above UI, I have used different tools like label, panel, textbox, button, datagridview, color
effect, combobox, datetimechecker etc. available in Visual studio.

Positive aspect of the source code:

Object oriented and event driven programming paradigm are the language that source code based on.
The main positive aspects of using this programming paradigm is that source code follows the rule of
these language. Some of the positive aspect are as follow:

The data can be secure because I have hidden unnecessary part of the code and encrypted data like
password. I have used comment that tells function of the code which can easily understand by other
programmers and developers. It is better than procedural programming because modifying the code
was easy to add new features. Database connection class was made which can call any time
whenever need.

Negative aspect of the source code:

Source code is slower then procedural programming. OOP is based on Procedural programming
language. So, it is necessary to learn PPL to understand OOP. Source code is vast and larger than
PPL.

Name (HND / First Semester) 84


Programming 2020

Conclusion:
Hence, this report describes about the paradigms- procedural oriented, object oriented and event-
driven programming along with their advantages, limitations and features. I have also talked about
the conditional statement, loop, class and object and other example of different paradigms. This
report also explained about the IDE and the IDE I have used for the development of application. I
have mentioned the step that I have used to connect database and C#.NET in this report.

Name (HND / First Semester) 85


Programming 2020

Part 3
The submission is in the form of five documents/files:

1. Stage 1 – Development Document

2. Stage 2 – Report (IDE Evaluation)

3. Stage 3 – Report (Debugging Evaluation)

4. Stage 4 – Report (Evaluation Report) including fully commented source code

5. An installable and executable version of your application Debugging

Development Document
In the process of developing Inventory Management System application, first things that I have done
is collecting the data from various sources. After that I analyzed the collected data. Based on the
collected data I prepared data dictionary. Then I created database inventory management system and
tables in MySQL as per user’s requirement. Then I used Visual Studio to design different pages like
login page, dashboard etc. which are needed for application. Finally, I have typed the source code for
each page.

In the design of the application form, I have used different tools that are in Visual Studio like panel,
button, label, data grid table, text box, date time etc. in the different form pages of application I
made. The application was developed to keep the records that we enter in the form. The records of
sales, suppliers, customers, staffs, purchase, etc. are kept by the help of inventory management
system. We can insert, update, save, create and delete the records as per our needs. And the
application made is very much reliable, efficient, attractive and it works perfectly.

Screenshots of design and code view of different form pages of the Inventory Management
System:

Name (HND / First Semester) 86


Programming 2020

Design and code view login page:

Name (HND / First Semester) 87


Programming 2020

Design and code view of Home page:

Name (HND / First Semester) 88


Programming 2020

Design and code view of staffs:

Name (HND / First Semester) 89


Programming 2020

Design and code view of customers:

Name (HND / First Semester) 90


Programming 2020

Design and code view of products:

Name (HND / First Semester) 91


Programming 2020

Design and code view of Suppliers:

Name (HND / First Semester) 92


Programming 2020

Design and code view of purchases:

Name (HND / First Semester) 93


Programming 2020

Design and code view of sales:

Name (HND / First Semester) 94


Programming 2020

Design and code view of Purchase Report:

Name (HND / First Semester) 95


Programming 2020

Design and code view of Sales Report:

Name (HND / First Semester) 96


Programming 2020

Design and code view of Stock Report:

Name (HND / First Semester) 97


Programming 2020

Design and code view of Customer Diary:

Name (HND / First Semester) 98


Programming 2020

Design and code view of Supplier Diary:

Name (HND / First Semester) 99


Programming 2020

Report on IDE Evaluation.


Report:

Evaluation Report on IDE to Manage development process

Student Name

15th April 2019

Name (HND / First Semester) 100


Programming 2020

Contents:
1. Introduction
2. IDE to manage development process
3. Use of IDE in development process of application
4. Others IDE Tools Used
5. Benefit of using IDE
6. Disadvantage of IDE
7. Comparison of Using IDE with not using
8. Conclusion

Name (HND / First Semester) 101


Programming 2020

Introduction:
IDE enable to write code accurately and efficiently without losing the current document context. It
guides with live assistance as write code, no matter what language is use, from C#/VB and C++ to
JavaScript and Python. I have faced many problems in coding during development of application but
IDE me helped to solve all the problem related because it is the powerful environment of developing
application. Main problem is the code error and bug for the developer while programming. It has
many removing errors and bugs facilities i.e. debugging facilities. I have used different tools of IDE
to make it reliable, effective and attractive.

IDE to manage development process:


For the development of Inventory Management System application, I have used Integrated
Development Environment. IDE is a software that is used for software development. An IDE
consists of build automation tools, a debugger and source code editor tools. Some of the example of
IDE are: Visual Studio, NetBeans, XCode, Eclipse etc. Among them, I have developed the
application with the help of Visual Studio. The environment provided by Visual studio is really
awesome as there is lots of features and tools to build an application.

Use of IDE in development process of application:


Hopefully I choose IDE product Visual Studio for the development of application although there are
lots of software because the environment provided by Visual studio is really awesome as there is lots
of features and tools to build an application. And it is popular for C# programming. It can easily
zoom into details such as call structure, related functions, check-ins, and test status. It can also
identify, and fix code issues. Some of the feature that I have used are given below:

Code Editor:

The shell is the environment where programmer write code. Sometimes code goes wrong while
developing a software. So, there comes code editor. Code editor is a text edit area where
programmers write, edit and save a document of code. It is the best tools of IDE which help
programmer or developer to correct the code. We have used this feature to execute all the code one
step at a time which helps to test the code line by line before creating the final completion program.
It has features that assist with the writing and edition of code that includes:

Name (HND / First Semester) 102


Programming 2020

• Auto-completion:
While you start to write the first part of the function, it suggests or completes the function and
any arguments or variables. Auto completion suggests names of classes, variables, methods,
keywords, and any other symbols that are available. This feature provides intelligent code
completions based on language and analysis of your type. If service find possible completions, it
will suggest as you type. It will filter the list members to include only members containing your
typed character If you continue typing character. To insert the selected member, you have to
press ‘Tab’ or ‘Enter’.

• Bracket matching:
This feature helps to detect missing brackets if you forget to close a bracket while coding. It is
used for languages that need pairs of brackets to mark out blocks of code. It helps to read and
understand code faster.
As you can see in the screenshot given below:

Name (HND / First Semester) 103


Programming 2020

You can see red underline in private modifier. That is the notation of bracket error. I just forget to
close bracket in above code in shown screenshot. There is no pair of brackets so service highlight
below modifier to tell that I missed to close the bracket.
• Syntax checks:
This feature helps to correct the code by recognizing incorrect syntax. It highlights errors or bugs
if present. Syntax error refers to the structure of a program and the rules about that structure.

Others IDE Tools Used


• Compiling
This is a tool of IDE that reads a program which is written in high level language and
translate it into an equivalent program in binary language. Commonly, programmer writes
program in a programming language like java, pascal, python, C, C++, C# and so on. It helps
in conversation with machine and human by translating high level language to machine
language. In this process, if errors are present it will detect and report the presence of errors
in the sources program. Depending on how big the program is it takes a time to compile and
if no errors are present in program an executable file will create.
• Debugging
This is a tool of IDE that is used to detect errors in program. It may suggest the type of error
and which line it is on if debugger find errors so finding bugs is easy using this feature.
Breakpoints is a debugging tool. It helps to debug the program easily. Debugging is done
when the program fails to work. Some of the steps for debugging are:
1. Replicating of the bugs
2. Understanding the bug
3. Locating the bug
4. Finding the root cause
5. Fixing the bug and restarting the program

Name (HND / First Semester) 104


Programming 2020

• Auto Documentation
This tool describes the structural function and purpose of the code by observing the modules
and variables and its expected behavior are collects into a text file that can be used by the
other programmers or developers to understand why and how the code was created.
• Libraries
Libraries provide functions that can be imported and used at the start of the program. Those
function are not including in the core part of the programming language. Example: turtle
graphics library is a function that provides access to graphics tools in python.
• Automation tool
This tool is useful when a program has many thousands of lines of code. It includes testing or
compiling code. The purpose of automation is to minimize bad software, increase the quality
of the software and save time and money. These tools automatically do the process that that
might in any other case be executed by means of hand.

Benefit of using IDE:


Integrated Development Environment is an application software which helps developers to build an
application. An IDE can improve the productivity and efficiency of software developers to fast setup
and standardization across tools with less efforts. Without an IDE, developers spend time deciding
what tools to use for given tasks, how to use and configure them. All the important and necessary
tools are included in integrated development environment. IDEs are also designed with all their tools
under one user interface (UI). An IDE can organize the necessary features to standardize software
development in the UI. Hopefully I choose IDE product Visual Studio for the development of
application although there are lots of software because the environment provided by Visual studio is
really awesome as there is lots of features and tools to build an application. And it is popular for C#
programming. It can easily zoom into details such as call structure, related functions, check-ins, and
test status. It can also identify, and fix code issues.

Disadvantage of IDE:
Although IDE is the one of the popular Microsoft products developed to build an application or
computer program, it also has some disadvantage and they are: IDE requires more memory and
processing power because it use graphical interface. It’s tools may be complex for beginning
programmers and each IDE will have their own unique learning curve requiring time to learn. Some

Name (HND / First Semester) 105


Programming 2020

IDEs don’t allow user to interact with the database connectivity. It can’t automatically fix errors
without knowledge of code efficient.

Comparison of Using IDE with not using


It is possible to develop the application using the scripting language but IDE make it easier to build
application or software. IDE has library where we can work anytime for the development of
application. There are lots of tools and facilities in IDE whereas there is no such library in scripting
language. IDE consists of different types of tools like code editor, build automation tool, debugger,
syntax checker, etc.

1. Completer
Auto-completion facility is available in IDE that completes the function and any arguments
or variables. It suggests names of classes, variables, methods, keywords, and any other
symbols that are available. There is no such auto completion facility is available in scripting
language. We have to complete code ourselves.
2. Bug and Error
IDE can detect errors in program. It has also facility of debugging through breakpoint, watch
point, tracer etc. Without using IDE, we have to find the bugs. it is difficult to find error in
complex program.
3. Design and Form
Using IDE tools and techniques make application reliable, efficient and attractive. Tools like
panel, button, label, data grid table, text box, date time picker, check box etc. make
application more understandable than not using IDE tools.

Conclusion:
Hence, this report clearly shows that using IDE is much easier than not using IDE to build an
application. Its tools play vital role to manage development process. IDE enable to write code
accurately and efficiently without losing the current document context. IDE is for prefect
programmer who has lot of experience and for the fresher IDE is much more helpful to learn and
work with.

Name (HND / First Semester) 106


Programming 2020

Report on Debugging Evaluation.


Report:

Evaluation Report on IDE Debugging Process in Application Development

Student Name

15th April 2019

Name (HND / First Semester) 107


Programming 2020

Contents:
1. Introduction to debugging
2. Debugging process with diagram
3. Debugging facilities in IDE
4. Example of program along with step to debug them
5. Conclusion

Name (HND / First Semester) 108


Programming 2020

Introduction to Debugging
Programmers write programs in a language we call code. But, due to the fact nobody is perfect,
computer programmers sometimes make mistakes when writing their code. These mistakes are called
bugs. The process of removing these bugs from program is called debugging. A complex program
can have lots of lines of code and it in normal for new programs to have some bugs. Debugging and
Testing program are the important part of programming. It is used to detect errors in program. It may
suggest the type of error and which line it is on if debugger find errors so finding bugs is easy using
this tool. Debugging is done when the program fails to work.

Debugging Process with Diagram:


Debugging is the process of detecting and removing errors present in the program. It may suggest the
type of error and which line it is on if debugger find errors so finding bugs is easy using this tool.
Debugging is done when the program fails to work. There are some steps for the debugging process
and they are demonstrated below:

Name (HND / First Semester) 109


Programming 2020

Replication of the bug:

The first step of debugging process is replicate bugs. You have to replicate the bug yourself, even if
someone else has already done it because you know your codebase better than someone else. Then
make a note of the of the replication that you have found which helps to communicate the details of
error later on.

You will have more evidence zeroing in on the scenario causing the issue if your result in the same
workflow. And if not, your time will be saved by not looking into mechanics that aren’t part of the
problem.

Understanding the bug:

After replicate the bug, now it’s time to understand the bug. It is tough and more time-consuming
task. So that we can use available tools like source Navigator to understand bugs. To know the
dynamic behavior of the program debugger set breakpoint and watch point. Using this tool help us to
understand the bug in better way.

Locate the bug:

After understanding the bug, the next step is to locating the bugs. It is the main step of the debugging
process. By locating the bug, we can fix them. The code that causes the visible incorrect behavior
and which is actually incorrect are the two types of source code location. Visible incorrect behavior
is like memory corruption during a program and actual incorrect is like syntax error, programmer
mistake. It is difficult to find the actual incorrect in code so that we have to assume that error may be
anywhere in source code.

Fix the bug and retest the program:

The last step is to fix the bug after reproducing, understanding and locating the bugs. We can leave
the debugging after fixing a bug. It is necessary to test the program after fixing bug to make user
weather any other bugs present in source code or not. We can restart the program and it is ready to
use after testing successfully.

Name (HND / First Semester) 110


Programming 2020

Debugging facilities in IDE


Integrated Development Environment is an application software which helps developers to build an
application. IDEs guides with live assistance as write code, no matter what language is use, from
C#/VB and C++ to JavaScript and Python. Main problem is the code error and bug for the developer
while programming. It has many removing errors and bugs facilities i.e. debugging facilities which
helps developers to find and fix the program. This Service suggest the type of error and which line it
is on if debugger find errors so finding bugs is easy using this feature. Some of its facilities are
Breakpoints, traces, watch point, step command etc.

Breakpoints:

Breakpoint are the one of the most important debugging techniques. It is used for debugging the
programs by pointing the line of program at certain stages in order to find and solve the problem.
Breakpoints can set wherever you to pause debugger execution. Example: to see the state of code
variables. You can set breakpoint on any of executable code like logic of program which crash the
program as certain point like not connect to database or mistakes. Breakpoint can’t set on the
namespace of class declaration but it can set on the variable declaration and loops. It is set to debug
the source code or function which has capacity to delete and edit. It can set multiple lines of code at
once.

To set the breakpoint in source code, click in the left margin next to a line of code or you can just
select the line and right-click and select Breakpoint > Insert breakpoint. It appears in red dot in the
left margin. Example of the breakpoint I have used during the time of development of Inventory
Management System application which is given below:

When I debug source code, execution pauses at the breakpoint, before the code on that line is

Name (HND / First Semester) 111


Programming 2020

executed. The breakpoint symbol shows a yellow arrow.

Watch point:

Watch point is the special kind of breakpoint. Watch point allow the option of monitoring the content
of individual variables because wile using watchpoints, the debugger will not activate until the
contents of a particular field change and debugger stops when the value of the monitored variable
changes. It can be used to interrupt a program when the contents of a structure change. The system
will automatically stop when the condition gets satisfied. We can set 5 watchpoint at a time. To set
watchpoint you just have to right-click an object and choose Add Watch while debugging. Example
of the watchpoint I have used during the time of development of Inventory Management System
application which is given below:

As you can see above, I am watching integer ‘i’ whose value is 0.

Name (HND / First Semester) 112


Programming 2020

Tracer point:

The debugging tools that contains in a functional use to make a note of the program operation while
managing the application is called tracer. It is a run time function which is active while developing
application to detect the bugs in the program. Tracer is used to track runtime error along with
breakpoint which helps to find error. Each function present in the program can be traced by tracer
and it is use to fix the bug by programmer.

Command Step:

Command step is the step to connected program options that allows to execute. Types of step
commands:

• Step into: it enters break mode before the first line of code is executed.
• Step over: it executes the procedure as a unit, and then steps to the next statement in the
current procedure.
• Step out: it executes the remaining lines of a function in which the current execution point
lies.
• Step back: Step back also known as reverse debugging which is used to rewind the last step
that helps to return the program in the prior level. This helps to check the statement that user
executed.

Example of program along with step to debug them


Here is the example of source code that I have in my program which present bug or error. The
screenshot of the program is given below:

Name (HND / First Semester) 113


Programming 2020

In the above code select query is incorrect because there is no any table name as sale in database of
inventory_management_system. The steps to debug the error is given below:

Start the debugger!

1. Press Start Debugging button (Debug > Start Debugging) in the Debug Toolbar. You can also
press shortcut key F5 that starts the system with the debugger attached to the app process. We
haven’t gone anything special to examine the code so that page just loads and you see the
console output.

2. Stop the debugger by pressing the red stop button.

Set a breakpoint and start the debugger

Breakpoint are the one of the most important debugging techniques. Breakpoints can set wherever
you to pause debugger execution. You can take a look at the values of variables, or the behavior of
memory, or whether or not a branch of code is getting run by using breakpoint.

1. Set a breakpoint in source code, click in the left margin next to a line of code or you can just
select the line and right-click and select Breakpoint > Insert breakpoint. It appears in red dot
in the left margin.

Name (HND / First Semester) 114


Programming 2020

2. Again, press F5 or Start Debugging button to start app and the debugger runs to the line of
code where you set the breakpoint.

As you can see in the above screenshot, I have set a break point in line 30/31. There is yellow
color highlight in line 30/31 that means line is debugging. You can see in the below
screenshot that show that there is error in line 30. That red highlight line means there is error
or bug present in that line.

3. You know that in which line bug is present. Now its time to find the bug, understand and fix
the bug. As I set that error, I know that there should be sales in the place of sale in the above
program. I fix that bug and restart the program and it worked.
4.

Debugging used for making application more secure, and robust:


Debugging process helps to detect the bugs in the source code and the vital role of the debugging is
to locate the bug and fix it step by step. Debugging is the important tool of IDE because when we
start writing source code there arises bugs and it should be maintaining and fix the bug properly and
to fix this bug debugging tools is most important and I am using Visual Studio IDE which provides a
good debugging tools to fix the bug. Not a professional programmer can write a bug less program so
every programmer needs a debugging tool.

Name (HND / First Semester) 115


Programming 2020

Security and robustness come from the design phase. Debugging is the process of detecting bug or
error that done after the design and after the implementation. Test-driven Development means
building automated unit and regression tests early in the development cycle, and the maintaining and
running them throughout. Debugging can help show implementation problems, but the really tough
part is design. If the design went wrong, the whole thing is to collapse. This is effectively investing
in proactive debugging, and it produces more robust software applications.

To make our application more secure we should use the encryption tools for securing password and
to make robust it should be operated in all the OS and C# which is one of the powerful or robust
programming languages for the .NET platform. It is highly supported language so that our
application also supports almost all OS and C#.NET. C# programming language contains high
memory backup in order that memory leakage problem and other such types of problem isn’t always
taking place because it occurs within the case of C++ language. So, making our application more
secure and robust C#.NET programming language has helped.

Conclusion:
Hence, this report explains about the debugging process with the diagram. I have mentioned step by
step process of debugging which is used for making application more secure, and robust. I have also
explained about the features of debugging. We came to know that debugging helps to check the error
in the program and codes and also helps to solve it for efficiency of the application.

Name (HND / First Semester) 116


Programming 2020

Report (Evaluation Report) including fully commented source code.


Report:

Evaluation Report on Outing Code Standard

Student Name

15th April 2019

Name (HND / First Semester) 117


Programming 2020

Contents:
1. Introduction to code standard
2. Advantages of code standard
3. Necessity of coding standard in team and for individual
4. Recommendation to use coding standard
5. Screenshot of code design pattern I have used
6. Working Process of Inventory Management System application
7. Future Improvement or Enhancement of Inventory Management System
8. Conclusion

Name (HND / First Semester) 118


Programming 2020

Introduction to Coding Standard:


Coding Standard are the set of standard and guidelines that are or should be used when writing
source code for a program. It referred to the programming styles or coding conventions that are very
important to the programmers. In coding standard, standards are the rules that a programmer is
expected to follow. Many programmers forget code standard while coding. In fact, for lots
companies and nearly all programming languages, a code standard is a physical document, and is
essential for producing uniform code. There are two main types of coding standards, coding
standards written for company which is developers expected to follow within the company and
another is coding standard for a programming language which is the programming language
developers recommended all programmers should follow. Some of the coding standards are
indentation, commenting code, variable decelerator etc.

Advantage of coding standard:


Coding Standard can provide huge advantage when it implemented correctly. They can make a great
different when maintaining software which is the most important step in SDLC. Having a coding
standard however, means other developers and programmers can look over the source code, possibly
identifying possible security flaws/bugs in the code as well as maintained and modify the code if
needed. Software contain fewer bugs and generally be of a higher quality if software complies pre-
existing coding standard because present error with the code can be fixed in the SDLC process and it
is easier to test. Coding Standards contains less bugs which means less time and money has to be
spent maintaining the code. It has also huge effect on teamwork. Programmer can learn different
ways and programming styles within a team.

Coding Standards that I have used


Indentation:

Indentation is discussed in all coding standards at some level which is used by the complier to
identify the scope of the functions. Languages such as java, C# has no actual effect on the
compilation of code itself which makes the code more human understandable and gives indication of

Name (HND / First Semester) 119


Programming 2020

scope without affecting the program directly. Example of indentation is given below:

Type 1 Type 2
if (g < 17 && h < 22 || i < 60) { return true; } else if (g < 17 && h < 22 || i < 60)
{System.out.println (“incorrect”) ; return false; } {
return true;
}
else
{
System.out.println(“incorrect”);

return false;
}

Indentation is meant for the human user. It can be seen when examining both pieces of code above
that the type one is the much easier to read then type 2. I have used a simple if-else loop to
demonstrate how even the simplest of code can become confusing when indentation is now used
effectively.

Commenting code:

In computer programming, “A comment is a programmer-readable explanation or annotation in the


source code of a computer program. They are added with the purpose of making the source code
easier for humans to understand, and are generally ignored by compilers and interpreters. The syntax
of comments in various programming languages varies considerably” (Wikipedia, n.d.). It explains
how the program works or the function of the source code which is very useful. It clarifies the
intention behind a certain line or block of code and serve as a reminder to change something in the
future. There are some special characters like /*……*/, //, <! --something --> etc. that are use in code
commenting. Example:

Name (HND / First Semester) 120


Programming 2020

According to the Ada coding standard in 2005,

“Programmers should include comments whenever it is difficult to understand the code without the
comments.”

Variable Declarations:

Variable declaration is another coding standard that I have used in my program. It is always included
in coding standards. Variable declarations are regularly neglected when programming however, in
the large programs there can be the difference between understanding code or not. It should be
demonstrating the function of the variable which they store. Example of variable declaration:

Example:
If (a < h && z <o && t<e)
{
return true;
}
else
{
return false;
}

This code does follow indentation rules and it is difficult to understand because the code had been
given generic names that don’t help to explain the variables. In the given example, I have used a
basic if loop to demonstrate that even the most basic functions can be made confusing without
correct variable declarations. It must be remembered that almost all programs will be more complex
than this and therefore making the code even less difficult to read. Appropriate naming variables can
reduce the need for comments in source code which makes it more self-explanatory.

Naming Convention:

Naming convention is a code standard rule for choosing the character sequence to be used for
identifiers which denote variables, functions, types and other entities in source code. It makes easy to
understand the source code. It is used to enable code quality review tools to focus their reporting
mainly on significant issues other than arguing over syntax, naming standards and style preferences.

Name (HND / First Semester) 121


Programming 2020

Camel Case:

Camel case also known as camel caps that is the practice of writing phrases such that each word in
the middle of phrase begins with a capital letter without space like iPhone, iPad, eBay, johnSmith
etc. It is used for variable name in the programming. Programming languages prefer camel case, each
word except the first is capitalized. Example:

camelCase for local variables (string myName = "James")

Pascal Case:

It is basically camelCase but starting with a capital letter. In Pascal case, each word is capitalized as
in ThisStringIsPascalCased. Pascal case means upper camel case.

PascalCase for public member variables (string MyName = "James")

Some of the example of naming guidelines that I have used in my program are:

//non-private variable
variableName

//private variable
_variableName

//methods
MethodName

//parameters
parameterName

//Properties
PropertyName

Necessity of coding standard in team and for individual:


Coding Standard are the set of standard and guidelines that are or should be used when writing
source code for a program. It referred to the programming styles or coding conventions that are very
important to the programmers. In coding standard, standards are the rules that a programmer is
expected to follow. Many programmers forget code standard while coding. In fact, for lots
companies and nearly all programming languages, a code standard is a physical document, and is
essential for producing uniform code.

Mainly, it is for safety, security and reliability. Its compliance with industry standards like ISO. It is
used to consistent code quality no matter who writes the code and software security from the start.

Name (HND / First Semester) 122


Programming 2020

And main things, it reduces development cost and accelerate time to market. Coding Standard can
provide huge advantage when it implemented correctly. They can make a great different when
maintaining software which is the most important step in SDLC. Having a coding standard however,
means other developers and programmers can look over the source code, possibly identifying
possible security flaws/bugs in the code as well as maintained and modify the code if needed.
Software contain fewer bugs and generally be of a higher quality if software complies pre-existing
coding standard because present error with the code can be fixed in the SDLC process and it is easier
to test. Coding Standards contains less bugs which means less time and money has to be spent
maintaining the code. It has also huge effect on teamwork. Programmer can learn different ways and
programming styles within a team.

Several times when program fails, coding standards helps to reduce the risk of failures. Coding
standards help both working in a team or an individual because the standard of the code determines
which type of programmer you are so that the working in a big company and not using coding
standard is not the best practices. Working in a team ensures that everyone in the team is using the
efficient and proper code and you can share views and ideas regarding the development and coding
for the program. We can follow coding standard which determines the values of the programmer in
both team and individual work. So, the necessity of coding standard in team and for individual is
comparatively same.

Recommendation to use coding standard:


Many programmers forget code standard while coding. In fact, for lots companies and nearly all
programming languages, a code standard is a physical document, and is essential for producing
uniform code. Coding standards are important for safety, security and reliability. There are four main
drivers for using coding standard: Compliance with industry standards like ISO, Consistence code
quality, Software security from start and Reduced development costs and accelerated time to market.
Several times when program fails, coding standards helps to reduce the risk of failures. So, based on
advantages and important that I mentioned and according to my experiences, I recommend to all
programmers and developers to used coding standards.

Name (HND / First Semester) 123


Programming 2020

Screenshot of code design pattern I have used:

Name (HND / First Semester) 124


Programming 2020

Working Process of Inventory Management System application:


The desktop application Inventory Management System is used to keep the records of the different
entities like staffs, customers, products, sales, purchase, suppliers and reports. The application is
made fulfilling all the needs and necessities of the users.

We run application, login page will open where we have to enter correct email and password. When
we enter email and password, application check it with admins data stored in database and when it
matches, dashboard of the application will open. If the given email or password is incorrect, it will
display message. We can also create new account if we don’t have an account and enter into the
dashboard. After login to the application, it brings us to the dashboard. It is the main page of the
application from where all other pages can control. We can easily choose any page and enter the data
in any database as per the requirements. If we click on staffs on the entry form then form page of
staffs will open and we can insert, delete, update and save data and information here. When we add
some data in the form, we can see it in data grid view in that form. Similarly, all the tables like
customers, products, sales, purchase, suppliers and reports work as the staffs.

Future Improvement or Enhancement of Inventory Management System:


In the future, we can add various kinds of facilities for the improvement of Inventory Management
System like features modification and update, decrement on application respond time, backup data
and system recovery, high level security, improvement in user and technical documentation etc.

Place for Improvements

Performance, scalability and security are the features of Inventory Management System application
that can improve by application performances.

1. Performance:
In software development field, performance refers to the working speed and time responded
by the application to run. Inventory Management System is a simple application so that It
might get slow when many data are added in the application in same time. For the effective
application performance of the application should be boost up so that application will open
faster with many data.

Name (HND / First Semester) 125


Programming 2020

2. Scalability:
Scalability refers to the capacity of a system to handle a growing amount of work. A system
is said to be scalable if it can increase its workload when additional resources are added. In
case of Inventory Management System, it has low level of scalability. So, it should be
improved to smooth run of application when workload increases.
3. Security:
Inventory Management System has been provided users account which take care of the
security of data, protecting the data from unauthorized access. Without correct email and
password unauthorized person cannot entered into it. It will display message if given email or
password is incorrect. For the better security strong password is required and data backup and
system recovery can provide for data loss.

Software Maintenance

After the application is developed and it worked properly as expected then the application is ready to
be use. After using this application, we can face a lot of problems that may be the bugs or crashes in
the future. In this case, software maintenance is required. The maintenance helps to maintain the
software standard that reduces the risks and error that can occur in the future. So, we need to have
the application maintenance time to time if there are errors in the system.

Some of the main enhancement that should be done for the betterment of application is given below:

• Hardware:
Improvement on hardware makes application performance efficient and effective. It helps to
decrease system respond time. As we know Inventory Management System is based on two
main software, Visual Studio and MySQL. It can be further improved in the performance by
improving hardware and processer. It takes some time to load because storage of this
application to store data is not sufficient. We can increase the storage so that more data can
be stored and that’s helps to run smoothly and perfectly.
• Software:
This application is completely depending on the software Visual Studio and MySQL
Workbench. Visual Studio for designing application and MySQL for creating relational
database of Inventory Management System where data gets store. So, it is important to update
software time to time with the greater version that helps to boost up the system and its
processer which gives better performance.

Name (HND / First Semester) 126


Programming 2020

• Security:
Security refers to the data security level. High level security helps to application more secure.
For the secure of all data stored in the database high level security is needed. In the Inventory
Management System, there is no such type of security that can secure all database. There is
only user authentication in the name of security, which is not sufficient security for database.
Different job logs, audit log, schedule backup can be applied for the security. Unauthorized
access can be preventing from different software and hardware firewalls. Data backup and
system recovery facility can be added in case data accidently loss.

Conclusion:
Hence, report clearly describes about coding standards along with their examples and benefits. I have
provided how I have used coding standards during development of Inventory Management System
application with screenshots. Finally, I have described about working process and further
improvement of Inventory Management System Application. From this report, we came to know that
for better program we should know about the coding standard and have knowledge to implement it.

Name (HND / First Semester) 127

You might also like