Docsity

Understanding Abstract Data Types (ADTs) and Their Role in Software Development, Study Guides, Projects, Research of Data Structures and Algorithms

Toggle sidebar
bg1
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 19: Data Structures and Algorithms
Submission date 10/10/2023
Date Received 1st
submission
Re-submission Date Date Received 2nd
submission
Student Name Phan Tuan Manh Student ID BH00210
Class IT0503 Assessor name Ta Quang Hieu
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P1 P2 P3 M1 M2 M3 D1 D2
1 | P a g e
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c

Partial preview of the text

Download Understanding Abstract Data Types (ADTs) and Their Role in Software Development and more Study Guides, Projects, Research Data Structures and Algorithms in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 19: Data Structures and Algorithms

Submission date 10/10/2023 Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Phan Tuan Manh Student ID BH

Class IT0503 Assessor name Ta Quang Hieu

Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that

making a false declaration is a form of malpractice.

Student’s signature

Grading grid

P1 P2 P3 M1 M2 M3 D1 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:

Internal Verifier’s Comments:

IV Signature:

I. Introduction

In the ever-evolving landscape of software development, innovation and efficiency are key drivers of

success. As an in-house software developer at Softnet Development Ltd, a renowned provider of

network provisioning solutions, I find myself immersed in a compelling scenario. Our company is an

integral part of a collaborative service provisioning development project, and I have proudly secured the

contract to design and develop a middleware solution that will serve as the crucial interface connecting

multiple computer provisioning interfaces, including SOAP, HTTP, JML, and CLI, with the telecom

provisioning network at the back end via CLI.

Within this challenging context, my account manager has entrusted me with a special role: to guide and

inform our team on the intricacies of designing and implementing abstract data types (ADTs). This

assignment calls for the creation of a presentation that will be shared with our esteemed collaborating

partners, shedding light on how ADTs can be harnessed to enhance every aspect of software

development, from design to testing.

Moreover, I have been tasked with crafting an introductory report, which will be distributed to all project

partners. This report aims to provide a comprehensive understanding of how to specify abstract data

types and algorithms using a formal notation. It will delve into the core principles of ADTs and their

potential to elevate software engineering practices.

The primary objectives of this report are as follows:

1. Explanation on how to specify an abstract data type using the example of a software stack:

In this report, I will elucidate the process of defining and specifying an abstract data type, employing

the practical example of a software stack. This will serve as a foundation for comprehending the broader

concepts related to ADTs.

2. Explanation of the advantages of encapsulation and information hiding when using an ADT:

One of the core principles of ADTs is encapsulation, which promotes the concealment of

implementation details. I will explore the significance of encapsulation and information hiding in the

context of ADTs, highlighting the benefits they bring to software development.

3. Discussion of imperative ADTs with regard to object orientation:

As software development embraces object-oriented paradigms, it is crucial to assess how imperative

ADTs fit into this landscape. This report will engage in a thoughtful discussion, offering insights into the

relationship between imperative ADTs and object orientation.

Through this report, I aim to provide a comprehensive foundation for understanding and harnessing the

power of abstract data types in the realm of software development. Together, I will embark on a journey

to explore the intricacies of ADTs and their transformative potential in shaping the future of software

engineering.

is implemented using Tree map, hash map, or hash table ( Abstract data type in data structure -

javatpoint ).

The process of providing only the essentials and hiding the details is known as abstraction.

Figure 1 : Abstract Data Type.

The user of data type does not need to know how that data type is implemented, for example, we have

been using Primitive values like int, float, char data types only with the knowledge that these data type

can operate and be performed on without any idea of how they are implemented.

So a user only needs to know what a data type can do, but not how it will be implemented. Think of ADT

as a black box which hides the inner structure and design of the data type ( geeksforgeeks, 2023).

To further elucidate the concept of an Abstract Data Type (ADT), we will employ the example of a

software stack. A stack is a prime illustration of an ADT, showcasing its essential characteristics.

  1. Stack ADT

To underscore the definition of an Abstract Data Type (ADT), we'll delve into the example of a software

stack. A stack serves as an exemplary manifestation of the ADT concept.

As previously outlined, an ADT is an abstract programming notion. It describes a set of data and

operations on that data without specifically revealing the underlying structure or algorithms. In the

context of a software stack, this ADT adheres to the Last-In-First-Out (LIFO) principle.

LIFO( Last In First Out ):

This strategy states that the element that is inserted last will come out first. You can take a pile of plates

kept on top of each other as a real-life example. The plate which we put last is on the top and since we

remove the plate that is at the top, we can say that the plate that was put last comes out first

( Introduction to stack - data structure and algorithm tutorials, 2023).

Figure 2 : Stack ADT

By examining the stack ADT, we can emphasize the core concept of ADTs. It demonstrates how ADTs

provide a clear interface and define the permissible operations on the data structure, abstracting away

the underlying complexities of implementation.

This example of a software stack serves as a concrete manifestation of the ADT concept, highlighting the

power of abstraction in software development.

3.1 Stack operations and working mechanism

In order to make manipulations in a stack, there are certain operations provided to us.

3.2 Implementation of a Stack ADT in Code

To demonstrate the stack's nature as an ADT, let’s consider a basic implementation in Java:

Figure 4 : Implementation of a Stack ADT (1)

Figure 5 : Implementation of a Stack ADT (2)

3.3 Applications/Examples of Stack

Stacks are fundamental data structures that find application in various real-world scenarios. Here are

some examples of how stacks are used in practical situations:

Function Call Management: Stacks are widely used in programming languages to manage function

calls. When a function is called, its local variables and parameters are stored in a stack frame. As

functions return, their stack frames are popped from the stack.

Undo Functionality in Software: In many software applications, such as text editors or graphic design

tools, stacks are used to implement undo and redo functionality. Each state of the application is

pushed onto a stack, allowing users to go back to previous states.

Expression Evaluation: Stacks are utilized in parsing and evaluating mathematical expressions, such

as arithmetic expressions or expressions in programming languages. They help maintain the correct

order of operations.

Browser History: Web browsers use stacks to keep track of the user's navigation history. Each visited

page is pushed onto the stack, and the back and forward buttons pop pages from the stack.

Backtracking Algorithms: Algorithms that involve backtracking, like depth-first search (DFS) and

recursive algorithms, use stacks to keep track of the state of the search and return to previous states.

Call Stack in Multithreading: In multithreaded applications, each thread has its own call stack. Stacks

are used to manage the execution context of each thread, including function calls and local variables.

Balancing Parentheses: Stacks are employed to check for balanced parentheses in expressions. As

open and close brackets are encountered, they are pushed and popped from the stack. If the stack is

empty at the end, the expression is balanced.

Task Scheduling: Stacks can be used in task scheduling algorithms to keep track of tasks that need to

be executed. The last task added is the first to be executed (Last-In-First-Out, or LIFO).

P2 Determine the operations of a memory stack and how it is used to implement function calls in a computer

In Part P2, I will delve into the operations of a memory stack and explore how it plays a vital role in the

execution of function calls within a computer system.

  1. Memory Stack

A stack is a special area of computer’s memory which stores temporary variables created by a function.

In stack, variables are declared, stored and initialized during runtime.

It is a temporary storage memory. When the computing task is complete, the memory of the variable will

be automatically erased. The stack section mostly contains methods, local variable, and reference

variables (Matthew Martin & Martin, 2023).

  1. Operations of a Memory Stack

ļ‚· Push Operation:

This operation is used to insert a new data item into the top of the Stack. The new item can be

inserted as follows:-

SP ←SP-

M[SP]← DR

In the first step, the Stack Pointer is decremented to point at the address where the data item will be

stored.

Then, by using the memory write operation, the data item from Data Register gets inserted into the

top of the stack ( at the address where the Stack Pointer is pointing) ( Memory Stack Organization in

computer architecture, 2023).

  1. Using the Memory Stack for Function Calls

The memory stack plays a pivotal role in managing function calls in a computer's execution environment.

Here is a step-by-step explanation of how it is used for this purpose:

ļ‚· Function Call : When a function is called, a new activation record (often referred to as a stack

frame) is created and pushed onto the stack. This record contains information about the

function's parameters, local variables, and the return address.

ļ‚· Execution : The function begins its execution with access to its own activation record. It can access

and modify its local variables within this frame.

ļ‚· Nested Calls : If a function makes further nested function calls, new activation records are created

and pushed onto the stack, forming a stack of stack frames. This allows for recursive and nested

function calls.

ļ‚· Return : When a function completes its execution or encounters a return statement, it pops its

activation record from the stack, transferring control back to the calling function. The return

value may also be passed back.

ļ‚· Stack Maintenance : The stack is continuously maintained as functions are called and return. The

top-of-stack pointer is updated accordingly.

The memory stack ensures that the execution context of each function is preserved and that functions

can return to their respective callers seamlessly.

Illustrative Example:

Figure 7 : Example Memory Stack for Function Calls

In this Java example:

The main function is the entry point of the program.

When the main function is called, it pushes its activation record onto the memory stack, including the

return address for when it completes execution.

The add function is called from within the main function.

When the add function is called, its activation record is pushed onto the stack, and it calculates the sum

of a and b.

After completing its execution, the add function pops its activation record from the stack, and control

returns to the main function.

Finally, the main function completes its execution, and its activation record is popped from the stack.

This example demonstrates how the memory stack is used to manage the execution context of functions,

allowing them to be called and return control to their respective callers.