# Assignment I will explain what an algorithm

Assignment name: Assignment 1

Student name: Le Minh Huong

We Will Write a Custom Essay Specifically
For You For Only \$13.90/page!

order now

Student ID: GBH17538

Tutor: Doan Trung Tung

Introduction. 3
I.       Algorithm.. 3
1.      Definition, characteristics and example of algorithm.. 3
2.      Criteria and example of a good algorithm.. 4
3.      Seven steps of building an application. 5
4.      From coding to execution. 6
1.      Introduction to some program paradigm and their characteristics. 7

Introduction

I am currently working for a software company that produces software and as a part of the research and development branch and my mission includes investigation into new processes that can benefit the company. In this report, I will go into the definition of algorithm, use of algorithms and how they can be used to build more efficient software. I will explain what an algorithm is, with examples of their use, comparing their efficiency, and how it will relate to the application development process, down to the implementation in a suitable language.

In the light of the task which is to further investigate how to build more efficient, secure software, I will also look into programming paradigms and the advantages and disadvantages of using different programming language approaches; including explanation of each paradigm, analysis of suitable IDEs, and an evaluation of source code that would be generated for an application.

I.            Algorithm

1.      Definition, characteristics and example of algorithm

First of all, let us talk about some of the famous algorithms: Have you ever wonder how Google Maps can show us the fastest route to get to a destination when we enter the starting point? Or how the scientists at NASA can adjust the solar panels on satellites to align with the sun? That’s because they use route finding and scheduling algorithms. So what is an algorithm? One definition might be a step-by-step process aims to solve a problem or to accomplish a task. You may have an algorithm to bake a cake, or to change a flat tire, but in the light of computer science, an algorithm is a series of steps for a computer program to complete a given task. Algorithms put science in the “computer science”, and applying the right algorithm can help you write useful and efficient programs while saving efforts and time.

A well-structured and quality algorithm usually possess these five characteristics below:

–          Finite: An algorithm must always solve the problem after a specific number of steps. They do not go on for indefinitely but end up stopping at some point.

–          Definite: Each step of an algorithm must be precisely defined. They cannot be confusing or have multiple interpretations.

–          Precise and Effective: An algorithm must be effective, as in all the operations performed must be done exactly and achieve the final goal.

–          Input/ Output: An algorithm must have the ability to receive zero or more input and produces one or more output.

–          Implementation independent: An algorithm can be used to solve a class of problems with the same set of input.

Though most algorithm are intended to be implemented as computer program, they can also be implemented in other ways, even in the ordinary activities of our daily lives. This chocolate cookie recipe below is an example:

The algorithm is described from step one to step nine. The input data is the specific amount of ingredients, what kinds of tools we need. The output is twelve chocolate chip cookies. All the steps are defined and in the correct order, and the algorithm ends after we have completed all the steps above. The implementation independence of this recipe lies in the fact that with this recipe, we can also produce other kinds of cookies with a variant of toppings, for both vegetarians and non-vegetarians, etc.

2.      Criteria and example of a good algorithm

Most of the time, we want an algorithm that can give us an answer that we know is always correct. Sometimes, we can live with an algorithm that doesn’t necessary give us the correct answer because we know the best answer to this problem take a really long time to execute. A single problem can have many solutions to it, and therefore, many algorithms. Choosing the suitable algorithm will help simplify the coding process and create a more effective program. There are three basic criteria when it comes to choosing a good algorithm.

–          Complete given task correctly as long as the input data is compatible.

–          Operate effectively with the least steps possible.

–          Provide the simplest solution.

With the criteria above, we can conclude that yes, some algorithms are simply better than others.

Above are two possible solution to the same problem, which is to check if a collection of numbers contains only positive numbers. Both succeeded in solving the problem in a finite number of steps, have the ability to receive input and produces output. However, the first solution reach conclusion by finding out which number is the smallest in the collection first, then compare it to zero, while the second just compare each number to zero only once and for all. The first one requires almost twice as much steps and not as efficient and swift as the second, so you may say that the second algorithm is a good, or better algorithm.

3.      Seven steps of building an application

The use of computer to solve a problem is often incorrectly conceived, simply because many thought the process is just pure programming. However, it is actually a complex procedure that involves several stages of development. The key steps to developing a program are hereby listed below:

Step 1: Define and analyze the problem: the first step is to accurately address the problem and to clarify the user’s requirements. Once the problem has been looked into, the programmer will establish a relationship between the input and the output data.

Step 2: Design (Building an algorithm): Establish an algorithm to the problem. There may be various ways to solve the problem but the chosen algorithm should meet all the requirements of a good algorithm.

Step 3: Coding: Build the program based on the established algorithm.

Step 4: Document the program: Programmer can either embed part of the documentation in the source code or write a report that comes with the program. This document should explains to users how the program operate.

Step 5: Compile and run the program: Using a compiler, the programmer will translate the source code language into another desired computer language.

Step 6: Test and debug: Run the program in order to find defects and decipher whether the program is ready to be put to use.

Step 7: Maintenance: Make adjustments to the program after a period of usage to improve performance.

4.      From coding to execution

This analogy comes really close to the way compiler program work with computer. A compiler translates statements written in high level programming language and translate them into low level machine language that the computer can understand. They may take extra preparation time before the program can run because they are processing the entire source code, but when it is done, the program runs very quickly and efficiently.

In C#, the compiler works in the same regime. Firstly, it compiles the C# source files, its resources and references into the dot-net assembly. This assembly contains the Intermediate Language (IL) and the metadata information about the assembly. Then the common language runtime (CLR) loads the assembly when you start a dot-net process and the JIT compiler converts it into native machine code. After that, this native code is executed by the Operating System and the program will produces output according to your request.

1.      Introduction to some program paradigm and their characteristics

Paradigms, in their simplest form, can be understood as models, patterns or ways to do something. Therefore, programming paradigms are basically ways to complete taks and to classify programming languages based on their characteristics:

–          Imperative Programming: Uses statements to change the state of a program and mostly target on depicting how a program works. Includes procedural programming, object-oriented programming etc.

–          Declarative Programming: Uses descriptive language to describe the issues, emphasize on the expected results rather than the process in which said results are obtained. Includes functional programming, logical programming etc.

On to the main point, here are the three main programming paradigms:

1.      Procedural paradigm: Program paradigm that includes a continuous process and a sequence of programming instructions. An important characteristic of a procedural paradigm is the separation of functionality into procedures that can operate similar to a computer program themselves, but on a smaller scale. All of these claimed procedures can be called at any entry point during the program’s operation, and can also call other procedures. Some of the main feature of this paradigm includes: local variables, sequence, selection, iteration and modulation. Procedural programming is the most innate way to write a computer program and it is very suitable for small projects.

2.      Object-oriented paradigm: Program paradigm where the program is built according to the information it maneuvers, rather than the process it does. It is the data that go in and out of the program that help shape it, not the logical procedures. An object-oriented program treats datafield as objects that can be controlled through predefined methods. These methods help an object approach and sometimes adjust the data of another object correlated to them. Some of the key definitions related to this paradigm are objects, methods, message passing, information hiding, data abstraction, encapsulation, polymorphism, inheritance, and serialization-marshalling.

3.      Event-driven paradigm: Program paradigm in which the program work base on the response to triggering events such as such as user’s actions, a message transmission etc. In a program written in event-driven fashion, there is usually a main loop that senses these events, and then activates a callback function when one of these events is recognized. Main features of this paradigm are main loop, event handlers and asynchronous processes. Event-driven programming is the preeminent paradigm used in programs that mostly involves implementing specific actions to reply to user input.

III.            Integrated Development Environment (IDE)

1.      Common features of IDE

Integrated Development Environment (IDE), also known as Integrated Design Environment or Integrated Debugging Environment is a type of computer software that provides basic tools to programmers for software development. Typically, an IDE contains a code editor, a compiler/ interpreter and a debugger that the developer accesses through a single graphical user interface (GUI). An IDE may be a standalone application, or it may be included as part of one or more existing and compatible applications.

Most IDEs typically includes:

–          Source code editor: A text editor program designed specifically for editing source code of computer programs by programmers. It’s the most fundamental programming tool, as the job of a programmer is to write and edit source code. Most source code editor now have features specifically designed to simplify and speed up the coding process (syntax highlighting, indentation, autocomplete, brace matching, etc.)

–          Compiler/Interpreter: Tool that help either translate the source code to the target language or directly execute instructions written in source code without requiring them to be compiled in machine language.

–          Debugger: A tool whose purpose is to identify the bug in the program and either correct the problem or suggest a solution to the programmer. Debugging is part of the software testing process and is an integral part of the entire software development lifecycle. The debugging process starts as soon as code is written and continues in successive stages as code is combined with other units of programming to form a software product.