You are on page 1of 20

1

PROGRAMMING

Assignment 1

Prepared for :

Mr. Hoang Nhu Vinh

Greenwich University Da Nang

Prepared by:

Le Vo Thang

May 28, 2018


2

INTRODUCTION

This report concluding 3 main sections : Algorithm, Programming paradigm and Integrated
Development Environment. In each section, we will find out one by one about the definition
and characteristics of them. We also have some examples to specific their characteristics.

In section 1 , we can understand what is an algorithm and its characteristics, what criterias to
measure a good algorithm, the process to build an application and the procedure from source
code to executable program.

In section 2, we can figure out the definition and characteristics of 3 programming paradigm :
procedural programming, object oriented programming and event driven programming .

In section 3, we can know about the common features of an integrated development


environment and examples of some popular IDE.
3

Table of Contents
Section 1 : Algorithm
1.1.Definition : .............................................................................................................................................. 4
*Characteristics : ....................................................................................................................................... 4
*Example of algorithm ‘s characteristics : ............................................................................................... 5
1.2. Criteria to measure a good algorithm : .................................................................................................. 5
*Example of good algorithm : ................................................................................................................... 6
1.3. Seven steps to build an application : ..................................................................................................... 7
* Explanation :........................................................................................................................................... 8
2.1.The steps convert source code to execution in general: ...................................................................... 12
2.2.The steps convert source code to execution in C# : ............................................................................. 12

Section 2 : Programming paradigm


1.Procedural programming : ....................................................................................................................... 13
1.1.Definition : ........................................................................................................................................ 13
1.2. Characteristics : ................................................................................................................................ 13
2.Object oriented programming : ............................................................................................................... 14
2.1.Definition : ........................................................................................................................................ 14
2.2.Characteristics :................................................................................................................................. 14
3.Event-driven programming : .................................................................................................................... 15
3.1.Definition : ........................................................................................................................................ 15
3.2.Characteristics :................................................................................................................................. 15

Section 3 : Integrated Development Environment


1.Common features of an integrated development environment (IDE) : .................................................. 16
2. Example of some IDE :............................................................................................................................. 17
1. NetBeans IDE :..................................................................................................................................... 17
2.Visual studio IDE : ................................................................................................................................ 18
4

Section 1 : Algorithm

P1.

1.1.Definition : 1

Algorithm is an unambiguous specification step by step of how to solve a mathematical


problem . Algorithm is used to carry out calculation, data processing and automated reasoning
tasks.

As an effective method, algorithm is a sequence of finite instructions used for completing a


task . Starting from an initial state and initial input (perhaps empty), the instructions proceed
through a well-defined series of successive states to get desired outputs from the given inputs,
eventually terminating in an end-state. The transition from one state to the next is not
necessarily determined in some algorithms known as probabilistic algorithms, incorporate
randomness.
It’s also a step-by-step method to making decisions or diagnosis.

*Characteristics : 2

1. Finiteness : An algorithm must terminate after a limited number of steps.

2. Unambiguous: An algorithm must be precisely defined; each steps should be clear and their
inputs , outputs must lead to only one meaning.

3. Input : An algorithm should have zero or more well-defined inputs which are given to it
initially before the algorithm begins.

4. Output : An algorithm should have one or more well-defined outputs and should match
the desired output.

5. Effectiveness : All of the operations to be executed in the algorithm should be realizable


that they can be done exactly in a limited length of time.
5

*Example of algorithm ‘s characteristics :

-Algorithm to reverse a string in C#

public static string Reverse(string x)

string result = "";

for (int i = x.Length - 1; i >= 0; i--)

result += x[i];

return result;

Error! Bookmark not defined.

1.2. Criteria to measure a good algorithm : 3

1. Precision: a good algorithm should have fixed steps. The steps should be specific, and not
changing.

2. Uniqueness: step by step in the algorithm should give the writer a correct result that match
the writer‘s desired. The results should not vary in any ways.

3. Feasibility: the algorithm should be possible and workable in reality. It should not be abstract
or unreal.

4. Input: a good algorithm must be able to set a defined input.

5. Output: a good algorithm should be able to come out the result as a solution.

6. Finiteness: the algorithm should be stop after a certain number of steps.

7. Generality: the algorithm must be able to apply a collection of defined inputs.


6

*Example of good algorithm :

-Algorithm to count the number of words in a string in C# :

public static int Count(string x) // set an input here

int result = 0;

x = x.Trim(); //Remove whitespace from beginning and end of string

if (x == "")

return 0;

//If a string is empty, returning 0

while (x.Contains(" "))

x = x.Replace(" ", " ");

//Ensure there is only one space between each word in the passed string

foreach (string y in x.Split(' '))

result++;

//Count the words

return result; //come out the output

}
7

1.3. Seven steps to build an application :4

1.Requirements
analysis

2.Design

3.Coding

4.Documentation

5.Compiling and
running the
program

6. Testing and
Debugging

7.Maintenance
8

* Explanation :5

1.Requirements analysis :

In this first step, business analysts gathering information about the needs of the user(client) by
interview or meeting. Then the document called the user requirements is created. The user
requirements document describe all information of the application : the interface, data,
security, system ‘s functional, performance. The users will carefully review this document
because it would serve as the guideline for the system designers in the system design stage.
The user acceptance tests are also designed in this step.

2.Design :

2.1.System design :

After analyze and understand the detailed requirements document, it is the time to design the
complete system. System engineers calculate possibilities and techniques that can be
performed follow the user requirements.If any of the requirements are inappropriate , the user
is notified of the problem.Then the resolution is suggested and the requirements document is
edited after that.In this step, the application specification document is generated for the
development stage.It contains the general, menu structures, data structures system
organization.The system test plan is developed in this step, the earlier the system test plan is
prepared , the more time for unit testing executed later.

2.2.Architecture design (High level design) :

Based on the technical and financial possibility , software architects would realize the system
design by broken down it into modules taking up different functionality, brief functionality of
each module, their interface relationships, dependencies, database tables, architecture
diagrams, technology details . The integration tests would be designed in this stage.
9

2.3.Module design(Low level design) :

In this steps , the designed system is broken up into smaller modules with the very
specification details so the developers can start coding .The module design document will
contain a detailed functional of the modules :

+ All elements of the database tables.

+ All interface details with complete API references.

+All dependency issues

+Error message listings

+Complete input and outputs for a module.

It is very important that the module designed is appropriate with the other modules in the
system construction and the the other external systems.The unit tests can be developed in this
stage based on the internal module designs.

3.Coding :

All of the modules design is convertered into code by the developers in this step. The most
suitable programming language is decided according to the system and architecture
requirements. The coding is implemented based on the coding guidelines and standards. The
code is went through numerous code reviews and finally optimized for the best performance.
Unit testing is executed by the developers on the code written by them.

4. Documentation:

-It’s very importance for developers to write technical documentation precisely. The code
documents which is a part of source code ( include README files or API documentation) or
includes reference manuals, algorithm descriptions, flowcharts. Documentation is very helpful
for development, maintenance, and knowledge transfer to other developers. It must be
detailed but not verbose. Because if the documentation is lengthy , it would become very time-
consuming to read or difficult to maintain them.
10

5.Compiling and running the program :

-When developers create a program, they first write the program in source code form which is
written in a specific programming language. Those code files in a text form that can be opened
and edited by developers. Because the source code can’t be performance directly by
computers. So it must be converted from source code into machine code for computer can
understand , this process is called “Compiling” .

-Execution in computer programs is the process in which a program is loaded into the
computer’s memory and then program ‘s instructions is executed. Most of the programs is
executed with the support of an operating system and specific run-time libraries .

6. Testing :

6.1.Unit Test Plans (UTPs) are developed in module design step would performance now. The
unit tests are a very necessary part of any application develop procedure and helps eliminate
most of errors that can generate at a very early phase.

A unit like a program module is the smallest entity in the whole system. Unit testing check that
the module can execute exactly when isolated from the rest of the units of system.

6.2.Integration testing :

Integration Test Plans are developed in the Architectural Design step. Integration Testing
performed to make sure that all of the modules created before which tested independently in
UTPs can coexist and communicate among themselves within the system.Then Test results are
shared with the client ‘s team.

6.3.System testing :

System testing is strictly related with the system design stage. Unlike Unit and Integration
Testing , System Test Plans are constructed by client's team. System Test plan ensures that all of
the client ’s expectations are met. The entire application ’s system is tested for its functionality,
interdependency and communication. System Testing authenticates that functional and non-
functional requirements are met. Load and performance testing, stress testing, regression
testing.Most of the problems about the compatibility beetween hardware and software can be
discovered during this step.
11

6.4.Acceptance testing:

User Acceptance Test (UAT) Plans are developed in the Requirements Analysis step. Test Plans
are constructed by the user. UAT is executed in user environment and using realistic data to
find out the incompatibility with the other systems . UAT confirms that complete system meets
all the requirement of user and ready for use in actual time. It also detects the non-functional
errors such as load and performance defects in the real time user environment.

* Debugging : is a process of detecting and fixing the problems that prevent the program
operating correctly. Developers can use debugging tools to check and correct errors in the
program. In case of large program, the source code is divided into many small components
which are debugged separated .Next stage is the whole program.

7.Maintenance :

In computer programming, the concept of maintenance is referred to modify a software


product after deployment step to correct errors, improve performance and attributes .But in
reality , maintenance is more similar to enhance functionality of the system or fixing faults. Its
purpose is to meet the changing with new technologies and requirements .
12

M1.

2.1.The steps convert source code to execution in general: 6

-Programming language like C, C#, C++ use compilers.

Compiling Object code Linker


Source code Executable program
(Machine code)

+ Runtime library files

-Programming language like Python, Ruby use interpreters.

Interpreter Executable
Source code
program
+ Runtime library files

2.2.The steps convert source code to execution in C# : 7

Micorsoft
C# compiler Just-in-time compiler
C# Source Intermediate
Machine Executable
code Language (CLR) code program
Code

(MSIL)
13

Section 2 : Programming paradigm

P2.

1.Procedural programming :8

1.1.Definition :

Procedural programming is a programming paradigm derived from structured programming,


based on the concept of the procedure call. Procedures known as subprograms , routines or
functions ( similar to functional programming) contain a sequence of computational steps to be
carried out. Any procedure can be called at any point during a program's execution, including
by other procedures or itself.

Pascal and C is one of the procedural programming languages.

1.2. Characteristics :

1. Procedural programming focuses on process rather than data.

2. Problems are divided into smaller programs known as functions.

3. Most of the functions share global data.

4. Data move openly among the system from function to function.

5. Functions transfers data from one form to another.

6. Using top-down approach in program design.

7. In the large program, changing is very difficult and time consuming.


14

2.Object oriented programming :9

2.1.Definition :

The most important distinction between procedure programming and object oriented
programming is: while procedural programming uses procedures to work on data structures,
object-oriented programming bundles two of them together, so an "object" is an instance of a
class, operates on its "own" data structure.

Object-oriented programming (OOP) is a programming paradigm based on the concept of


"objects". The “objects” contain data in the form of fields, also known as attributes; and the
code in the form of procedures, also known as methods. One feature of “objects” is that an
object 's method can access and modify data of the objects which it is related with. In OOP, a
program is designed base on the interaction between the classes with one another.

Some of the popular object-oriented languages : Java, C++, C#, Python, PHP, Ruby.

2.2.Characteristics :

1.Encapsulation : is an object-oriented programming concept that keeps data safely and


securely from outside interfaces and just deliver to user a simple and clear interface for
working.

2.Inheritance : This is the process by which a new class can be built from a base class with all
features of base class and some of its own. This process is very useful and help increases code
reusablility.

3.Polymorphism : is the ability to exist in various forms of objects.It describes the concept that
different types of objects can respond to the same functions in different ways.

4.Abstraction :is a concept which facilitates the easy conceptualization of real world objects
into the software program.It refer to providing only essential information to the outside world
and hiding their background details or eliminate the unnecessary details.
15

3.Event-driven programming :10

3.1.Definition :
Event-driven programming is a programming paradigm in which the control flow of program
execution is determined by events ( user’s mouse clicks, key presses, messages from other
programs).In an event-driven application, there is always have an event listener (the main
loop) that detects for event that just occurred , then it runs an event "handler" (callback
function) .This handler deals with event by responding to it with statements.

Event-driven programs can be supported by any programming languages, but in some


languages that provide high-level abstractions, such as closures will be easier to implement.

3.2.Characteristics :
1.Time driven : often used in Real-time computing and in which the program is driven by a
timer . The developer would set the amount of time for the application to do something. The
programmer had to set the event that would happen after a period of time.

2.Service oriented : Everything on the computer screen provide a service to the user. Service
orientation inherits some of principles object-oriented paradigm including : Multiple use,
Non context specific, Composable, Encapsulated.

3. Trigger function : When the event just occurred , a trigger function has called. A trigger
function needs to decide what kind of event has happened and manage the actions to respond
to an event for the event handler.

4. Event handler : is the callback function that will execute when event listener detects an
event from the user. It will respond to the user’s action with its code .

5. Event loops : keep testing the user interface to detect if any events that may have occur and
immediately call the trigger function which finds the appropriate event handler to run the
code written for this purpose.

6.Flexibility : Event driven programs are very convenient for the user if they need to change
something. They just simple change the screen adding or change some event handlers.

7.Suitable for Graphical User Interface : These programs rely on user ‘s action like dragging
objects on the screens onto the form. It’s friendly and easier for developers to double click on
the objects add the code to make it work.
16

Section 3 : Integrated Development


Environment

M2.

1.Common features of an integrated development environment (IDE) :11

1.1.Source code editor :

Source code editor is a text editor that designed specifically to editing source code for
programmers. It may be an independent application or built into an IDE or web browser. Source
code editors are the most basic programming tool because the major job of programmers is to
write and edit source code.

1.2. Build automation tools :

Build automation tools help the programmers to automating the production of a software and
the process including: compiling computer source code into binary code, packaging binary code,
and running automated tests.

1.3. Debugger :

A debugger is a program is used by developers to test and debug a target program. Debuggers
may run in instruction- set simulators or running a program directly on the processor to attain
a higher level of control over its execution. This allows debuggers to stop the program
according to specific circumstances. When a program crashes, debuggers show the details and
position of errors in the target program.

1.4. Intelligent code completion :

Intelligent code completion : is a context-aware code completion feature in programming


environments that help programmers speed up the process of coding by reducing typos and
other common mistakes. This feature is carried out through auto completion popups when
typing, querying parameters of functions, query hints related to syntax errors, variable names,
functions and methods.
17

2. Example of some IDE :

1. NetBeans IDE :

NetBeans IDE is an open-source modular developer environment for of all Java application
types. The NetBeans IDE includes an advanced multi-language editor, Debugger and Profiler,
tools for versioning control and developer collaboration.

* Some of NetBeans IDE features :12

- Templates and Sample Applications : NetBeans supplies skeleton applications of project


templates for all the technologies it supports. It provides a set of sample applications for the
programmers to recreate by following step by step tutorial on NetBeans.org website.

It helps developers create a basic application much more easier and faster.

- Code templates : When writing code, the programmers has to type the commands many
times in a single program. Example the print line statement in Java, with the code templates,
it’s very simply just type sout then hit the tab key and the word expanded to this
System.out.println(""); statement.

See, it’s very helpful and save a lot of time for programmers. There are many code templates
that available and can be found by going to NetBeans -> Preferences -> Editor -> Code
Templates.

- Dynamic Language Support : The NetBeans IDE also provides integrated support for other
programming languages such as PHP, Groovy, and JavaScript.

It made this IDE very friendly and useful for programmers.

- Profiling and Debugging Tools :

+ The NetBeans Profiler provides expert assistance for optimizing your application's speed and
memory usage, and makes it easier to build Java SE, JavaFX and Java EE applications.

+The NetBeans Debugger allows the developers place breakpoints in source code. Developers
can also attach the debugger into an already running process.
18

2.Visual studio IDE :13

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to
develop computer programs, as well as web sites, web apps, web services and mobile apps.

Visual Studio includes a code editor supporting IntelliSense (the code completion ) ,code refactoring.
The integrated debugger works both as a source-level debugger and a machine-level debugger.

* Some of Visual studio IDE ‘s features :

- IntelliSense : is Microsoft's implementation of code completion, best known in Visual Studio.


IntelliSense is now supported by the Visual Studio editors for C++, C#, J#, Visual Basic, XML,
HTML and XSLT.

The IDE has the capability of inferring a greater amount of context based on what the
developers is typing, to the point that basic language constructs such as for and while are also
included in the choice list. IntelliSense helps developers save a lot of time in the coding
process.

- The Microsoft Visual Studio Debugger : is a debugger that ships along with all versions of
Microsoft Visual Studio. Some of features of this debugger include:

+ Remote machine debugging

+ Attaching and detaching to and from processes.

+ Integrated debugging across programs written in .NET, C# , C++;

+ Advanced breakpoint features, including conditional, address, data breakpoints.

+Debugging ASP.NET Web Services.

- Code refactoring: is the process of restructuring existing computer code without changing its
external behavior. Code refactoring can help software developers discover and fix bugs or
vulnerabilities in the system by simplifying the underlying logic and eliminating unnecessary
levels of complexity.
19

Conclution

Through the report, the reader can define basic algorithms to carry out an operation and
outline the process of programming an application. Additionally the reader can also explain the
definition , characteristics of procedural, object-orientated and event-driven programming and
conduct an analysis of a suitable Integrated Development Environment (IDE).
20

Reference
1
En.wikipedia.org. (2018). Object-oriented programming. [online] Available at:
https://en.wikipedia.org/wiki/Object-oriented_programming[Accessed 11 Jun. 2018].

2
characteristics, A., characteristics, A., work?, H., Prevention, M., DBAs, H. and Oracle, C. (2018). Algorithm and its
characteristics. [online] Biyani Institute of Science and Management for Girls. Available
athttp://bisma.in/algorithm-and-its-characteristics/[Accessed 11 Jun. 2018].

3
En.wikipedia.org. (2018). Algorithm characterizations. [online] Available at:
https://en.wikipedia.org/wiki/Algorithm_characterizations#Features_of_a_Good_Algorithm [Accessed 11 Jun.
2018].

4
QArea Blog. (2018). 7 Stages of Software Development Cycle. [online] Available at: https://qarea.com/blog/7-
stages-software-development-cycle [Accessed 11 Jun. 2018].

5
En.wikipedia.org. (2018). V-Model (software development). [online] Available at: https://en.wikipedia.org/wiki/V-
Model_(software_development) [Accessed 11 Jun. 2018].

6
Www2.hawaii.edu. (2018). [online] Available at:
http://www2.hawaii.edu/~takebaya/ics111/process_of_programming/process_of_programming.html [Accessed
11 Jun. 2018].

7
C-sharpcorner.com. (2018). Code Execution Process. [online] Available at: https://www.c-
sharpcorner.com/UploadFile/8911c4/code-execution-process/ [Accessed 11 Jun. 2018].

8
En.wikipedia.org. (2018). Procedural programming. [online] Available at:
https://en.wikipedia.org/wiki/Procedural_programming[Accessed 11 Jun. 2018].

9
En.wikipedia.org. (2018). Object-oriented programming. [online] Available at:
https://en.wikipedia.org/wiki/Object-oriented_programming [Accessed 11 Jun. 2018].

10
En.wikipedia.org. (2018). Event-driven programming. [online] Available at: https://en.wikipedia.org/wiki/Event-
driven_programming [Accessed 11 Jun. 2018].

11
En.wikipedia.org. (2018). Integrated development environment. [online] Available at:
https://en.wikipedia.org/wiki/Integrated_development_environment [Accessed 11 Jun. 2018].

12
Netbeans.org. (2018). Top Reasons to Switch to the NetBeans IDE. [online] Available at:
https://netbeans.org/switch/why.html [Accessed 11 Jun. 2018].

13
En.wikipedia.org. (2018). Microsoft Visual Studio. [online] Available at:
https://en.wikipedia.org/wiki/Microsoft_Visual_Studio [Accessed 11 Jun. 2018].

You might also like