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

Program Title

The document discusses different programming concepts including algorithms, programming directions like procedural programming, object oriented programming, and event driven programming. It provides details on each concept like definitions, features, advantages and disadvantages.

Uploaded by

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

Program Title

The document discusses different programming concepts including algorithms, programming directions like procedural programming, object oriented programming, and event driven programming. It provides details on each concept like definitions, features, advantages and disadvantages.

Uploaded by

Yoo Hoo Bin
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

 

PROGRAM TITLE: …………………………………………… 

UNIT TITLE: …………………………………………………...

ASSIGNMENT NUMBER: …………………………………….

ASSIGNMENT NAME: ………………………………………..

SUBMISSION DATE: …………………………………………..

DATE RECEIVED: …………………………………………….



TUTORIAL LECTURER: ………………………………………

WORD COUNT: ………………………………………………..

STUDENT NAME: ………………………………………………

STUDENT ID: ……………………………………………………..

MOBILE NUMBER: ……………………………………………….


Summative Feedback: 
 

Internal verification: 

 
 
 
 
 

 
 
 
 
 
 
 

I. Introduction. 
II. Theory. 
1.Algorithm 
1.1 What is the algorithm.

-In basic terms, an algorithm is a set of well-defined steps or rules that you need to follow to obtain a
pre-determined result. For instance, when we talk about algorithms in computer programming, we
already have our input and we know the expected output. Now, an algorithm would be all the defined
steps to follow on the input to get the desired output. 

1.2 Purpose of the algorithm. 


-An algorithm is a sequence of computational steps that convert input data into output data into
output data. The System supports all types of algorithms: linear, branching, cyclic, and
auxiliary. 
The System uses algorithms to: 
 Fill in attributes 
 Filter items 
 Create conditions for the business process 
 Create actions for the business process 
 Transform reporting forms  
 Calculate indicators within methodologies 
1.3 The importance of algorithms. 
When it comes to computer programming, algorithms work in a similar manner. In layman’s language,
an algorithm can be defined as a step-by-step procedure for accomplishing a task. In the world of
programming, an algorithm is a well-structured computational procedure that takes some values as
input some values as output. Algorithms give us the most ideal option of accomplishing a task. Here is
some importance of algorithms in computer programming.

1. To improve the efficiency of a computer program. In programming, there are different ways of solving
a problem. However, the efficiency of the methods available vary. Some methods are well suited to give
more accurate answers than others. Algorithms are used to find the best possible way of solving a
problem. In doing so they improve the efficiency of a program. When it comes to programming,
efficiency can be used to mean different things. One of them is the accuracy of the software. With the
best algorithm, a computer program will be able to produce very accurate results. Another way of
looking at the efficiency of the software is speed. An algorithm can be used to improve the speed at
which a program executes a problem. A single algorithm has the potential of reducing the time that a
program takes to solve a problem.

2. Proper utilization of resources. A typical computer has different resources. One of them is computer
memory During the execution phase, a computer program will require some amount of memory. Some
programs use more memory space than others. The usage of computer memory depends on the
algorithm that has been used. The right choice of an algorithm will ensure that a program consumes the
least amount of memory. Apart from memory, the algorithm can determine the amount of processing
power that is needed by a program.

3. Algorithms. Given that we have mentioned the impact of an algorithm on resources, it will be
imperative to look at the cost. This is because each resource comes with a price tag. You can decide to
use an algorithm that will use the least resources. The leaner the resources, the less the cost.

1.4 Some representations of the algorithm.


- There are three methods to represent the algorithm:
• Use natural language.
• Use flowcharts.
• Use pseudocode.
1.5 The relationship between algorithms and programming languages.
- We learned that the main difference is between the two is that an algorithm is a step-by-step
procedure for solving the problem while programming is a set of instructions for a computer to
follow to perform a task. A program could also be an implementation of code to instruct a computer
on how to execute an algorithm.
1.7 Bubble sort.
import java.io.*;
 
class GFG
{
    // An optimized version of Bubble Sort
    static void bubbleSort(int arr[], int n)
    {
        int i, j, temp;
        boolean swapped;
        for (i = 0; i < n - 1; i++)
        {
            swapped = false;
            for (j = 0; j < n - i - 1; j++)
            {
                if (arr[j] > arr[j + 1])
                {
                    // swap arr[j] and arr[j+1]
                    temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                    swapped = true;
                }
            }
 
            // IF no two elements were
            // swapped by inner loop, then break
            if (swapped == false)
                break;
        }
    }
 
    // Function to print an array
    static void printArray(int arr[], int size)
    {
        int i;
        for (i = 0; i < size; i++)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
 
    // Driver program
    public static void main(String args[])
    {
        int arr[] = { 64, 34, 25, 12, 22, 11, 90 };
        int n = arr.length;
        bubbleSort(arr, n);
        System.out.println("Sorted array: ");
        printArray(arr, n);
    }
}
2 Programming directions. 
2.1 Procedural Programming. 
- Concept: Procedural Programming may be the first programming paradigm that a new developer
will learn. Fundamentally, the procedural code is the one that directly instructs a device on how to
finish a task in logical steps. This paradigm uses a linear top-down approach and treats data and
procedures as two different entities. Based on the concept of a procedure call, Procedural
Programming divides the program into procedures, which are also known as routines or functions,
simply containing a series of steps to be carried out. Simply put, Procedural Programming involves
writing down a list of instructions to tell the computer what it should do step-by-step to finish the
task at hand.
- Features of procedural programming: Procedural Programming comes with its own set of pros and
cons, some of which are mentioned below.
Advantages
• Procedural Programming is excellent for general-purpose programming
• The coded simplicity along with ease of implementation of compilers and interpreters
• A large variety of books and online course material available on tested algorithms, making it easier
to learn along the way
• The source code is portable, therefore, it can be used to target a different CPU as well
• The code can be reused in different parts of the program, without the need to copy it
• Through Procedural Programming technique, the memory requirement also slashes
• The program flow can be tracked easily Disadvantages
• The program code is harder to write when Procedural Programming is employed
• The Procedural code is often not reusable, which may pose the need to recreate the code if is
needed to use in another application • Difficult to relate with real-world objects
• The importance is given to the operation rather than the data, which might pose issues in some data-
sensitive cases
• The data is exposed to the whole program, making it not so much security friendly
There are different types of programming paradigm as we mentioned before, which are nothing but a
style of programming. It is important to understand that the paradigm does not cater to a specific
language but to the way the program is written. Below is a comparison between Procedural
Programming and Object-Oriented Programming.

2.2 Object Oriented Programming. 


Concept: OOP is an approach to programming which recognizes life as we know it as a collection of
objects, which work in tandem with each other to solve a particular problem at hand. The primary
thing to know about OOP is encapsulation, which is the idea that each object which holds the
program is self-sustainable, which means that all the components that make up the object are within
the object itself. Now since each module within this paradigm is self-sustainable, objects can be
taken from one program and used to resolve another problem at hand with little or no alterations.
- Features of object-oriented:
Advantages
• Due to modularity and encapsulation, OOP offers ease of management
• OOP mimics the real world, making it easier to understand
• Since objects are whole within themselves, they are reusable in other programs Disadvantages
• Object-Oriented programs tend to be slower and use up a high amount of memory
• Over-generalization
• Programs built using this paradigm may take longer to be created
2.3. Event-driven programming. 
Event-driven programming is a computer programming paradigm where control flow of the program
is determined by the occurrence of events. These events are monitored by code known as an event
listener. If it detects that an assigned event has occurred, it runs an event handler (a callback function
or method that's triggered when the event occurs). In theory, all programming languages support the
event-driven style of programming, although some language features, such as closures, make it easier
to implement. Other programming environments, such as Adobe Flash, are specifically tailored for
triggering program code by events.
- Features of event-driven programming:

Service Oriented
Service oriented is a key features in event-driven programming that used to write
programs that are made for services and it takes does not slow down the computer as
service oriented only consume little of the computer processing power and usually
services run in the background of OS.

Time Driven
In event driven programming, time driven is a paradigm, it’s a code that runs on a time
trigger, time driven can be a specific code that runs on a specific time, which could be
once an hour, once a week or once a month, this means it’s a pre-set to do task. For
example, windows update is the example of time driven, which user can set when to
update or when to check and download the update.

Event Handlers
Event handlers is a type of function or method that run a specific action when a specific
event is triggered. For example, it could be a button that when user click it, it will display
a message, and it will close the message when user click the button again, this is an
event handler.

Trigger Functions
Trigger functions in event-driven programming are a functions that decide what code to
run when there are a specific event occurs, which are used to select which event handler
to use for the event when there is specific event occurred.

Events
Events include mouse, keyboard and user interface, which events need to be triggered in
the program in order to happen, that mean user have to interacts with an object in the
program, for example, click a button by a mouse, use keyboard to select a button and
etc.
Simplicity of Programming and Ease of Development
Event-driven programming is simple and easier to program compared to other type of
programming as it’s very visual, for example you can place a button by just select it and
place it onto a form and write a code for it. Event-driven programming also easy for user
to insert a pre-written code scripts into an existing application because it allows user to
pause the code while it’s running. Which make developing using event-driven
programming is easy.

2.4 The relationship of programming directions. 

-Object oriented programming generally support 4 types of relationships that are: inheritance ,
association, composition and aggregation. All these relationship is based on "is a" relationship, "has-
a" relationship and "part-of" relationship.

2.5 Compare programming directions. 

3. IDE, Debug and some coding standards 


3.1. IDE & Text editor 
- Concept of IDE:

An IDE, or Integrated Development Environment, enables programmers to consolidate the different


aspects of writing a computer program. IDEs increase programmer productivity by combining
common activities of writing software into a single application: editing source code, building
executables, and debugging.

- Concept of Text editor: A text editor is a software program that allows users to input and edit text.
One main distinction in text editors is between those commonly called word processors used for
writing, and other more programming-oriented tools used for technical editing. The word processor
has replaced the typewriter as a way to generate print writing, and features items like margins, spell
check and fonts which accommodate different types of presentation for letters, documents, etc. By
contrast, a rougher text editor serving a Unix environment or other less 'literary’ editing environment
will have different text editing features, with fewer of the bells and whistles used by less technical
users to present writing in a digital document or desktop publishing format. More technical text
editing tools like notepad and other utilities are more meant for storing data than for presenting text,
and come with their own specific limitations in terms of presentation. - How IDEs help in application
development:

- Advantages and disadvantages of IDE: Defect: Software is difficult to install and consumes
memory space of the computer.

- Advantages and disadvantages of IDE: -

- Compare the advantages and disadvantages of developing software using IDE and developing
software without using IDE
3.2 Debug.

- Debugging is the process of finding out the error or the cause of the error (where the bug is) to have
a direction to fix the error (fix the bug). Error control of many lines of code is not easy for
inexperienced programmers.

- The purpose of Debug is not only to remove errors from the program, but more importantly, to help
the programmer better understand the execution of the program. A programmer without the ability to
debug effectively is like being blind.

- Debugging is not only to remove errors from the program, but also to help programmers better
understand the program and the software that is running. Therefore, debugging is also an ability used
to assess the level of programmers.

- Example of a debugging process (including processing and results):

3.3 Coding standards.

- Simply put, coding is the act of writing code, generating the underlying code in a programming
language. Coding ensures that the computer understands the instructions, thereby handling the coding
and performing the desired actions by the programmer. Each script executes a specific action.

- Coding Standards are a set of rules that specify how to write the code of a program that
programmers must follow when participating in a project to develop that program. Depending on the
project, there will be different standards, that set of rules includes:

• Set class name, interface, variable name, method.

• Whitespace, tab.

• Declare and use variables.

• Declare and use Comment source code: creator name, version, file creation date, class, method,
changer, changed content.

• Maximum length per line of code, per file.

-Coding standards are a very important component in software development. However, it is often
ignored or applied only at the beginning, then forgotten later. A consistent coding standard will help
improve the quality of the overall software system. The key to a good coding standard is consistency.

- A coding standard ensures that all developers writing the code in a particular language write
according to the guidelines specified. This makes the code easy to understand and provides
consistency in the code. One of the most essential factors in a software system is the consistency of
the coding standard

You might also like