Algorithms and Programming Paradigms in Software Development, Thesis of Programming Paradigms

A comprehensive overview of algorithms and programming paradigms in software development. It covers key concepts such as algorithm definition, code generation, compiler roles, and the differences between algorithms and code. The document also explores procedural and object-oriented programming languages, highlighting their characteristics and differences. Additionally, it delves into event-driven paradigms and the features of integrated development environments (ides).

Typology: Thesis

2023/2024

Uploaded on 10/24/2024

shanthi_48
shanthi_48 🇺🇸

4.8

(36)

891 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Implementing Algorithms and
Programming Paradigms in
Software Development
Algorithms and Their Implementation
Definition of an Algorithm
Technically, computers use algorithms to list the detailed instructions for
carrying out an operation. For example, to compute an employee's paycheck,
the computer uses an algorithm. To accomplish this task, appropriate data
must be entered into the system.
Writing Algorithms to Carry Out Operations
Sorting refers to arranging data in a particular format. A sorting algorithm
specifies the way to arrange data in a particular order. The most common
orders are in numerical or alphabetical order.
Sorting algorithms are concepts that every competitive programmer must
know. Sorting algorithms can be used for collections of numbers, strings,
characters, or a structure of any of these types.
Some common sorting methods include:
Bubble Sort
Bubble sort is based on the idea of repeatedly comparing pairs of adjacent
elements and then swapping their positions if they exist in the wrong order.
It basically means swapping the adjacent elements if they are in the wrong
order.
Insertion Sort
Insertion sort is a simple sorting algorithm that works the way we sort
playing cards in our hands when we are shuffling them. It involves building
the final sorted array (or list) one item at a time.
Selection Sort
The Selection sort algorithm is based on the idea of finding the minimum or
maximum element in an unsorted array and then putting it in its correct
position in a sorted array.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Algorithms and Programming Paradigms in Software Development and more Thesis Programming Paradigms in PDF only on Docsity!

Implementing Algorithms and

Programming Paradigms in

Software Development

Algorithms and Their Implementation

Definition of an Algorithm

Technically, computers use algorithms to list the detailed instructions for carrying out an operation. For example, to compute an employee's paycheck, the computer uses an algorithm. To accomplish this task, appropriate data must be entered into the system.

Writing Algorithms to Carry Out Operations

Sorting refers to arranging data in a particular format. A sorting algorithm specifies the way to arrange data in a particular order. The most common orders are in numerical or alphabetical order.

Sorting algorithms are concepts that every competitive programmer must know. Sorting algorithms can be used for collections of numbers, strings, characters, or a structure of any of these types.

Some common sorting methods include:

Bubble Sort

Bubble sort is based on the idea of repeatedly comparing pairs of adjacent elements and then swapping their positions if they exist in the wrong order. It basically means swapping the adjacent elements if they are in the wrong order.

Insertion Sort

Insertion sort is a simple sorting algorithm that works the way we sort playing cards in our hands when we are shuffling them. It involves building the final sorted array (or list) one item at a time.

Selection Sort

The Selection sort algorithm is based on the idea of finding the minimum or maximum element in an unsorted array and then putting it in its correct position in a sorted array.

Qualities of a Good Algorithm

An algorithm should not have computer code. Instead, the algorithm should be written in such a way that it can be used in similar programming languages.

Processes of an Algorithm when Building an Application

Design

The first stage is to identify the problem and thoroughly understand it. This is where it's important to consult with everybody who has an interest in the problem. Speak with them and see how they see the problem and what they need out of the solution so their part of the project or program can progress.

This is also the point where you are going to flowchart and/or use pseudo- code to work out the detailed problems of solving the flow of operations within the code.

Analyze

Once you have the basic framework of the algorithm, it's time to start analyzing how efficient the code is in solving the problem. Algorithm design is fluid and subject to individual plans. This is a step that some programmers like to attack after they have coded the algorithm and run it through the compiler. Others prefer to examine it prior to writing the code and analyze results based on their expectations from the design stage.

Either way, what you are doing is looking for the efficiency of the algorithm. Algorithms are measured in time and space for their efficiency. Look at the algorithm you're designing and see how it works with different size data structures and what kind of time it takes to work through those structures. The problem here is deciding when the algorithm has reached maximum efficiency for the project and produces acceptable results.

Implement

Writing and coding the algorithm is the next step in the process. If you are the one writing the algorithm, then you need to write it in the coding language you understand the best. In order for you to know how to write the algorithm efficiently, you have to know exactly what each line of code is going to accomplish when the program is executed. Write the code to execute quickly but can also handle the input data that it will receive.

Experiment

Once the algorithm is designed and coded, go back and experiment with different variables in the algorithm. Try and enter data that will make it fail, or try and rewrite the code to work it out most efficiently. Experimentation in algorithmic design is really just another step of the analyzing of the

Macro expansion - Macros can be called as minor functions that are not as above to process. If we have to write a function (having a small definition) that needs to be called recursively (again and again), then we should prefer a macro over a function. So, defining these macros is done by preprocessor.

Compiler

The work of a compiler is to analyze and convert the code written by you into something that is understandable by the machine. So a compiler takes your human readable code and converts it into machine code which is then executed by your machine.

Roles of a Compiler

Compilers reads the source code, outputs executable code Translates software written in a higher level language into instructions that a computer can understand. It converts the text that a programmer writes into a format the CPU can understand. The process of compilation is relatively complicated. It spends a lot of time analyzing and processing the program. The executable result is some form of machine-specific binary code.

Linker

A linker is a computer program that links and combines numerous object files together in order to make an executable file. All these files might have been compiled by separate assemblers. The main task of a linker is to search and locate referenced module/routines in a program and to determine the memory location where these codes will be loaded, making the program instruction to have absolute references. Linker has two main functions which are:

Resolving external references - It resolves external references by locating the definitions of the referenced symbols. Relocation - It relocates code and data sections and modifies symbol references to the relocated memory location.

Interpreter

An interpreter translates code like a compiler but reads the code and immediately executes on that code, and therefore is originally faster than a compiler. Therefore, interpreters are often used in software development tools as debugging tools, as they can execute a single line of code at a time.

Roles of an Interpreter

The interpreter converts the source code line-by-line during RUN Time. Relatively less time spent for analyzing and processing the program Program execution is relatively slow compared to compiler

Relationship between the Written Algorithm

and the Code Variant

The easiest way to tell the machine what to actually do is called an algorithm. In my opinion, it is the set of rules to solve a problem in various ways. For example, the algorithm to add two integers is:

START Define variable A, B Give inputs A=2, B= Make the formula: SUM = A+B

This was just a detailed way to solve a simple problem. And this was also an algorithm. It is no different than coding. We also apply algorithms for real world problems but we don't notice it as our brain does it for us without letting us even notice. For example, when you want to make coffee:

Start

Boil water Prepare a mug Put a teaspoon of coffee and sugar Pour hot water Stir End

Therefore, when coding you need to create a lot of algorithms, it's the easiest way to solve a problem.

Difference between Algorithm and Code

An algorithm is a systematic logical approach used to solve problems in a computer while Pseudocode is the statement in plain English which may be translated later into a programming language. Pseudocode as I understand is an intermediary between an algorithm and implemented program. An algorithm could be a series of steps for determination a tangle, finishing a task for activity a calculation. Algorithms are unit typically dead by pc programs however the term can even apply to steps in domains admire arithmetic for human drawback determination. Code could be a series of steps that might machines will execute. In several cases, code consists in an exceedingly extremely high level language that's then mechanically translated into directions that machines perceive. An algorithm is a well-designed series of steps for solving a big problem. Code is instructions for machines to execute.

Features of Object-Oriented Language

Emphasis on data rather than procedure Programs are divided into entities known as objects Data Structures are designed such that they characterize objects Functions that operate on data of an object are tied together in data structures Data is hidden and cannot be accessed by external functions Objects communicate with each other through functions New data and functions can be easily added whenever necessary Follows bottom up design in program design

Difference between Procedural Language and

Object-Oriented Language

Procedural Oriented Programming

In procedural programming, program is divided into small parts called functions. Procedural programming follows top down approach. There is no access specifier in procedural programming. Adding new data and function is not easy. Procedural programming does not have any proper way for hiding data so it is less secure. In procedural programming, overloading is not possible. In procedural programming, function is more important than data. Procedural programming is based on unreal world.

Object-Oriented Programming

In object oriented programming, program is divided into entities known as objects. Object oriented programming follows bottom up design. Object oriented programming have access specifiers. Adding new data and function is easy. Object oriented programming provides way for hiding data so it is more secure. Overloading is possible in object oriented programming. In object oriented programming, data is more important than function. Object oriented programming is based on real world.

Examples

Procedural Programming: C, FORTRAN, Pascal, Basic etc. Object-Oriented Programming: C++, Java, Python, C# etc.

Procedural Programming

Procedural programming is a programming paradigm that uses a linear or top-down approach. It relies on procedures or subroutines to perform computations. Procedural programming is also known as imperative programming.

Principals and Characteristics of Procedural Programming

MODULARISATION - is the process of subdividing a computer program into separate and different sub-programs. Enables programmers to divide up the work and debug pieces of the program independently.

SCOPING - refers to the visibility of variables. On short parts of the program which are visible and can be accessed.

INSTRUCTIONS - An instruction is a segment of code that contains steps that need to be executed by the computer processor. For a computer to do something, instructions have to be given to the computer.

APPLICATIONS - Is a program designed to perform a specific function directly for the user or in some cases for another application program? Examples of applications are word processor, database programs, and web browser. Applications use the service of the computer's operating system and other supporting applications variables. The variable can represent numeric data, text or graphical images.

Features of Procedural Programming

Commands - A command is an instruction given by the user instructing the computer to do something such as running the program.

Error Checking - This will check if there are mistakes in the program if there are it will alert the user for the error.

Variable - This is an exclusive concept that stores values entered by the user of the programming hardware memory cell.

Event-Driven Paradigms

Event-driven programming is a programming paradigm in which the flow of program implementation is determined by events - for example a user action such as a mouse click, key press, or a message from the operating system or another program. An event-driven application is designed to detect events as they occur, and then deal with them using an appropriate event handling procedure. The idea is an extension of interrupt-driven programming of the kind found in early command-line environments such as DOS, and in embedded systems (where the application is implemented as firmware).

features save developer's time writing code and reduce the likelihood of typos and bugs.

Data Types : Unlike humans, a computer does not know the difference between '1234' and 'abcd.' A data type is a classification that dictates what a variable or object can hold in computer programming. Data types are an important factor in virtually all computer programming languages, including C#, C++, JavaScript, and Visual Basic. When programmers create computer applications, both desktop and web-based, data types must be referenced and used correctly to ensure the proper result and an error-free program.

There are two types of data types in Java: 1. Primitive data types 2. Non- primitive data types

There are 8 types of primitive data types: - Boolean data type - Short Data Type - Int Data Type - Long Data Type - Float Data Type - Double Data Type - Char Data Type

User-defined Methods : Standard Library Methods The standard library methods are built-in methods in Java that are readily available for use. These standard libraries come along with the Java Class Library (JCL) in a Java archive (*.jar) file with JVM and JRE.

User-defined Method You can also define methods inside a class as per your wish. Such methods are called user-defined methods.

Control Structures : A control structure is a syntactic form in a language to express flow of control. A sequence of statements is executed depending on whether or not the condition it is true or false. This means the program chooses between two or more alternative paths. Hence it is the basic decision making process in computer programming; flow control determines how a computer will respond when given certain conditions and parameters.

Iteration : is a technique used to sequence through a block of code repeatedly until a specific condition either exists or no longer exists. Iterations are a very common approach used with loops. You can also use iteration as an approach to the name reversal and factorial functions.

Scope : The scope of a variable specifies the region of the source program where that variable is known, accessible and can be used. In Java, the declared variable has a definite scope. When a variable is defined within a class, its scope determines whether it can be used only within the defined class or outside of the class as well.

Parameter Passing

There are different ways in which parameter data can be passed into and out of methods and functions. Let's assume that a function B() is called from another function A(). In this case, A is called the "caller function" and B is called the "called function or callee function". Also, the arguments which A sends to B are called actual arguments and the parameters of B are called formal arguments.

Classes

A class is a user-defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type. In general, class declarations can include these components, in order:

Modifiers: A class can be public or has default access (Refer this for details). Class name: The name should begin with a initial letter (capitalized by convention). Superclass (if any): The name of the class's parent (superclass), if any, preceded by the keyword extends. A class can only extend (subclass) one parent. Interfaces (if any): A comma-separated list of interfaces implemented by the class, if any, preceded by the keyword implements. A class can implement more than one interface. Body: The class body surrounded by braces, { }.

Inheritance

This is a mechanism in which one object acquires all the properties and behaviors of a parent object. The idea behind inheritance in Java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class.

Events

An event is a signal received by a program from the operating system as a result of some action taken by the user, or because something else has happened. Here are some examples:

The user clicks a mouse button. The user presses a key on the keyboard. The user closes a window. Some data from the Internet arrives at one of the computer's 'ports.

Object-oriented implementation in Java

The object-oriented programming paradigm introduced mechanisms required to obtain modular software design and reusability compared to universal accessibility of implementations by imperative programming. The main part of the object-oriented paradigm is related to the introduction of classes which cover basic properties of concepts to be implemented. Based on this description of properties, an object is created, which can be briefly explained by a self-governing unit of information which actively communicates with other objects. This is the main difference compared to a passive access as used in imperative programming languages. The concept of inheritance was introduced due to the fact that a particular concept, e.g., a mathematical $n$-dimensional vector, cannot be described in its generality by a single class. By inheritance, semantically related concepts can be

Display a menu prompting the user to enter the amount of cash they want to withdraw. If the user has insufficient funds, an error message is displayed. It goes back to step 10. If the user has sufficient funds, a message saying "Successful Transaction, Do you want to Print a receipt?" pops up. If the user clicks No on the message, it goes back to the main menu. If the user clicks Yes on the message, a message pops up with the transaction details. It goes back to the main menu when OK is clicked on the message. If the user chooses "Fast Cash" on the withdraw cash menu, go to step

Display a menu prompting the user to choose an amount of cash from the list that they want to withdraw. If the user has insufficient funds, an error message is displayed. It goes back to step 15. If the user has sufficient funds, a message saying "Successful Transaction, Do you want to Print a receipt?" pops up. If the user clicks No on the message, it goes back to the main menu. If the user clicks Yes on the message, a message pops up with the transaction details. It goes back to the main menu when OK is clicked on the message. If the user select "Transfer cash" on the main menu, go to step 20. A menu pops up prompting the user to key in an account number and the cash amount. If the user has insufficient funds, an error message is displayed. It goes back to step 20. If the user has sufficient funds, a message saying "Successful Transaction, Do you want to Print a receipt?" pops up. If the user clicks No on the message, it goes back to the main menu. If the user clicks Yes on the message, a message pops up with the transaction details. It goes back to the main menu when OK is clicked on the message. If the user select "Deposit cash" on the main menu, go to step 25. A menu pops up prompting the user to key in the cash amount that they want to deposit. If the user keys in 0 or no amount, an error message is displayed. It goes back to step 25. If the user has keyed in a valid amount, a message saying "Successful Transaction, Do you want to Print a receipt?" pops up. If the user clicks No on the message, it goes back to the main menu. If the user clicks Yes on the message, a message pops up with the transaction details. It goes back to the main menu when OK is clicked on the message. If the user selects "Current balance" on the main menu, go to step 30. A menu appears that has all the details of the user and their current balance in the bank account. If the user selects "Mini statement" on the main menu, go to step 31. A menu appears that shows the previous 10 transactions made by the user. It would include the date, account number and the transaction type.

If the user selects "Logout" on the main menu¸ they would exit the system.

Use the IDE to manage the development process of the

program (M3)

User must enter the username and password for login purposes.

The user then can choose from the options above.

The user is able to withdraw cash.

The user is able to transfer cash.

The user is even able to deposit cash.

The user is also able to check their mini statement.

Finally, the user is even able to logout.

Evaluate the use of an IDE for development of applications

contrasted with not using an IDE (D3)

Less time and effort: The entire purpose of an IDE is to make developing faster and easier. Its tools and features are supposed to help you organize resources, prevent mistakes, and provide shortcuts. Enforce project or company standards: Simply by working in the same development environment, a group of programmers will adhere to a standard way of doing things. Standards can be further enforced if the IDE offers predefined templates, or if code libraries are shared between different team members/teams working on the same project. Project management: This can be twofold. First, many IDEs have documentation tools that either automate the entry of developer comments, or may actually force developers to write comments in different areas. Second, simply by having a visual presentation of resources, it should be a lot easier to know how an application is laid out as opposed to traversing the file system for arcane files in the file system.

Every IDE supports a specific set of languages. Some of the bigger name IDEs support just about every language you could ever want, while others are meant for a single language or a small subset of languages. (A great example is Xcode, Apple's native IDE, which supports all languages that are used to develop Apple products.)

An IDE has complementing features meant to help web developers accomplish tasks with higher productivity. For example, when using an IDE, programmers can access databases or automatically write code to create a graphical user interface (GUI). Furthermore, some IDEs provide suggested ways to complete strings of code. That means you don't have to type the entire line and save time.

Outline the coding standard you have used in your code

(P5)

What is a coding standard? This is a document tells developers how they must write their code. Instead of each developer coding in their own preferred style, they will write all code to the standards outlined in the document. This makes sure that a large project is coded in a consistent style — parts are not written differently by different programmers. Not only does this solution make the code easier to understand, it also ensures that any developer who looks at the code will know what to expect throughout the entire application.

The coding standards I have used in my code:

Classes: Usually class name should be in noun starting with uppercase letter. If it contains multiple word then every inner word should start with uppercase.

Coding Standards and Conventions

Methods Naming Conventions

The method name should either be a verb or a verb in a combination starting with a lowercase letter. If the method name contains multiple words, then every inner word should start with an uppercase letter.

Coding Standards for Variables

Usually, the variable name should be a noun starting with a lowercase letter. If the variable name contains multiple words, then every inner word should start with an uppercase letter.

File Names and Organization

Naming conventions allow searching and navigation across files. Example: C header files. Style guides specify how elements are ordered within a file. Java example: class variables, instance variables, constructors, methods.

Indentation

Space is made reference to on the whole commitment to composing measures at some level. In a few dialects, space is utilized by the compiler to recognize the extent of capacities. In freestyle dialects, similar to Java, it's no genuine effect on the accumulation of code itself, and is just acclimated to make the code a

ton of human understandable, giving an indication of degree while not by any means impactful the program specifically.

Commenting Code

In PC programming, a remark could be a developer comprehensible legitimization or comment inside the ASCII content archive of a Trojan steed. They're other with the point of developing the ASCII content record less requesting for individuals to know, and zone unit typically dismissed by compilers and mediators.

Variable Revelations

To proclaim a variable in Java, all that is required is that the learning kind pursued by the variable name: Int number of Days; inside the over precedent, a variable alluded to as number of Days has been pronounced with a data style of Int.

Rearrange Complex Information

Substitute complex simple contributions with advanced, manufactured, known, and repeatable information. In the event that an including plan works to begin, utilize an including plan. For calculations with coefficients, (for example, channels), supplant the creation coefficients with a more straightforward course of action of coefficients, (for example, each of the zeros aside from one full-scale coefficient).

Back the Procedure Off

Slow down timekeepers and information rates. Maybe some planning prerequisite isn't being met. Perhaps one calculation isn't synchronized with another. Maybe one of the calculations that should be information driven was coincidentally coded to be clockdriven. Or on the other hand perhaps one gadget is endeavoring to push data too rapidly to another.

Make Disconnected Models

These models should coordinate as nearly as conceivable the continuous calculation, for bit-level assessment. This is generally important for noninstinctive changes, (for example, network tasks) where it's excessively testing, making it impossible to comprehend what the yield should look like with respect to the info. In the event that the continuous calculation is settled point and the separated calculation is skimming point, there might be little disparities that amass and cause issues.

Easy to Maintain

If the coding standards are followed, the code is consistent and can be easily maintained. This is because anyone can understand it and can modify it at any point in time.

Bug Rectification

It becomes really easy to locate and correct bugs in the software if the source code is written in a consistent manner.

A Comprehensive Look

If the source code maintains consistency, a clear view of how code fits in the larger application or fits into the company as a whole.

Cost-Efficient

A clear code gives the developers an opportunity to reuse the code whenever required. This can radically reduce the cost along with the efforts put in the development.

For the Team

Well documented coding standards will aid the creation of 'Test Scripts'. Having reviewed the source code and tested an application based on compliance to coding standards, it added strong direction to ensure quality of the software product. Because code standards implement traceability, the item ids can be used to describe a violation in the 'Test Results' document that both developers and testers are familiar with. Lesser manhour consumption as the sum of all efforts implementing coding standards.

Evaluation of Coding Standard in an

Individual

Advantages

Improved Code Quality Increased Productivity Easier Maintenance Reduced Bugs Consistent Coding Style Improved Readability Easier Collaboration

Faster Onboarding of New Developers Reusability of Code

Disadvantages

Initial Overhead Potential Rigidity Resistance to Change Difficulty in Enforcing Standards

References: - Janssen, n.d. www.techopedia.com. - Christopher, P., 2006. www.techterms.com. - Retrieved from govst.edu: http://www3.govst.edu/ hptadvanced/http/Dawn_SRD/website/Algorithm%20Workbook.pdf - Economictimes. Retrieved from Econoictimes.indiatimes.com: https:// economictimes.indiatimes.com/definition/debugging - Jane, G., 2013.