0% found this document useful (0 votes)
50 views

Assignment: Unit Code: D/615/1618

This document discusses programming concepts including algorithms, programming paradigms, integrated development environments, and the software development process. It covers library management system algorithms and flowcharts, the roles of compilers and interpreters, limitations of programming languages for algorithm design, procedural, object-oriented, and event-driven paradigms, benefits of IDEs such as code editing and debugging tools, positive and negative aspects of source code, and phases of software development including requirements analysis, domain analysis, and design. The document contains assignments on these programming topics divided into multiple tasks.

Uploaded by

Rohan Puri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Assignment: Unit Code: D/615/1618

This document discusses programming concepts including algorithms, programming paradigms, integrated development environments, and the software development process. It covers library management system algorithms and flowcharts, the roles of compilers and interpreters, limitations of programming languages for algorithm design, procedural, object-oriented, and event-driven paradigms, benefits of IDEs such as code editing and debugging tools, positive and negative aspects of source code, and phases of software development including requirements analysis, domain analysis, and design. The document contains assignments on these programming topics divided into multiple tasks.

Uploaded by

Rohan Puri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 95

Saroj Kumar Thapa (HND / First Semester)

Programming
ISMT COLLAGE

Assignment

Unit code: D/615/1618


Programming 2018

Contents
Task 1 [LO1, P1]....................................................................................................................................6

Introduction:...........................................................................................................................................6

Main.......................................................................................................................................................6

Detailed explanation of ideas covered in the introduction section.....................................................6

Characteristics of the algorithm:........................................................................................................7

Limitation of algorithm:.....................................................................................................................7

Examples of algorithm.......................................................................................................................8

Choice of tools:.................................................................................................................................10

Design of the layout for library management system:......................................................................11

Maintenance of Book:..................................................................................................................11

Searching of Book:.......................................................................................................................11

Member:...........................................................................................................................................12

Data dictionary used in library management system:.......................................................................13

Algorithm for library management system:.....................................................................................13

Flowchart for library management system:......................................................................................14

For searching books:.........................................................................................................................17

Conclusion:..........................................................................................................................................17

Task 2 [LO1, M1]................................................................................................................................19

Introduction:.....................................................................................................................................19

Example: In java...............................................................................................................................19

Roles of the pre-processor, compiler, linker and interpreters:.........................................................22

Preprocessor:................................................................................................................................22

Compiler:......................................................................................................................................23

Interpreter:....................................................................................................................................23

Assembler:....................................................................................................................................23

Linker:..........................................................................................................................................23

Saroj Kumar Thapa (HND / First Semester)


1
Programming 2018

Loader:.........................................................................................................................................24

Conclusion:.......................................................................................................................................24

Task 3 [LO1, D1].................................................................................................................................25

Introduction:.........................................................................................................................................25

Relationship between the code variant and algorithm:.....................................................................25

Limitation of the programming language to design my algorithm:.................................................26

Conclusion:..........................................................................................................................................27

Task 4 [LO2, P2]..................................................................................................................................28

Introduction:.....................................................................................................................................28

Procedural programming language:.............................................................................................28

Object oriented programming language:......................................................................................32

Event driven programming language:..........................................................................................35

Relationship between procedural, object oriented and event driven programming language:....37

Presentation slides:...........................................................................................................................37

Conclusion:.......................................................................................................................................44

Task 5 [LO2, M2]................................................................................................................................45

Introduction:.....................................................................................................................................45

Types of IDE and language supported by IDE:................................................................................45

Benefits of IDE:................................................................................................................................47

Code editor:..................................................................................................................................47

Built automation tool:..................................................................................................................48

Debugging:...................................................................................................................................48

Conclusion:.......................................................................................................................................49

Task 6 [LO2, D2].................................................................................................................................50

Introduction:.........................................................................................................................................50

Positive and negative aspects of the source code in programming paradigms:...............................50

Conclusion:..........................................................................................................................................53

Saroj Kumar Thapa (HND / First Semester)


2
Programming 2018

Task 7 [LO3, P3]..................................................................................................................................54

Introduction:.........................................................................................................................................54

Conclusion:..........................................................................................................................................69

Task 8 [LO3, M3]................................................................................................................................70

Introduction:.....................................................................................................................................70

Requirement analysis:......................................................................................................................71

Domain analysis:..............................................................................................................................72

Client-oriented design:.....................................................................................................................72

Implementation oriented design:......................................................................................................72

Implementation:................................................................................................................................73

Integration:.......................................................................................................................................75

Packaging:........................................................................................................................................75

Documentation:................................................................................................................................75

Conclusion:.......................................................................................................................................75

Task 9 [LO3, D3].................................................................................................................................76

Introduction:.....................................................................................................................................76

Development of the project:.............................................................................................................77

Conclusion:.......................................................................................................................................77

Task 10 [LO4, P4]................................................................................................................................78

Introduction:.........................................................................................................................................78

Debugging process:..........................................................................................................................79

Track the problem:.......................................................................................................................79

Reproduce the problem:...............................................................................................................80

Automate and simplify the program:...........................................................................................80

Find the effected regions:.............................................................................................................80

Focus only in the infected regions:..............................................................................................81

Isolate the infection chain:...........................................................................................................81

Saroj Kumar Thapa (HND / First Semester)


3
Programming 2018

Correct the defect:........................................................................................................................81

Debugging facilities in IDE:.............................................................................................................81

Stepping commands:....................................................................................................................81

Break points:................................................................................................................................82

Tracers:.........................................................................................................................................83

Trigger points:..............................................................................................................................84

Conclusion:..........................................................................................................................................84

Code after debugging:......................................................................................................................84

Task 11 [LO4, M4]..............................................................................................................................85

Introduction:.........................................................................................................................................85

Conclusion:.......................................................................................................................................86

Task 12 [LO4, P5]................................................................................................................................87

Introduction:.....................................................................................................................................87

Why coding convention is necessary?..............................................................................................87

Comment conventions;.....................................................................................................................87

Implementation comment:................................................................................................................88

Block comment:...........................................................................................................................88

Single line comment:....................................................................................................................88

Trailing comment:........................................................................................................................89

End of line comment:...................................................................................................................89

Documentation comment:................................................................................................................90

Indent style and line length of convention:......................................................................................90

Wrapping lines:............................................................................................................................90

Naming convention:.........................................................................................................................91

Programming practice and principle:...............................................................................................92

Providing access to instance and class variables:........................................................................92

Referring to the class variables and methods:..............................................................................92

Saroj Kumar Thapa (HND / First Semester)


4
Programming 2018

Constants:.....................................................................................................................................92

Variable assignment:....................................................................................................................92

Conclusion:.......................................................................................................................................93

Task 13 [LO4, D4]...............................................................................................................................94

Introduction:.....................................................................................................................................94

Importance of coding stander:..........................................................................................................94

Pros and cons of coding stander:......................................................................................................94

Conclusion:.......................................................................................................................................95

Bibliography.........................................................................................................................................96

Saroj Kumar Thapa (HND / First Semester)


5
Programming 2018

Task 1 [LO1, P1]


Provide a definition of what an algorithm is and outline the process in Building an application.

Introduction:
The combination of Latin word ‘algorismus’ which is named after Al-Khwarizmi known as the
Father of algorithm and the Greek word ‘arithmos’ means number has different-different definition
in daily life and in the term of computer science. In daily life an algorithm is simply the set of the
rules that are defined to be fallowed. And in the term of computer science it basically means the
logics or task analysis technique that are implemented in the software by the software engineers to
get output from the given inputs. In overall, steps that are taken to manipulate (handle or control) the
data is known as algorithm.

Main
Detailed explanation of ideas covered in the introduction section.
An algorithm is widely used in the field of IT (Information technology) as well as it is also one of the
techniques of solving the mathematical problem. For e.g. if you search something on google the it
operates inputs and then search it on the database of relevant pages then give us output. This is an
example of normal search engine. Algorithm can perform normal to difficult problems, data
processing and can apply logic in it. An algorithm starts while some input is given and then it do
some of the complex calculation and then stops when it finds the expected answer. Programming is
just the set of the algorithm using various definite tools. There is no certain well defined slandered
language that are used to writ the algorithm but common constructors like loop (do, for) can be used
to write an algorithm. There are many kinds of algorithm used for many purposes but the output is
only to solve the problems. For example: How does the live video is successful or can be done? It is
only possible due to audio and video Compression algorithms, then how does google maps provide
exactly the same place that you wanted to go? It is because they used Rout Finding algorithm and
gives you the expected outputs. There are many of the algorithms like this which are more complex
than the algorithm that you used to make a cup of the tea in a daily life. They are used to solve
complex problems and make the life easier and faster. The efficiency of any software directly
depends upon the algorithm. For example: if a new version any devices are came then it will be
obviously faster and easier to use that device with new version it is possible only by the more
efficient and good algorithms. Programmers used most of their time creating good algorithm and
then on debugging so that they can create a program that will not hamper to their RAM or simply
doesn’t crash their software and also can be used in any devices.

Saroj Kumar Thapa (HND / First Semester)


6
Programming 2018

Characteristics of the algorithm:


A good algorithm can be used in more than one programming language but it must hold the
fallowing characteristics mentioned below:

Finiteness: There should be the finite number of steps in algorithm. Means to say that after finite
number of steps the algorithm must terminate in order to have a good program. Each steps must be
precisely defined.

Input: Inputs is the quantity that are given before the algorithm begins. Algorithm must have zero or
more defined, specified inputs. It must come through the specified set of elements.

Output: An algorithm must contain one or more outputs. They should match to the desired output
and should be specified. A good algorithm clearly specify what output should come and how it is
related with inputs.

Unambiguous/definiteness: The action of algorithm must be definite and specified. Every steps of
algorithm must be clearly understood by the user and should hold only one direct meaning.

Feasibility/Independent: A steps of algorithm must be independent to each other’s and should be


effective with available resources.

As a good algorithm must contain this characteristics but while creating good algorithm there used to
came a lot of the complexity and challenges. The first complexity is time which says that size of the
inputs determines the speed of the outcomes and next is storage which says that the function of the
input size determines the amount of memory required. For e.g. if you create a certain program using
algorithm and if you run that program then it takes too much time to show output and takes a lot of
storages then they are the complexity of the algorithm which makes entire program bad.

Limitation of algorithm:
1. It is lengthy for long programs.
2. Difficult for the big programs to handle.
3. It is not the program means it doesn’t gives the output.
4. Sometimes one algorithm will not be understood by another user if they leave their jobs.

Saroj Kumar Thapa (HND / First Semester)


7
Programming 2018

Examples of algorithm
1. Algorithm to convert the temperature from Fahrenheit to Celsius.

Step 1: Start

Step 2: Read ‘C’

Step 3: Read ‘F’

Step 4: F (9C+160)/5

Step 5: Print ‘F’

Step 6: Stop

Flow chart:
Start

Read ‘C’

Read ‘F’

F (9C+160)/5

Print ‘F’

Stop

2. Print from 1 to 20.

Saroj Kumar Thapa (HND / First Semester)


8
Programming 2018

Step1: Start

Step2: A=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20

Step3: Print A

Step4: Next A

Step5: Stop

Flowchart:

Start

X=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20

Print X

Next X

Stop

In these examples all the characteristics are included. Like they consist of certain steps as you can
see above. Then there should be certain inputs and should give a valid output all this algorithm has
some inputs and have valid outputs. Each and every steps in the above algorithm is clearly defined so

Saroj Kumar Thapa (HND / First Semester)


9
Programming 2018

that it is unambiguous and also one steps is not linked with other means that they are independent
too.

Choice of tools:
IDE: Eclipse

Eclipse provide IDEs and platforms for developing programs in almost every languages like java,
PHP, java script etc. and every architecture of computers. IDEs stands for Integrated Development
Environment which is a software application to provide the facilities for the software developers like
debugging, source code editor, compiler, interpreter etc. and also maintain the environment.

Server Side Programming Language: Java

Java is a computer programming language and also a computing platform that is based on the class,
object oriented, case sensitive etc. It is based upon the WORA principle means write once and run
any-where this means it can support in any architecture of the computers. Java needs java
development kit (JDK) and java runtime environment (JRE) to run the program. Environment that is
provided by sun (company) to run the java is JRE and the kit/bundle of the tools required to run is
JDK.

Client Side Programming Language: JFrame, JSwing

JFrame is the class that helps to design somethings easily. It consist of different functions like
components, layout etc. that makes easier to design something on it. It is with the help of swing.
Swing is the graphical user interface that helps to create windows base application.

Database Management System: MySQL (v8)

MySQL is the structured query language which helps to maintain the relational database. Java and
database are interrelated to each other. It is an open-source database. Open source means where data
are decentralized and then collaborated.

Platform: Desktop Application

The collection of the application program is desktop application. Application program means
computer program that are design to make some profits for the certain groups. Like games, photo
editor, music player, accounting applications etc.

Saroj Kumar Thapa (HND / First Semester)


10
Programming 2018

Design of the layout for library management system:

Maintenance of Book:
In this design only registered user can enter in it. This design helps to keep the data on the database
of the books that have been returned or renewed. In this design if you click on the buttons then it
should have to show the corresponding designs on the screen.

Figure 1 Used for returning the books from database.

Searching of Book:
This design helps to search the book with the name of the book, author’s name and subjects. This is
also used to keep the data, or simply it helps in searching the books by the various sectors. It also
display the numbers of data that have been searched from the database.

Saroj Kumar Thapa (HND / First Semester)


11
Programming 2018

Figure 2 Used for the Searching of the books.

Member:
This design helps to login to the different types of the users in the library management system. There
are two user normal and registered users. Normal users can only read or look at the data’s but
registered user can edit data also.

Figure 3 Different types of the Users.

Data dictionary used in library management system:


For returning book:

Saroj Kumar Thapa (HND / First Semester)


12
Programming 2018

Entity Field Name Data Type Length Constraint Description


Book id Int 12 Pk, auto Adding book
increment id
Book Book name Varchar 100 Not null Giving the
book name
Member id Int 50 Auto Adding
increment members id
Barrow name Varchar 120 Not null Name of
person who
barrow book

For searching book:

Entity Field name Data type Length Constrains description


s.no Int 15 Pk, auto Serial no of
increment books
Book name Varchar 100 Not null Name of the
book
Searching Author Varchar 120 Not null Name of the
author
Publication Varchar 50 Not null Date of the
publication
and edition

Algorithm for library management system:


For Returning of book

Step 1: Start

Step 2: Log in as the administrator.

Step3: Then provide all the data needed on the form.

Step 4: Hit the save button.

Step 5: Stop.

For searching of book

Step 1: Start

Step 2: Login from administrator

Step 3: Provide the information that you want to search


Saroj Kumar Thapa (HND / First Semester)
13
Programming 2018

Step 4: Select one option from combo box

Step 5: Click on the search button

Step 6: Stop

For login form:

Step 1: Start

Step 2: Provide user name and password

Step 3: Select one option from the combo box i.e. user type

Step 4: Hit on login button

Step 5: Stop

Flowchart for library management system:

For login form:

Start

Read the details provided

Saroj Kumar Thapa (HND / First Semester)


14
Programming 2018

For borrowing book:

Check user authentication?


Start
No

Log on as administrator
Yes

Read information
Click provided
on login button

The required
Click pagebutton
on search displays

The search content


Stop displays

Stop

Saroj Kumar Thapa (HND / First Semester)


15
Programming 2018

For searching books:

Start

Saroj Kumar Thapa (HND / First Semester)


16
Programming 2018

Conclusion:
Thus algorithm makes easy to do programing but to the large programs it will become a little large
and complex also. There are different kinds of algorithm that are used for the special purposes all has
their own importance. User authentication?
N

Ye

Read informations

Click on search button

Searched contents are displayed

Stop

Task 2 [LO1, M1]

Saroj Kumar Thapa (HND / First Semester)


17
Programming 2018

Determine the steps in writing the code to execution.

Introduction:
Codes in the programming language means the precise size of the instructions that that can be only
understood by the computers. It helps to decide the computers what to do at the right moment and
took the decisions. Coding is needed in the computer because computer cannot understand the high
level language then coding helps to make the computer to understand what the coder has provided
information in the high level language by converting it into the low level language. Low level
language means the binary language i.e. in the form of 0 and 1.

There are two types of the code. They are source code and object code. Source code are written in
high level programming language and object code are written in the binary forms. Source code is the
code that is hit by the programmer and object code is the code that is used by the computers to get
the information’s about the source code that is provided by the programmer.

Example: In java
public class Welcome{

public static void main(String[] args){

System.ot.println(“Welcome”);

Save as: Welcome.java

Compile as: javac Welcome.java

Run as: Welcome.

This is a simple example of use of the compiler in java.

Saroj Kumar Thapa (HND / First Semester)


18
Programming 2018

Computer can only understand the binary languages so coding helps to make computer to understand
the high level language with the help of compiler, linker, interpreter etc. Computer can understand
the different programming languages like python, Perl, C++, visual basic etc.

Figure 4 Process of conversion of High level programming tot Low level

Simply, code in
the programming language is just the block of the high level language that is converted into machine
code through the compiler or the interpreter. Let’s, look how the code is being able to process or take
the action:

Parsing of the code:

Parsing of the code means when the programmer provides the code in the high level language then
those high level language in the program is braked down into the smaller parts and then make them
ready for the compilation of the code.

Compilation of the code:

Turning the parse code into something that look like an actual programming is known as compilation
of the code. Here the source code will be converted into object code or the targeted code. Object
code means the code is executed by the computer and understood by the computers. It is not still
ready to become the program.

Figure 5 Work of the Compiler

Saroj Kumar Thapa (HND / First Semester)


19
Programming 2018

Then now the executable code will be passed through the linker. A linker is the program that is used
to link the object code with the various modules like executable files, library files, another object
files etc. so that it looks like the program.

Figure 6 Linker and Compilers work

Interpreting the code:

The software tools that interprets the code written by the programmer line by line is known as
interpreter. The main difference between the compiler and interpreter is that compiler takes whole
code as the input and interpreter takes a certain part of the code as the inputs.

Figure 7 use of interpreter

Use of appropriate language:

After the work of the interpreter the program is ready to run but the language should be chosen.
There are many language of programming like python, C, C++, java, JavaScript etc. according to the
differences in the language of the programming there will be differences in the actions of the,
compiler, linker and interpreters.

Saroj Kumar Thapa (HND / First Semester)


20
Programming 2018

Roles of the pre-processor, compiler, linker and interpreters:

[
CITATION Ker18 \l 1033 ]

Figure 8 Language Processing System in Java

High level language and low level languages are created in order to communicate among the
computer and the users. The conversion of the high level language into assembly level language and
then into machine level language is known as the language processing system.

Preprocessor:
Preprocessor is the first part of the compilation where the source code that the programmer encoded
are processed by dealing it with the macro-processing, augmentation, file inclusion, extension of the
language etc. The main purpose of the preprocessor is to convert the source code into preprocessed
code to make the work easier for the compilers/produces the inputs.

Saroj Kumar Thapa (HND / First Semester)


21
Programming 2018

Example: “#define MIN_ROWS 12” Here, preprocessor finds all places where MIN_ROW is
and replaces them with the value of 12.

Compiler:
The program that takes all the code of the programming as the inputs and then converts the source
code into the object code is known as the compiler. “The preprocessor on the first stage is invoked
by compiler before starting the compilation”. The preprocessed code is then compiled and then send
to the target assembly code.

Compiler needs more amount of the memory to store the data because compiler is such a program
that generates intermediate objects as the purpose of the future. And it is allocated in the static
memory. It need large amount of the time to analyze the source code but the overall time of the
execution of the code is faster. Debugging in the compiler is quiet difficult than others. For example:
C, C++ uses compilers.

Interpreter:
The action of the compiler can be also removed by the interpreter. Interpreter is the program that
translate one program statement at the one time which maintains the good debugging. It takes the
less amount of the memory because no intermediate object code is been created in it. It takes the less
amount of the time to analyze the source code but the overall time of execution of the code is less.
For example: JavaScript, python, ruby etc.[ CITATION Ker18 \l 1033 ].

Assembler:
After the compiler/interpreter compiled and send the target assembled code into assembler then
assembler converts the code into machine code and then send it to the linker. The output that is
obtained from the assembler is known as the object file. Object file is the combination of the
machine instruction which is then saved in the memory.

Assembler has the capacity to process only the low level assembly languages. Here the relocated
machine code is formed.

Linker:
Linker is the stage where there will be the formation of the executable machine code. Some of the
files of the high level programming language built header files/library which is in the predefined
form that is essential for executing program. Function linked with the library is known as the linker.
The functions like printf, scanf, cin, cout etc. can be linked with the objects in the program to make
an executable file.

Saroj Kumar Thapa (HND / First Semester)


22
Programming 2018

The main task of the compiler is to search and allocates its module in a program to determine the
memory locations where loading, making instruction/module[ CITATION Ker18 \l 1033 ].

Loader:
The main function of the loader is to load the file that has been executes into the memory and
executing them which is the par to of an OS. It also calculates the memory of the data and then create
the space for the data[ CITATION Ker18 \l 1033 ].

Conclusion:
The computer devices are all coded means that without coding in the electronic devices it is will be
difficult to use in the modern world. Coding, programming and there instrumental devices helps to
make the life better, easier and then faster. The programming runs in the steps and each step are
interrelated and then are important to each other’s.

Saroj Kumar Thapa (HND / First Semester)


23
Programming 2018

Task 3 [LO1, D1]


Examine the implementation of the algorithm in a suitable language. Evaluate the relationship
between the algorithm and the code variant.

Introduction:
Algorithm is the step by step guidelines or the set of the rules that should be fallowed in order to
solve the problem and meet the expected outcomes. Algorithm can be as simple as to make the cup
of the tea or as difficult as to make the programs. The main purpose of an algorithm is to meet the
objectives and the exact solutions of the problem. There are many kinds of the algorithms like
searching algorithm, rout finding algorithms, render algorithm, etc.

Algorithm in the term of the computer science is to accomplish the task by using the set of the steps.
In the computer sciences algorithm goes with the flow and knows when the algorithm must be
stopped. In computer science you must know when to start and when to stop the algorithm in order to
make the good, interesting coding and applications. Good algorithms are responsible to make the
good and faster applications.

The implementation of the algorithm is vast. More than I computer science there are any other field
where algorithm plays an important roles. In the field of the biological chemical science algorithm is
used to design the new molecular structures which helps to get prevents from the diseases. In the
physics algorithm is used to find the climates of the different places. In astronomy also algorithm
helps to collects the facts and the data about the universe and galaxies with the help of the automated
space telescopes. Even in the websites also algorithm is needed to analyze the data and then getting
the outputs. So we can say that the use of the algorithm is very vast and useful for the developments.

Code variant means the way to write the same program in the different methods like using of the
object oriented programming language, procedural programming language, event driven
programming language etc. The same program that is been written in procedural programming
language can be written in object oriented programming language but it contains some of the
advantages disadvantages and limitation of the coding and the structures.

Relationship between the code variant and algorithm:


In order to make a simple program it is needed to prepare its algorithm and flowchart that makes the
programming easier either it is procedural programming language or object oriented programming
language. There are certain changes in the codes while using different programming languages. If

Saroj Kumar Thapa (HND / First Semester)


24
Programming 2018

you use the same program in one language and same with another language then there are changes.
Let’s take one example. Problem solved by using java and C for the same problem.

Figure 9 Area of circle by using C language Figure 10 Area of Circle using Java
language.

The same program that is been written in C language has one code style and java has one code Style
but there function is same to give the area of the circle that is been input by the user. In the C
programming there is no created of the intermediate code where as in the java programming
language there is created one intermediate programming code and then is comparatively slow than C
due to this reason. In the C programing language the codes are written in the functions as well as use
the concepts of the structure and has to memorize by the programmer where as in the java
programming language code in written under the class and objects. Java is the object oriented
programming language whereas C is not the object oriented programming language. It is structured
language.

In the C programming language all the declaration of the variable should be on the top of the
program where as in the java you can declare it anywhere. By default the member in the C
programming language are public but in java it is not. In the C programming language the code is
quite difficult to write and have to remember all the things but in java you don’t need to do that.

Algorithm is the step to write the program and code is the thing that fallows the algorithm to solve
the problems. In the simple words code is the implementation or the action of the algorithm.

Limitation of the programming language to design my algorithm:


In order to design my library management system I have chosen the event driven programming
language. Event driven programming language is the language that is worked on the basis of the
events of the programmer means the action of the programmer. The action that are included in the

Saroj Kumar Thapa (HND / First Semester)


25
Programming 2018

event driven programming languages are mouse, voice sensors, keyboard etc. It uses the graphical
user interface that helps to get the inputs from the users and also helps to manage the actions of the
programmer.

The main disadvantages of the event driven programming language is that it only supports the
graphical user interface to make the design. It is also the complex type of the programming language
and takes too much time to design. Event driven programming language is not supported in other
operating systems also so it is not portable to all the devices to use. To use the event driven
programming language you must have only the big program and design, means that for the small
program it might also get the complex solutions. It also needs a lot of the processors of the computer.
It does not need more logics and ideas to make the coding and the design. If something is needed to
be modified or add the new functions then it is difficult to add without going back to the code and
modifying the all other parts and actions of the code.

Conclusion:
Algorithm is the way to solve the problem by the use of the code. The relation among the code and
the algorithm is that algorithm is the process and code is the action of the algorithm. While making
an application the basic needs is the algorithm and to carry out the operations of the algorithm coding
is necessary and done.

Saroj Kumar Thapa (HND / First Semester)


26
Programming 2018

Task 4 [LO2, P2]


Give explanation of what procedural, object oriented and event driven paradigms are; their
characteristics and the relationship between them.

Introduction:
The program that consist the steps by steps procedural is the procedural programming language. In
this kind of programming language code is executed in the sequential order. For example: the steps
of making tea.

The program that are created under the object maintaining the relationship among them is known as
object oriented programming. The codes are contained inside the class and the objects. The objects
are defined with the attributes and its behaviors. For example: a mobile is an object that have an
attributes means the keys and the behaviors means their functions.

The program that responds to the user events and similar inputs is known as event driven
programming. It is handled by the event handler which is the method. For example: action performed
by the keyboard when you hit it, action performed by the mouse when you scroll up and down etc.

Procedural programming language:


Principle:
The principle that procedural programming language fallows is paradigms principle. Paradigms
means the model or the pattern that should be fallowed. This means that all the procedural
programming language fallow the same structure of the programming. This is written in steps by
steps.

Characteristics:
1. Easy to use and to handle also, simplicity, sequential logic etc.
2. Easy implementation of compilers and interpreter
3. The return value can be called from any point of programming.
4. Use of the pre-defined functions. For example: System.out.println

Features:
1. Local variables can only be accessed within the block of the code
2. Fallows each and every steps i.e. step by steps
Saroj Kumar Thapa (HND / First Semester)
27
Programming 2018

3. Static variable can be used with all other functions

Examples:
Basic I/O:

The basic input and output methods are made for the purpose of the reading and writing the data. It
reads the data of the file and write a data to the file and response back to network. It is attached with
the package java.io.

For example:

import java.util.Scanner;

public class S_evenodd {


public static void main(String[] args) {
Scanner numbers = new Scanner(System.in);
System.out.println(" enter the number ");
double x = numbers.nextDouble();
System.out.println("print the number = " + x);
if (x%2 == 0) {
System.out.println("print the number is even");
} else {
System.out.println("print the number is odd");

}
numbers.close();
}
}

Conditional:

Conditional programming means that can print on the condition. In programming if and else works
as the conditional statement. Any statement is true then the program is executed from if otherwise
from the else part. Let’s look at one example.

Saroj Kumar Thapa (HND / First Semester)


28
Programming 2018

package com.ismt;

public class if_else_type {


public static void main(String[] args) {
int x = 30;
if (x == 10) {
System.out.print("value of x is 10");
} else if (x == 20) {
System.out.print("value of x is 20");
} else if (x == 30) {
System.out.println("value of x is 30");
} else {
System.out.println("this is else statment");
}
}
}

Loop:

Loop means the command that you have given to the computer to perform at your command is
known as loop. Looping is done if you have to run the program in an ultimate form or up to the
certain steps. There are many loops like for loop, while loop, do while loop etc.

FOR LOOP: Syntax: for (initialization; condition; increment/decrement)

{
Statements to be executed repeatedly
}
Example:
public class FOR_LOOP_1 {
public static void main(String[] args) {
int sum = 0;
for (int i = 7; i <= 10; i = i + 2) {
sum = sum + i;
System.out.println("the value of i =" + i);
System.out.println(sum);
}
}
}

WHILE LOOP:

Saroj Kumar Thapa (HND / First Semester)


29
Programming 2018

Syntax: while (condition) {


Statements
}
Change the data increment/decrement
Example:
package education;

public class WHILE_LOOP {


public static void main(String[] args) {
int i = 1;
while (i <= 10) {
System.out.println(i);
i++;
}
}
}

DO WHILE LOOP:

Syntax: do {
Statement
Change the data increment/decrement
} while (condition)
Example:

public class DO_WHILE_LOOP {


public static void main(String[] args) {
int a = 5;
do {
System.out.println(a);
a = a + 1;
} while (a <= 10);
}
}

File handling:

Saroj Kumar Thapa (HND / First Semester)


30
Programming 2018

The character stream of the classes that can perform certain actions from another class is known as
the file handling. Some of the common file handling operators are to create the file, delete, read,
write, change the permission of the files.

Example:

package education;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class FILEREADER {
public static void main(String[] args) throws IOException{
String contents;
File f = new File ("sentence.txt");
FileReader fr = new FileReader (f);
BufferedReader br = new BufferedReader (fr);
while (br.ready()){
contents = br.readLine();
System.out.println(contents);
}
fr.close();
}
}

Object oriented programming language:


Principle:
Combination of two or more objects which interacts with each other’s to form a complete program. It
should work on the class and the objects.

Saroj Kumar Thapa (HND / First Semester)


31
Programming 2018

Characteristics:
1. Once classis defined then many objects belonging to that class can be created.
2. OOP is designed in such a way that code can be reusable but it us hard and difficult too.
3. Inheritance: allows to inherit a class into more general class.

Features:
1. Encapsulation: It doesn’t allows to access the data from the external code i.e. from the class.
Means that it binds the data.
2. Polymorphism: Allows to send the message to object from different classes
3. Abstraction: Details of a certain objects that is not concern with us but relevant to solve the
problem.

Examples:
Data encapsulation: It is the inner level way of solving the problem in the program. It is in the
implementation phase of the problem solving. It hides the data and the codes from the outer world to
maintain the security in the program.

Example of data encapsulation:

Saroj Kumar Thapa (HND / First Semester)


32
Programming 2018

package com.student;

public class StudentInfo {


private int ID;
private String DOB;
private String FNAME;
public int getID(){
return ID;
}
public void setID(int ID) {
this.ID = ID;
}
public String getDOB() {
return DOB;
}
public void setDOB(String DOB) {
this.DOB = DOB;
}
public String getFNAME() {
return FNAME;
}
public void setFNAME(String FNAME) {
this.FNAME = FNAME;
}

@Override
public String toString()
return "ClassPojo [ID = " + ID + ", DOB = " + DOB + ", FNAME = " + FNAME
+"]";
}
}

Data inheritance:

Data abstraction: It is the outer layer which solves the problems in the design phase. It maintains the
security on the programming by hiding the data and not allowing to access it. It shows only the
relevant data.

Example of data inheritance:

Saroj Kumar Thapa (HND / First Semester)


33
Programming 2018

class Employee{
float salary=40000;
}
class Programmer extends Employee{
int bonus=10000;
public static void main(String args[]){
Programmer p=new Programmer();
System.out.println("Programmer salary is:"+p.salary);
System.out.println("Bonus of Programmer is:"+p.bonus);
}
}

Class diagram: It is the diagram that is used to describe what you have done in the codes. In class
diagram what are the methods, constructors, variables, classes that you have used during the
programming time these things are described. It has the certain rule to make it.

Example:

ClassName

attributes

operations

Figure 11 Class diagram example

Saroj Kumar Thapa (HND / First Semester)


34
Programming 2018

Event driven programming language:


Principle:
The flow of the program is determined by the event such as by the actions like mouse click, touch
sensor, key press, message from others etc. It uses Graphical user interface in order to get the user
inputs easily.

Characteristics:
1. Uses of the graphical user interface that makes easy for the event handling.
2. This programming language is service oriented. Means works as the background services and
give service to user wordlessly in background.
3. Time driven event handler executes particular quantity mechanically.

Features:
1. Flexible and versatile to use.
2. Suitable for the graphical user interface (GUI)
3. Not more complex than OOP. Simplicity in programming.

Examples:
Events:

Event in the event driven programming means the actions that are designed in the code to make easy
to do the things is known as the events. Event driven programming is based upon the action of the
users and the design of the programmer. Let’s look at one example:

Saroj Kumar Thapa (HND / First Semester)


35
Programming 2018

Figure 12 Add Students

Here the event might be to click the buttons add and search. They are the events provided by the
programmers according to the necessity of the code.

Relationship between procedural, object oriented and event driven programming language:
Procedural programming language is been on the concept of modular programming or the procedural
calling program. Examples are: C, C++, PHP, Python etc. The event driven program is mainly
determined by the event handler like mouse, keyboards etc. Examples: JavaScript, visual basic, etc.
Object oriented programming language treats data field as the object and manipulate it through
methods. For examples: C++, java, PHP, python, ruby etc.

Saroj Kumar Thapa (HND / First Semester)


36
Programming 2018

Presentation slides:

Saroj Kumar Thapa (HND / First Semester)


37
Programming 2018

Saroj Kumar Thapa (HND / First Semester)


38
Programming 2018

Saroj Kumar Thapa (HND / First Semester)


39
Programming 2018

Saroj Kumar Thapa (HND / First Semester)


40
Programming 2018

Saroj Kumar Thapa (HND / First Semester)


41
Programming 2018

Saroj Kumar Thapa (HND / First Semester)


42
Programming 2018

Conclusion:
Although there are many types of the programming language people preferred mostly event driven
programming language because it is easy to use and handle it.

Saroj Kumar Thapa (HND / First Semester)


43
Programming 2018

Task 5 [LO2, M2]


Analyze the common features which the developer has access to in an IDE.

Introduction:
IDE stands for integrated development environments which provides the environment and the
facilities to run the program in a manageable and better way. It is mostly used in the programming
and the software developments. It is a basic tools for the developers to write and test the software is
known as the IDE. “IDE contains of the code editor, interpreter, compiler and the other debugging
facilities that can be accessed through the graphical user interface. GUI is the code where the
programmer is no needed to standalone and code and remember all the things and lets you to
communicate through the mouse and keyboards.

The main difference among the IDE and other software development is that IDE uses the GUI and
mostly the new IDE contains of the class browser, object browser, class level diagram to use them on
the OOP. There are many types of the IDE which are graphical, text-based, turbo Pascal. Like
notepad, notepad++, eclipse, C, visual basic etc. are the basic programming language that uses the
IDE. The tools that the IDE basically includes are Source code editor, built automation tools and
debugging tools.

Types of IDE and language supported by IDE:


In the table below I have shown the different types of the IDE, there features and the programming
language that they supports with their drawbacks too. There are many of the IDE. Some are:
[ CITATION COD17 \l 1033 ]

IDE Meaning Supported Key Features Drawbacks

Saroj Kumar Thapa (HND / First Semester)


44
Programming 2018

Language By IDE
Massive library Heavyweight of
Tools to create the ASP.NET, DHTML, extensions and allows to IDE,
Microsoft software, stores apps JavaScript, JScript, debug while building
visual and games visual basic, visual also Simple edition on
studio for mobile clients, C#, C++ visual, Contains of the the code in some
designs, maintain XAML and others automation tools and devices may take
the websites etc. many more. IntelliSense feature time,
Windows of the
dashboard and dockable Takes many
is customizable with split resources to open
screen and run
support[ CITATION
COD17 \l 1033 ]

Allows the C, C++, C++11, Dynamic and static Free of IDE


application to Fortran, HTML 5, library, remote consumes more
develop from the Java, PHP and many development, can be memories, so the
NetBeans modules. It makes more. [ CITATION used in Linux, OS X, performance is not
the coding fast and COD17 \l 1033 ] Solaris platform etc. good at some
smarter. supports Qt Toolkit, devices,
supports Fortan and
Assembler files. Drag
and drop interface.

It is the free java C, C++, java, Perl, Allows the multi- Dose not contain
based developing PHP, Python, Ruby, language support. the features as
platform where and many more. Hierarchical view of the Intellij IDEA,
programmers used project with It is an open source,
Eclipse to do programming customizable Very versatile
with the features of perspectives. software, with
the IDE. Automatic error many intimidating
reporting with the system to newcomers.
tray notifications

Developed for Ruby CofeeScript, CSS, Autocomplete, automatic Needs at least 4GB
and Rails HAML, HTML, of the refactoring of RAM to make it
application with the JavaScript, LESS, Rails model diagram and smoothness,
RubyMine smart code analysis. Ruby and Rails, project view, Lack of GUI
Ruby and SASS. Quick code analysis, customization
Keyboard schema in
bundles,
Supports bundler, pik,
rbenv, RVM and
more[ CITATION
COD17 \l 1033 ]

Saroj Kumar Thapa (HND / First Semester)


45
Programming 2018

Benefits of IDE:
An IDE is built in order to create some of the opportunities and the environment in the field of
programming to make the coding and the way of programming easier. IDE is created so that all the
programs can be run and can be made through the only one applications. There are many features
included in an IDE. Some of them are discussed below.

Code editor:
Code editor is the simple program that is used to edit the source code by the programmers in the
computer program. It is a standalone application that is developed by the IDE in order to edit the
codes in the program. It has the facilities of syntax highlighting, autocompleting of the code, bracket
matching etc. that is developed by the IDE. It also provides the way to run the compiler, interpreter,
debugger etc. it enhance or simplify the writing and editing of the code[ CITATION ND171 \l
1033 ].

Auto completion:
Auto completion or the word completion means the same things. The rest of the words in the coding
while doing coding is auto completed due to the benefits of the IDE. Less time consumption during
the coding and simplify in remembering the code are the benefits of these features in IDE. There will
be the less chances of happening error in the code due to the auto completion of the
code[ CITATION ND171 \l 1033 ].

Bracket matching:
Due to the features of the IDE in the programming languages there are many benefits like these.
Bracket matching or completion of the bracket means the automatic completion of the bracket
without the help of the programmer before the code is being completed and then makes the coding
far easier.

Syntax highlighting:
The feature of it display the source code that are errors is known as the syntax highlighting.
Highlight of the code in the programming does not makes the meaning of the code incorrect but
makes the way of writing incorrect.

Built automation tool:


This is the tools that helps to automate common developer’s task. Like compiler, linker, interpreter
etc. compiler is the tools that transforms the whole code written in a high level language into the low

Saroj Kumar Thapa (HND / First Semester)


46
Programming 2018

level or the machine level language. Interpreter is just same as the compiler but it interpreted only the
single line at one time. This all facilities are provided by the IDE to do programming in an easy way.

Debugging:
Debugging is the process of finding the bug in the program and then the methods of solving the bug.
Bug means the simple error in the programming. The tools that are provided for the debugging step
in and step over. In order to run them smoothly IDE provides the necessary environments. At the
phase of the testing the application debugging is used.

Conclusion:
IDE is the environment that has the faster setup and the faster way of developments of the tasks. IDE
increases the method of coding in a faster way so that the coding in process might not take much
time to be completed. It helps to debug also the code so that the errors may be reduces in the code.
IDE is an environment to make the coding better and the program in an easier way. Nowadays all the
programming are mostly done in the IDE.

Saroj Kumar Thapa (HND / First Semester)


47
Programming 2018

Task 6 [LO2, D2]


Critically evaluate the source code of an application which implements the programming
paradigms, in term of the code structure and the characteristics.

Introduction:
Programming paradigms means simply the style or the way of doing the programming. It is also the
way to classify the programming languages. Paradigms means the way of doing something like
programming. There are many types of the programming paradigms like: imperative, declarative,
structured, procedural, functional, function-level etc. In the computer science source code means the
block of the code which is done under the class that contains objects, constructors, variables etc. in a
human readable or high level language is known as the source code. There are many way to compare
between the two programming languages like according to the structure of the code, according to its
speed, according to its performance and all. Programming paradigms means the way to compare any
programming languages like OOP, Procedural programming language, event driven programming
language etc.

Positive and negative aspects of the source code in programming paradigms:


All the programming language has their own positive and negative aspects. Like procedural
programming language has the pre-defined functions to make the coding easier, local and global
variables that can access to only the single program or to the many programs, parameter passing
helps to pass the values of the variables through the program. Procedural programming language also
contains of the programming libraries that helps in using the pre-defined codes, routines, classes in
the easy and the better way to make the programming easier and then faster. E.g.

Saroj Kumar Thapa (HND / First Semester)


48
Programming 2018

import java.util.Scanner;

public class S_evenodd {


public static void main(String[] args) {
Scanner numbers = new Scanner(System.in);
System.out.println(" enter the number ");
double x = numbers.nextDouble();
System.out.println("print the number = " + x);
if (x%2 == 0) {
System.out.println("print the number is even");
} else {
System.out.println("print the number is odd");

}
numbers.close();
}
}

Beside the positive aspects the negative aspects of this programming language is that in order to get
the work as the programmer you need to be the specialist on the particular programming language. It
is a third generation programming language that has the slow debugging facilities. The coding
facilities in the procedural programing language is not as efficient as hand crafted code written in the
low level programming language. The code structure in the procedural programming language is
harder than the other programming language because you need to memorize all the coding structures.
In order to functionalize and change the flow of the work in the procedural programming there are no
efficient and the greater tools like abstraction and the modularizations. It is not easy to reuse the
codes in the procedural programming language.

Object oriented programming language also have their own advantages and disadvantages in the
terms of their functioning and coding. It is quite easier than the procedural programming language in
the terms of the coding and the functionality. In the object oriented programming language all the
program are written within the objects and the classes. There is the easy to manage the coding in
these programming language. Some of the code used to come automatically, auto correction that
makes easier to make the coding stander easy and manageable. The codes that are used in these
programming language also can be re used in other programming language too. There is the security
of the code like encapsulation, inheritance etc. that makes the code secured. It improves the software
development and software maintainability. E.g.

Saroj Kumar Thapa (HND / First Semester)


49
Programming 2018

package SECOND_11to24;

import java.util.Scanner;

public class Q12_STRING_ARRAY {


public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the name");
String[] abc = new String[3];
abc[0] = in.nextLine();
System.out.println("Enter the Roll");
abc[1] = in.nextLine();
System.out.println("Enter the Nationality ");
abc[2] = in.nextLine();
in.close();
System.out.println(" ");
System.out.println("Name = " + abc[0]);
System.out.println("Roll = " + abc[1]);
System.out.println("Nationality = " + abc[2]);
}
}

Beside the advantages there are also some of the disadvantages of this programming language. That
makes to create the new and better programming languages. This programming language needs the
large space and then quite slower to use the codes. This programming language is also not suitable
all the types of the problems. It is only used for the large types of the problems and is required to
take a lot of the time to prepare at the initial stage.

To make the better programming than the other there develop the event driven programming
language that makes the easier to understand and function the program. It is the important
programming to develop the applications easily. The codes in the event driven programming
language are flexible and can be used in any type of the programming. The code and the design of
the program can be easily done by this programming languages. This make the coding easily with the
help of the graphical user interface that make the programming easily and the faster. This allows the
programmer to put the objects in the correct way and make the coding better. There is the simplicity
of the program. E.g.

Saroj Kumar Thapa (HND / First Semester)


50
Programming 2018

Figure 13 Add Students

This kind of the programming language are made for better and simplicity of the coding. Although it
has any advantages there are some disadvantages also. It has the vast coding language and then the
classes of the programming languages are not reusable.

Conclusion:
Simply programming paradigms is the basic frame work to do the assumptions, thinking and the
process of the methodologies. Although the use of many programming paradigms makes the style
and the capability of the programming paradigms better and the coding stander better and the fast to
use.

Saroj Kumar Thapa (HND / First Semester)


51
Programming 2018

Task 7 [LO3, P3]


Write a program that implements an algorithm using an IDE.

Introduction:
IDE stands for integrated development environment. It is a software application that helps to make
java programming language easier by helping programmers to debug and write the code easily. This
is an environment for the java. Examples of IDE are compilers and interpreter which are used by the
java and NetBeans or both.

Searching of books by book name, author name.

Figure 14 searching of book


This form is used by the normal users as the purpose of searching the book with the different books
name, authors’ name, and subjects. This form also allows to clear the data after you search it. In this
form the main data type used is string.

Code:

Saroj Kumar Thapa (HND / First Semester)


52
Programming 2018

}
private JButton getBtnSearch() {
if (btnSearch == null) {
btnSearch = new JButton("Search");
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});

private JButton getBtnClear() {


if (btnClear == null) {
btnClear = new JButton("Clear");
btnClear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});

private JComboBox getComboBox() {


if (comboBox == null) {
comboBox = new JComboBox();
comboBox.setFont(new Font("Times New Roman", Font.BOLD, 20));
comboBox.setModel(new DefaultComboBoxModel(new String[] {"Book Name ",
"Author", "Subject "}));
comboBox.setBounds(91, 58, 208, 28);
}
return comboBox;

}
private JScrollPane getScrollPane() {
if (scrollPane == null) {
scrollPane = new JScrollPane();
scrollPane.setBounds(10, 112, 414, 138);
scrollPane.setViewportView(getTable());
}
return scrollPane;
}
private JTable getTable() {
if (table == null) {
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"S.No", "Book Name", "Author", "Subject", "Publication"
}
));
table.setFont(new Font("Times New Roman", Font.PLAIN, 18));
}
return table;
}
}

Output:

Saroj Kumar Thapa (HND / First Semester)


53
Programming 2018

This program will displays the outputs of the searching the books by using authors name, book name
or by the name of the subject. This will shows the result in the form of the list.

Returning of books

Figure 15 Returning of books


This form will be using by the administrators. This form is for keeping the data in the database of the
students that have returned the books after taking it from the library. In the book id, member id there
is used integer data type and in others there is the string.

Code:

Saroj Kumar Thapa (HND / First Semester)


54
Programming 2018

Code:
private JButton getBtnEdit() {
if (btnEdit == null) {
btnEdit = new JButton("Search");
btnEdit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});

private JButton getBtnDetails() {


if (btnDetails == null) {
btnDetails = new JButton("Add Book");
btnDetails.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});

private JButton getBtnBorrowBook() {


if (btnBorrowBook == null) {
btnBorrowBook = new JButton("Borrow Book");
btnBorrowBook.setFont(new Font("Times New Roman", Font.BOLD, 20));
btnBorrowBook.setBounds(10, 58, 161, 41);
}
return btnBorrowBook;
}
private JRadioButton getRdbtnReturn() {
if (rdbtnReturn == null) {
rdbtnReturn = new JRadioButton("Return");
rdbtnReturn.setFont(new Font("Times New Roman", Font.PLAIN, 30));
rdbtnReturn.setBounds(62, 327, 123, 23);
}
return rdbtnReturn;
}
private JRadioButton getRdbtnRenew() {
if (rdbtnRenew == null) {
rdbtnRenew = new JRadioButton("Renew");
rdbtnRenew.setFont(new Font("Times New Roman", Font.PLAIN, 30));
rdbtnRenew.setBounds(240, 327, 109, 23);
}
return rdbtnRenew;
}
}

private JButton getBtnSave() {


if (btnSave == null) {
btnSave = new JButton("Save");
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnSave.setFont(new Font("Times New Roman", Font.BOLD, 30));
btnSave.setBounds(169, 373, 118, 50);
}
return btnSave;

Output:

Saroj Kumar Thapa (HND / First Semester)


55
Programming 2018

After clicking on the save button the outputs or the information will be shown in the table of the
database.

Borrowing book:

Figure 16 Borrowing Book

This form is also used by the administrator in order to keep the data of the students who barrows the
book from the library. Here, book id and member id uses integer as the data types and date use date
and others uses string as the data type.

Code:

Saroj Kumar Thapa (HND / First Semester)


56
Programming 2018

private JButton getBtnSearch() {


if (btnSearch == null) {
btnSearch = new JButton("Search");
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});

private JButton getBtnAddBook() {


if (btnAddBook == null) {
btnAddBook = new JButton("Add Book");
btnAddBook.setFont(new Font("Times New Roman", Font.PLAIN, 20));
btnAddBook.setBounds(260, 11, 135, 38);
}
return btnAddBook;

private JButton getBtnAddMember() {


if (btnAddMember == null) {
btnAddMember = new JButton("Add Member");
btnAddMember.setFont(new Font("Times New Roman", Font.PLAIN,
20));
btnAddMember.setBounds(10, 78, 154, 38);
}
return btnAddMember;
}
private JButton getBtnReturnrenew() {
if (btnReturnrenew == null) {
btnReturnrenew = new JButton("Return Book");
btnReturnrenew.setFont(new Font("Times New Roman", Font.PLAIN,
20));
btnReturnrenew.setBounds(260, 78, 135, 38);
}
return btnReturnrenew;
}
private JButton getBtnSave() {
if (btnSave == null) {
btnSave = new JButton("Save");
btnSave.setFont(new Font("Times New Roman", Font.PLAIN, 20));
btnSave.setBounds(167, 356, 94, 38);
}
return btnSave;

Output:

The output of this form will be seen at the table of the database. It will be seen there in the form of
the lists.

Saroj Kumar Thapa (HND / First Semester)


57
Programming 2018

Search by admins:

Figure 17 Dash Board by Admins

This form is used by the administrator as the purpose of searching of the book. Here admin also can
search the book according to the name of the author, book name and subject. Here the main data type
is string.

Source Code:

Saroj Kumar Thapa (HND / First Semester)


58
Programming 2018

return textField;
}
private JButton getBtnSearch() {
if (btnSearch == null) {
btnSearch = new JButton("Search");
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});

private JButton getBtnBorrowBook() {


if (btnBorrowBook == null) {
btnBorrowBook = new JButton("Borrow Book");
btnBorrowBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {

new BorrowingBook().setVisible(true);

private JButton getBtnAddMembers() {


if (btnAddMembers == null) {
btnAddMembers = new JButton("Add Members");
btnAddMembers.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new AddMembr().setVisible(true);

}
});

private JButton getBtnAddBook() {


if (btnAddBook == null) {
btnAddBook = new JButton("Add Book");
btnAddBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

new AddBok().setVisible(true);
}
});

private JButton getBtnReturnBook() {


if (btnReturnBook == null) {
btnReturnBook = new JButton("Return Book");
btnReturnBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ReturningBook().setVisible(true);

}
});

private JButton getBtnClear() {


if (btnClear == null) {
btnClear = new JButton("Clear ");
btnClear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}});

Saroj Kumar Thapa (HND / First Semester)


59
Programming 2018

Output: As the program is run the data that have been kept on the database server is searched and it
gives the output in the table form. This form also helps to get information about add, barrow, return
books and as well adding the new members.

Registered user:

Figure 18 Registered User

This form is used by the administrator to add the data which are on in this form. Here the main data
type is integer and strings.

Code:

Saroj Kumar Thapa (HND / First Semester)


60
Programming 2018

private JButton getBtnSearch() {


if (btnSearch == null) {
btnSearch = new JButton("Search");
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
btnSearch.setFont(new Font("Times New Roman",
Font.PLAIN, 18));
btnSearch.setBounds(321, 89, 89, 33);
}
return btnSearch;
private JTable getTable() {
if (table == null) {
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"S.No", "Book Name", "Author", "Issued
Date", "Clear Date"
}
));
table.setFont(new Font("Times New Roman",
Font.PLAIN, 18));
}
return table;

Output:

This forms helps to bring the data from the database and then list them below of the form.

Saroj Kumar Thapa (HND / First Semester)


61
Programming 2018

Adding of the Books:

Figure 19 Adding Books

This form is used by the administrator to add the books in the library management systems. Here the
data that are used are integer and strings.

Code:

Saroj Kumar Thapa (HND / First Semester)


62
Programming 2018

private JButton getBtnSearch() {


if (btnSearch == null) {
btnSearch = new JButton("Search");
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new SearchingBook().setVisible(true);

}
});
btnSearch.setFont(new Font("Times New Roman", Font.PLAIN, 20));
btnSearch.setBounds(10, 11, 103, 33);
}
return btnSearch;

private JButton getBtnBorrowBook() {


if (btnBorrowBook == null) {
btnBorrowBook = new JButton("Borrow Book");
btnBorrowBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

new BorrowingBook().setVisible(true);

}
});

private JButton getBtnAddMember() {


if (btnAddMember == null) {
btnAddMember = new JButton("Add Member");
btnAddMember.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

new AddMembr().setVisible(true);

}
});

private JButton getBtnReturnBook() {


if (btnReturnBook == null) {
btnReturnBook = new JButton("Return Book");
btnReturnBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

new ReturningBook().setVisible(true);

}
});

private JButton getBtnSave() {


if (btnSave == null) {
btnSave = new JButton("Save");
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});

Output:

Saroj Kumar Thapa (HND / First Semester)


63
Programming 2018

With this form administrator can add the books information’s like book id, name, subject, author etc.
in the database. This form also can give the information about barrow, return, searching of the book
as well as adding the new members.

Adding the members:

Figure 20 Add Books

This form is used by the administrator to save the data of the new members in the library. Here the
data type is string and integer.

Code:

Saroj Kumar Thapa (HND / First Semester)


64
Programming 2018

private JButton getBtnSearch() {


if (btnSearch == null) {
btnSearch = new JButton("Search ");
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new SearchingBook().setVisible(true);
}
});
private JButton getBtnAddBook() {
if (btnAddBook == null) {
btnAddBook = new JButton("Add Book");
btnAddBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

new AddBok().setVisible(true);
}
});
private JButton getBtnBorrowBook() {
if (btnBorrowBook == null) {
btnBorrowBook = new JButton("Borrow Book");
btnBorrowBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new BorrowingBook().setVisible(true);
}
});

private JButton getBtnReturnBook() {


if (btnReturnBook == null) {
btnReturnBook = new JButton("Return Book");
btnReturnBook.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

new ReturningBook().setVisible(true);
}
});
private JButton getBtnSave() {
if (btnSave == null) {
btnSave = new JButton("Save");
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});

Output:

Saroj Kumar Thapa (HND / First Semester)


65
Programming 2018

This form can helps to add the new members in the library management system and also this forms
helps to get information about add, return, barrow and searching of the book.

Editing of the book:

Figure 21 Editing book

This form is used by the administrator to edit the various content of the book that are already in the
library management system or is going to add. Here the main data type used is int, and varchar.

Source code:

Saroj Kumar Thapa (HND / First Semester)


66
Programming 2018

private JButton getBtnDelete() {


if (btnDelete == null) {
btnDelete = new JButton("Delete");
btnDelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
btnDelete.setFont(new Font("Times New Roman", Font.BOLD, 30));
btnDelete.setBounds(94, 351, 145, 42);
}
return btnDelete;
}
private JButton getBtnEdit() {
if (btnEdit == null) {
btnEdit = new JButton("Edit");
btnEdit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
}); }
});

Output:

After this form is completely linked with the database this forms helps to delete and edit the books
name, authors, publication etc. in the database.

Conclusion:
Thus IDE provided good facilities like syntax highlighting, code completion that makes me really
easier to do the tasks. It enables users to write and debug the program easily. The examples of IDE
are NetBeans, android studio, notepad, notepad ++ etc.

Saroj Kumar Thapa (HND / First Semester)


67
Programming 2018

Task 8 [LO3, M3]


Use the IDE to manage the development Process of the program.

Introduction:
Development process means the division of the work into different phases to the programmer is
known as the process of the developments. Programming is not done by only individual person. It is
the team work and it contains of the different phases of the development of the programming like:
design, implementation, verification, testing, maintenance etc. Those works are divided among the
team members and at the last the program will be merged to get the outputs. There are many kinds of
the methodologies of the development like: Agile development, Waterfall development, Spiral
Development etc.

There are some of the important features of the application development. Application is made and if
the application dose not run fast and dose not gives the high quality performance then it will be the
main drawback of the application. So the main features in the application mist be it should
performance fast with the low investment on it. Software development is divided into the team works
so that it reduces the chances of having the more risk on the programming.

There is different phases of the software development which is shown in the figure below:

Saroj Kumar Thapa (HND / First Semester)


68
Programming 2018

Figure 22 SDLC

The whole process of the software/application development is that it describes about the process of
the planning about the application, creating the application, testing the application and deploying the
information’s from the systems. It provides the information about what the programmers needs to do
at the moments and what should they fallow to complete the task.

Requirement analysis:
The new or the modified (latest version) of the product for the user that are required for computing
and processing is known as the requirement analysis. The features of the product that are required
and must be quantifiable, relevant, and detailed. Requirement analysis is done for the needs of the
clients. It might contains of the documentation, avoid of the feature creep etc.

It is the team effort which is the combination of the hardware, software and the engineering section
with the great effort and the skills that is needed to maintain the requirements of the applications. It
also collects the facts of the problems, diagnosing of the problems with the required improvements

Saroj Kumar Thapa (HND / First Semester)


69
Programming 2018

and the solutions. It is done as the purpose of the end users. In our project i.e. library management
system the main require of the clients on the program was:

1. Operating system of Windows with the processor speed of 2 GHZ.


2. Memory 512 MB with the graphics card
3. Hard disk of 80 GB with I/O ports and RAM 256 MB or above
4. Administrator can run the program through the password given and normal user can log in
without passwords.
5. Both the user can search for the books but the administrator only can change the data like
adding, renew books and adding the new members in the LMS.

Simple case diagram of Library management system:

Case diagram is the diagram that is used to analyze, clarify, identify, and organize the system in a
better and effective way. A use of the case diagram helps to describe he works at the different stages
to the client. Use of the class level diagram in the library management system helps to know the
works of the administrators, normal users etc.

Domain analysis:
The analysis of the software to find the common and the variable parts of the software is known as
the domain analysis. It helps to analyze, organize, collect, identify and represent the domain model.
It is the conceptual level of the class diagram. The main theme to create the domain analysis is to
understand the problem and then solve them. Domain analysis is done to understand the problem and
then make the good decisions on the problem that is created. Class diagram means the static diagram
that describes about the structure of the systems like classes, attributes, operations or the methods
with their relationship. In the LMS the classes are books, librarian, publisher, user etc.

Client-oriented design:
Client oriented designs means the components that are provided to the clients to make the software
like the visible components to the clients and the behaviors of the attributes. The visible attributes of
the class in library management system is borrowing of the books, searching of the book etc. from
where the barrow date, name list of the book searched etc. can be get.

Implementation oriented design:


The design, architecture and the testing of the software is been completed in this stage of the
development. Here the main executable application or the software is ready to use. Here the main
thing that is been watched is the relationship among the components of the software and its

Saroj Kumar Thapa (HND / First Semester)


70
Programming 2018

relationship and also the requirement that is been fulfilled by the program or not. It works in the
module of the algorithms. The simple example of the implementation oriented design is:

1. Start
2. Select the user types and hit the button.
3. If normal user is clicked then Searching window will comes up,
4. If registered user is clicked then it should open the dashboard where password and user name
will be necessary,
5. Provide the correct information and then log in,
6. If project is completely completed and then it will allows administrator to open all the forms
that is allowed to,
7. Stop.

Implementation:
After the whole program is being completed by the programmers the main purpose is to execute the
product with the clients to make it tangible. The programmer must develop the program according to
the needs by using certain programming languages or the upgrades. Here the codes of the
programming is watched clearly if the program is being wrong and if the debugging is needed to be
done or not. Here I have shown the example of the searching of the book.

Saroj Kumar Thapa (HND / First Semester)


71
Programming 2018

}
private JButton getBtnSearch() {
if (btnSearch == null) {
btnSearch = new JButton("Search");
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});

private JButton getBtnClear() {


if (btnClear == null) {
btnClear = new JButton("Clear");
btnClear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});

private JComboBox getComboBox() {


if (comboBox == null) {
comboBox = new JComboBox();
comboBox.setFont(new Font("Times New Roman", Font.BOLD, 20));
comboBox.setModel(new DefaultComboBoxModel(new String[] {"Book Name ",
"Author", "Subject "}));
comboBox.setBounds(91, 58, 208, 28);
}
return comboBox;

}
private JScrollPane getScrollPane() {
if (scrollPane == null) {
scrollPane = new JScrollPane();
scrollPane.setBounds(10, 112, 414, 138);
scrollPane.setViewportView(getTable());
}
return scrollPane;
}
private JTable getTable() {
if (table == null) {
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"S.No", "Book Name", "Author", "Subject", "Publication"
}
));
table.setFont(new Font("Times New Roman", Font.PLAIN, 18));
}
return table;
}
}

Saroj Kumar Thapa (HND / First Semester)


72
Programming 2018

Integration:
Integration means the process of binding all the codes of the applications together to design the final
code or the application is known as the integration. In this stage of the programming the main thing
that is used to done is that to merge the application and do it’s testing and apply it. There are many
types of the integration like vertical, star, horizontal integration etc.

Packaging:
The term packaging refers to the combination of the all the code and forming the application and
then sold them as a set by binding the bundles of the design. JRE java runtime environment is the can
aggregate many of the files that makes the application able to run. It also helps to reducing the size of
the application and able to move the JRE files all among the network. Each installation of the JDK
automatically involves the JRE software.

Documentation:
Documentation is the process of the description to use the program. It is just like the manual or the
guidelines that helps run the program without knowing actually about the back end process of the
applications.

Conclusion:
IDE is an integrated development environment that helps to run the program in a better and
manageable way. The process of the development of the software is a brainstorming steps. This helps
to make the software good and the better coding.

Saroj Kumar Thapa (HND / First Semester)


73
Programming 2018

Task 9 [LO3, D3]


Evaluate the use of an IDE for the development of applications contrasted with not using an
IDE.

Introduction:
IDE stands for the integrated development environment that makes a suitable environment for
software and application developers to develop an applications. There are some of the advantages
and disadvantages of using an IDE and not using an IDE. IDE provides a facilities like source code,
built automation code tool and the most important debugging facilities. It helps in maintain the
products of the applications and helps to provide the facilities like authoring, modifying, compiling,
deploying and debugging software.

The main purpose of the IDE is to reduce the configuration and time speed of the applications.
Reducing the setup time of the application can really increases the productivity of an applications.
Some of the set of the IDE are developed in order to support some of the programming languages. It
also helps in maintaining the facilities like encapsulation, inheritance etc. IDE is based upon the
graphical user interface that helps to maintain the application in a better way. GUI in IDE helps to do
the work easy, faster and reliable. IDE is selected on the program according to the needs of an
applications, operating system, language supported, costs etc.

With the help of the use if an IDE it helps to complete the code or to highlight the code if an error
occurs. The use of the resources while making an application should be managed like the library or
header files etc. The main facility in an IDE is that it contains of the debugging tools. It helps to
make the correction of the code before the finalization of the applications. It also helps to convert the
high level language into object code of a targeted application language. Some of the example of the
IDE are JBuilder, Metrowerks CodeWarrior for java, C, C++ etc. Microsoft visual studio for visual
basic and C family etc. are some of the basic IDE used in many programming languages to make the
application better, faster, easier and maintainable.

Saroj Kumar Thapa (HND / First Semester)


74
Programming 2018

Development of the project:


Using IDE Not using IDE
Increases the efficiency of fast coding with less Without it may be complex to do the
effort. programming.
A team and a group can be worked easily Needs many time to learn the code without not
together with IDE. using an IDE
Resources can be used easily using an IDE. No facility of a resources to use without an IDE.
It makes the code auto correction and complete All the coding and the codes must be memorizes
the task easily and maintainable way. and that takes too much time and difficulties to
complete the project.
It is easy to use and then also simplifies the The auto correction of the bad code, practices, or
creation of the database applications. design is not done without an IDE.
Needs more memory due to the use of the IDE. Doesn’t need more memory to use and made the
applications.
Using an IDE can be converted the program into Cannot convert the written program into other
other form of the programming language like form of the programming language without the
java, html etc. use of an IDE.
To use an IDE some of the other programming No needs to learn about the other forms of the
language must be known. programming languages.

Conclusion:
IDE is a collection of the facilities to the user in order to make the application or the software the
best one. Using an IDE with GUI makes the coding and application easy to use. The database
application are not created manually by the users with the use of an IDE. The IDE toolbox includes
color-coding, source-code formatting, error diagnostics and reporting a code compilation. Some of
the popular IDE are NetBeans, Eclipse, Visio studio etc.

Saroj Kumar Thapa (HND / First Semester)


75
Programming 2018

Task 10 [LO4, P4]


Explain the debugging process and explain the debugging facilities available in the IDE.

Introduction:
The multistep process that identify the bugs and then remove/avoid the unexpected crash on the
program is known as debugging. Debugging helps to find or to determine the problem by identifying
the problem and determine the source of the problem. To avoid the incorrect operations of the
programming debugging is done. Bug means when the expected result that doesn’t came from the
expected programming then it is known as the bug. And the process of finding out the bugs in the
program and solving them to get the expected result is known as debugging process.

The source are simply by the common logical mistakes made by the debuggers/programmers. It can
also occurred due to the bad design of the program.

For example:

Figure 23 Bug code

Saroj Kumar Thapa (HND / First Semester)


76
Programming 2018

In the figure above there is needed to be debug so that I have tracked down the errors where the
problem might be have been occurred. In this program the array index must be multiplied by the
variable x according to my program but there arises logical error so that debugging is necessary for
this program. First let us talk about the debussing process in eclipse. There are many of the
debugging tools provided in the java like step in , step out and all the tools helps to find the program
where it has been wrong.

All the people are not perfect. Even the professional person in the programming can make some of
the logical mistakes while doing the programming. So in order to reduce the logical mistakes from
the program and to make the code easy and good debugging is needed. While debugging
programmers must be able to know the area where the debugging might be required and should solve
them with the rules. There are many rules that can be fallowed but simply while debugging the rule
fallowed is TRAFFIC rule which is described below.

Debugging process:
Debugging is not just a simple process. Debugging should be done step by step. While doing the
debugging the programmers must have the knowledge where the problems might be occurred. After
the bug has been analyzed in the program then they next steps is to solve the problem with the
processes. Debugging process apply the approaches of the Divide and conquer. It means to say that
when the debugging is needed then it doesn’t have to look after the whole code. It can be work under
the specific region of the code. The process of the debugging are as fallows.

Track the problem:


As debugging is based on the Divide and conquer rule it don’t have to look over the whole program.
It is also the difficult part to look after the whole part of the code so that to look only on the certain
part of the code the tracking of the code is an essential thing. For tracking of the code the
programmer must be able to know the possible areas where the bugs might be arises and track them
like I have done in my program and then run through debugging mode.

Saroj Kumar Thapa (HND / First Semester)


77
Programming 2018

Figure 24 Tracking the problem

Reproduce the problem:


To make the changes in the program there might be done some of the changes to make the code
better. Then the process of the checking the code and then tracking the problem is done. Reproducing
the problem can make the code better and if someone opens the programs then it makes the code
better. Technically speaking, you can’t be sure you are fixing the problem unless you can run
through the same steps, see the problem happen yourself, fix it, and then run through the same steps
and make sure that the problem went away. If you can’t reproduce it, then you are only guessing at
what’s wrong, and that means you are only guessing that your fix is going to work.[ CITATION
jim12 \l 1033 ]

Automate and simplify the program:


Automating the program makes the programmer easier to simplify and then solve the problem easily.
If the program is long then it would be better to simplify it and make them in the smaller programs.
After the simplification of the code the symptoms must be solved not the cause of the debug.

Find the effected regions:


Then after the automation of the problem then the effected reason of the code is selected for the
debugging. Programmer must know the at least where the code might be get wrong and then select
only. Programmer should not only just guess the cause and select the problem. It makes difficult to
debug.

Saroj Kumar Thapa (HND / First Semester)


78
Programming 2018

Focus only in the infected regions:


After finding the problem the infected reason must be given the attention to be solved. Programmer
must spend their time in solving only the infected reason not on the uninfected reasons. Programmer
must not try to understand what is causing the problem because it might bring the complex situation
to debug.

Isolate the infection chain:


After the selection of the infected region then it should be isolated from the right code and then
handle it in the separate method because it might bring effect on the same problem too. To isolate the
program there should be made a hypothesis, prediction on the code and then experiment on that code
at solve the error and then at last its observation.

Correct the defect:


Then the correction of the code is done and if still the code is being wrong then you might do some
clever work and blame the error to the compilers or the on someone else.

Debugging facilities in IDE:


There are many tool to debug a program which is known as the debuggers. They are used to identify
the coding logical errors in the different stages of the developing the program. There are many
facilities for debugging. Some of the facilities that are provided by the IDE to debug are:

Stepping commands:
Eclipse provided some of the tools to make the program easy to solve and debug it.

Figure 25 Stepping commands with functions

Saroj Kumar Thapa (HND / First Semester)


79
Programming 2018

After the commands of the simple keys it make easy to debug the program. Here are some of the
example of it.

F5 button (Step into):

After pressing the buttons the


problem of the codes are
detected step by steps like in the
figure. Like you can see the
messages on the debug screen
also where the bug is going on
and what is happening you can
see on the outline table. It is also
known as step into because it
came into the step and check
Figure 26 Using Step In command
bugs in the code.

F6 (step over):

It is also known as the step over command because it steps over the call commands of the
programmer. Means to say that the selected line will be executed after the key F6 is being pressed
and then suspended to the next executable line.

F7 (step return):

It is also known as the step return key because it helps in executing and returning the debugging
steps. The method that has been selected to be will be stopped until the next return statement is being
called by the programmer after selecting this button.

Break points:
This is the facility provided by the IDE to track the possible points where the error might be. The
signals to show where the might be is the break point. It helps you to find out the problem in the
programming. Taking the help of the toggle break point in the program to debugs helps to conquer
the single program in the small part so that it will be an easy way to understand. In my program
above also I have used it. You can used it by right slick on the margin line like these:

Saroj Kumar Thapa (HND / First Semester)


80
Programming 2018

Figure 27 Creating the Break Points

Tracers:
The conditional breakpoint can be created through the new features of the eclipse to print out the
messages. “It avoids the halting at the breakpoints and the cluttering the code base”.[ CITATION
jim12 \l 1033 ]

Eclipse performs the trace point like this:

Figure 28 Tracers

Saroj Kumar Thapa (HND / First Semester)


81
Programming 2018

Trigger points:
The new feature of the eclipse for debugging is trigger point that can be say as the break point in the
workspace. All the other breakpoints that are initially suppressed by triggers will be hit only after
any of the all Trigger Points have been hit. All the triggers are disabled after a Trigger Point is hit
and will be re-enabled after the run[ CITATION jim12 \l 1033 ]. Any point can be set as the trigger
point in the program.

Conclusion:
Debugging helps to make the code in the correct forms, helps to understand the code properly.
Debugging let’s to solve any errors before the program is being finalized and submitted. It is the
process of locating the bugs in the program and then allowed to fix them too. Bug means the logical
errors, faults in the code and debugging means the way of solving them to get the probable solutions.

Code after debugging:

Figure 29 Code after debugged

Saroj Kumar Thapa (HND / First Semester)


82
Programming 2018

Task 11 [LO4, M4]


Evaluate how the debugging process can be used to help develop more secure, robust
application.

Introduction:
Debugging is the process of detecting the problem in the program and then solving them. The
potential errors of the code in the problem is known to be bug and the process to solve it is
debugging. The bugs in the code can also cause the unexpected crash to the code and then leads to
damage the applications. When some of the codes are added or removed from the programming then
it will become a little more difficult to debug the program and then also sometimes debugging will
be more difficult than to code the program. It is the time consuming stage of the program.

In order to debug a program the programmer must have to understand where the possible bugs might
be arrived and then isolate the source code of that problem. The various debugging tools helps to
identify where the code is being error on the various stages of the development. Debugging means
not simply solving the problem in a one steps it is done in the different stages by tracing out the
possible points where the code might have been error. Then after try to get the exact point where the
code id been error with the reason and then try to get all the variables, values and the states of the
program at the same time. Based on the above condition try to find the cause of the problem and
solve it clearly. Make sure that any of the bugs in the code are not being left so that it will not effect
on the future.

Debugging in the programming helps to develop the more robust and secure efficient applications
and software. E.g.

Figure 30 Debugging

Saroj Kumar Thapa (HND / First Semester)


83
Programming 2018

Among the thousands of the lines of the code the code that is to be debugged should be tracked out in
the correct way without getting missed on the bugged code. Caring of the small bugs in the program
also make the program more secure and efficient. The application that is made after the debugging
will also sometime cracked by the bad guys and create the security lapses on the program. For that
the programmer must think in the wider and possible regions that could be effect to the program. At
the first part you should test the inputs in the rigorously method. As the hackers of the application
search for the simple and the easiest route to enter into the machine and crack the code so it is
necessary to test the inputs carefully to make the application more secure.

Make the application short, simple and then flexible to make it more secure means that in order to
make the application secure you need to use only the necessary memories and the bites of the
memory. For example if the one column of the database of the application is not so important to keep
then you can manage it by removing it also. This will also help to make the application more
secured. This helps to keep confusing to the data hackers and you need to simplify the every part of
the application. [ CITATION pet13 \l 1033 ]

While making the application and debugging the code there should correct mind setup must be
created to that what you are doing for what purposes. That makes to think about the security of the
applications. You should treat the users inputs with the suspicions means that nay data that is been
inputted should have the careful validation of the data with performing the syntactical and semantical
integrity checks of the codes is really necessary. Using of the log files in the debugging also helps to
know what is going on , what was gone before and what are the possible errors that might come can
be known and helps to make the application more secured and robust application. Many other things
like changing code for only one time, changing the port of application, thinking of the similar
situation can be done to make the application secured.

Conclusion:
Debugging is an art to diagnose the error in the programming and then solving it with an efficient
solutions. Bugs used to came in many and different ways like complex interaction, poor user
interface design, system failures etc. Applying the appropriate technique to solve the problem,
eliminating the problem etc. helps to develop the skills that is necessary to code. Throughout the
lifecycle of the software to bugs the codes programmers used to find an issues in testing after the
report of the end users etc. helps to maintain the coding. Programming without the logical thinking
and writing code in an unstructured manner leads to the bugging stage in the programming.

Task 12 [LO4, P5]


Saroj Kumar Thapa (HND / First Semester)
84
Programming 2018

Outline the coding standard you have used in your code.

Introduction:
The set of the guidelines that are provided for the programming style, practice, and method for the
certain programming language is known as coding convention. Coding convention is not enforced by
the compilers to do. Coding convention is the language that is been written in the same programming
language. Coding convention covers the file organizations, comments, naming convention,
declarations, statements etc. coding convention is done in order to maintain the code good, reliable,
and for the maintenance of the software.

Why coding convention is necessary?


Since, Sun Company has made coding convention on 1999 for the support of the java up to now the
coding convention has not be changed. The coding convention in java is necessary because of the
following reasons:

1. Almost more than half of the money of the life time will be waste on maintaining a simple
piece of the software,
2. It is difficult to maintain the software,
3. The reading ability of the new software are easy and are easy to understand the code,
4. Well packaged and clean must be needed if you are producing the source code.

Comment conventions;
Comment is used to get the overview of the program code and also it should be so meaningful that it
should provide other relevant information’s than code like how the corresponding packages are
created, what it should not include in the comment etc. comment should not be enclosed in larger
boxes with any characteristics, special characters etc. There are two kinds of comments:

Implementation comment Documentation comment


Comments on the C and C++ programs. Comments found in java or known as doc
Like /*…………………..*/ and // comment
Like /**………………. /
Cannot be extracted to HTML Can be extracted to HTML
Comments for the particular implementation Commented to understand the code
While commenting don’t over comment on every things, indent your comment, keep comments
relevant and don’t use the block comment because they makes the program difficult to understand.

Saroj Kumar Thapa (HND / First Semester)


85
Programming 2018

Implementation comment:

Block comment:
Description of the file, method, algorithm, data structure is done in this type of the comments. It is
especially used either at the beginning of the file or at the end of the method. A block comment can
be started with /*-, which is recognized by the indent (1). Example:

Figure 31 Block comment

Single line comment:


Short comments can be done by the help of single line comment and if the big comment is needed
then there should be fallowed block comments. Single line comments are started and ended by /*
……. */. Or //….

Saroj Kumar Thapa (HND / First Semester)


86
Programming 2018

Figure 32 Single Line Comment

Trailing comment:
Very short comments including its own special feature is known as the trailing comment. It should
be shifted far away from the statement and appears on the same line. Avoid assembly language of
commenting style on trailing comment. Example:

Figure 33 Trailing Comment

End of line comment:


The comment of the section of the code by using the // comment delimiter on the newline is known
as the end of the line comment. It is used in the multiple lines to comment. Example:

Saroj Kumar Thapa (HND / First Semester)


87
Programming 2018

Figure 34 End of line Comment

Documentation comment:
Java classes, interference, constructors, methods, and all the fields that are described in the comment
by using /**……..*/ is known as the documentation comment. The first line /** is for the classes and
interference. There should be taken great care of the space in documentation comment.
Documentation comment should to be inside the methods or the constructors. Example:

Figure 35 Documentation Comment

Indent style and line length of convention:


Space in the java programming must be maintained in order to make the good programming. The
rule of making the space in the java is Four. The exact rule of indentation is still unidentified but
most of the time people uses four space.

In the java programming language there should not be more than 80 characteristics on the single line.
Line should be maintained and organized to make the good code and program.

Wrapping lines:
There are certain rules of wrapping the lines in the java so that the code might look professional.

1. Space after comma

Saroj Kumar Thapa (HND / First Semester)


88
Programming 2018

2. Break after the operators


3. Avoid long statement and put 8 space on the line.
4. Align the line beginning on the next step with the same level on previous one.

Figure 36 using all wrapping rules

Naming convention:
Naming convention means the way to name the different parts of the java functions like classes,
interference, methods etc. If the standard method is been fallowed then it will make the programmers
easier to understand and communicate with the code. The naming convention helps to identify
whether it is the class. Method, or interference if you know the standard way of naming them.

Identifier naming Standard rule of naming Example from project


Should be noun with the mixed Class AddBok (to add the book)
Class case
Keep name short, simple and
descriptive
Interfaces Should be in the mixed case interface AddStudent (to add
form with the capitalized class the student)
name
Should be verb with mixed case addBook();
Methods first letter lower case and addStudent();
internal word capital
Name should be short and int i;
Variables meaning full char c;
Choice of variables should be
meaningful.
Name of the variable must be int ADD_BOOK = 5;
Constants declared at first int ADD_MEMBER = 10;
Should be uppercase
Space should be avoided by (_)

Saroj Kumar Thapa (HND / First Semester)


89
Programming 2018

Programming practice and principle:


There are certain rules and regulations that are needed to be fallowed in order to have the good
coding and the good programming abilities. Some of them are discussed below:

Providing access to instance and class variables:


Public class variables and the instant variables should not be created without having the good
regions. It is better to use struct instead of the class that helps to reduce the instant class level
variables.

Referring to the class variables and methods:


It is the process to avoid the use of the objects to access to the class level variables or up to the
methods. For example: public classMethod ();

Constants:
Numeric values in the coding should not be coded in the code. Only -1, 0, and 1 is used as the count
values in for loop.

Variable assignment:
Only a simple object can be assigned or declared at the one time. Avoiding the declaration of the
whole codes in the same line is necessary to build the good code and the best programming. In the
good programming the main thing is not to use the operators in a unnecessary places that can
confuses easily. The program or the initialization of the data in the program should be done
separately.

Conclusion:
Coding convention on any of the program has the certain rules to be fallowed that makes the
program the best one. The consistency of the coding is remained by the help of the good use of the
coding convention. There will be maintained the uniform way of solving the problem that makes
easy to others to understand the codes used in the programs. It also saves the time and
communication because all the things will be described if the coding convention is used.

Saroj Kumar Thapa (HND / First Semester)


90
Programming 2018

Saroj Kumar Thapa (HND / First Semester)


91
Programming 2018

Task 13 [LO4, D4]


Evaluate the range of the evidence criteria that is used as a measure for the effective CPD.

Introduction:
The style and the method of coding the program to make it better and simple is something called
coding stander. It is the set of the rules, regulations and the standard to make the application or the
software better than the best. It is not necessary to o fallow the coding stander to make an application
but using a coding convention in an application makes it more efficient and helpful to use it. Code is
simply the statement that is been written in a language that makes the programs to understand in an
easy way.

A program is simply not made by only one member. It needs a team and the certain targets of the
team that is needed to be fulfilled and then completed. Programming, making application, software is
always a team work. So while working on the team the team member should always be loyal and
should complete the given task and the assignments at the time. Also the great and efficient team
works makes the good and the better software and applications.

Importance of coding stander:


As coding can be done in the different programming language then the different programming
languages has their one styles and methods of writing the codes. With the knowledge of the coding
stander it helps to get the knowledge about how to comment on the code that makes easier to know
about the functions of the code in the particular parts. It also helps to get the knowledge about to
make the documentation about the coding and makes the programmers as well as the developers to
know about the codes. It also helps to create the maintainable code means that if you want to hand
over the code to other programmer to complete the work then by the using of the coding convention
it helps to make easier to understand the codes. By doing the comments over the methods, classes
etc. helps to know about the codes. It also helps to choose the different programming standers or to
develop them. Coding stander also helps to maintain the cyber securities and knowledge about the
security lapses in the codes. It also helps to maintain the logical understanding and also helps to
make the coding creative and easy.

Pros and cons of coding stander:


There are many ways do the coding stander used for different programming languages such as C
code uses GNU coding stander and Ruby might use Bozhidar Batsov’s community- influenced
standard. Although having different types of the coding stander all the coding stander provides
consistency to the code and then minimize the time to analyze the code. It also reduces the time to
Saroj Kumar Thapa (HND / First Semester)
92
Programming 2018

bug the code. Helps to reduce the inconsistent indentation in the code and easy to cut and paste the
code. It can be read and can get little from coding stander too. With the help of the coding
convention stranger also can find about the inner work of the people and also can overview them too.
Having the coding convention in the same programming language means to remove, avoid the
possible mistakes in the program. The codes are quite clean, organized and aesthetic too. It becomes
easier to do a lot of the work and also helps to put the fewer bugs in the program too.

Instead of all those advantages of the coding convention also there are some of the disadvantages of
it also. It is the difficult and irritating task to complete and then takes much time. The coding stander
also should be designed in order to help the programmers to understand the code. If it done in the
wrong pattern then it will lead to the wrong concepts too. There might be the conflict among the
members of the team to choose the coding stander before and after the application is being used and
made. Sometimes the team members will not understand what actually you might want in the code
and what other wants in the code this might also bring again the conflict.

Conclusion:
In conclusion coding stander is the set up rules and the regulations of the programming that is been
expected to fallow by the programmers. They are the stylistic method that directly effect on the
guidelines to other programmers, understanding etc. Coding stander are optional but they are highly
recommended in the programming because they helps to use the program in an easy methods and
makes work faster. For the open source software like Mozilla Firefox codding convention is most
important because it makes the code freely available on online. It can also detect the bugs on the
programs.

Saroj Kumar Thapa (HND / First Semester)


93
Programming 2018

Bibliography
ARSENAULT, C., 2017. Best IDE Software - a List of the Top 10. [Online]
Available at: https://www.keycdn.com/blog/best-ide/
[Accessed 28 March 2018].

bird, j., 2012. dzone.com. [Online]


Available at: https://dzone.com/articles/if-you-cant-reproduce-bug-you
[Accessed 25 March 2018].

ND, 2017. What Is an Integrated Development Environment (IDE)?. [Online]


Available at: https://www.veracode.com/security/integrated-development-environments
[Accessed 28 March 2018].

Ritchie, K. a., 2018. www.tutorialspoint.com. [Online]


Available at: https://www.tutorialspoint.com/compiler_design/compiler_design_quick_guide.htm
[Accessed 27 March 2018].

Wayner, p., 2013. Safeguard your code: 17 security tips for developers. [Online]
Available at: https://www.javaworld.com/article/2078701/mobile-java/safeguard-your-code--17-
security-tips-for-developers.html
[Accessed 6 April 2018].

Saroj Kumar Thapa (HND / First Semester)


94

You might also like