Docsity

Event-Driven Programming vs Procedural Programming: Characteristics and Relationship, Study Guides, Projects, Research of Information Technology

Toggle sidebar
bg1
1
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 1: Programming
Submission date 22 December 2023 Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name TRAN CHI TRUNG Student ID GCS220288
Class GCS1101 Assessor name NAMLNT
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 TRUNG
Grading grid
P1 P2 P3 M1 M2 D1 D2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Event-Driven Programming vs Procedural Programming: Characteristics and Relationship and more Study Guides, Projects, Research Information Technology in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date 22 December 2023 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name TRAN CHI TRUNG Student ID GCS Class GCS1101 Assessor name NAMLNT 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 TRUNG Grading grid P1 P2 P3 M1 M2 D1 D

❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

● The individual Assignment must be your own work, and not copied by or from another student. ● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style. ● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply this requirement will result in a failed assignment. Unit Learning Outcomes: LO1 Define basic algorithms to carry out an operation and outline the process of programming an application Assignment Brief and Guidance: Assignment scenario You have applied for a post as a trainee with a software development company and have been invited for an interview. You have been asked to demonstrate your problem solving and basic programming skills. To do this you have to prepare a report on using algorithms to solve problems. You need to explain, using examples, how algorithms are used to solve simple business problems and the steps needed to be followed to produce a working program solution. You should make clear your assumption about your program. The problems to be solved will involve basic procedural programming instructions - sequence instructions (input, output and assignment statements), loops, conditional statements. Problems should be analysed and designed by the use of flowchart and demonstrated by the use of modules (procedures). Tasks:  State your simple business problems to be solved.  Analyse the problem and design the solutions by the use of suitable methods.  Demonstrate the compilation and running of a program  Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific programming language.

Learning Outcomes and Assessment Criteria Pass Merit Distinction LO1. Define basic algorithms to carry out an operation and outline the process of programming an application P1. Define an algorithm and outline the process in building an application. P2. Determine the steps taken from writing code to execution. M1. Analyse the process of writing code, including the potential challenges faced. D1. Evaluate the implementation of an algorithm in a suitable language and the relationship between the written algorithm and the code variant LO2. Explain the characteristics of procedural, objectorientated and event-driven programming P3. Discuss what procedural, objectorientated and eventdriven paradigms are; their characteristics and the relationship between them M2. Compare the procedural, object- orientated and eventdriven paradigms used in given source code of an application. D2. Critically evaluate the source code of an application that implements the procedural, object-orientated and event- driven paradigms, in terms of the code structure and characteristics

P1. Define an algorithm and outline the process in building an application.

1. Algorithm

a. Definition The algorithm is a given set of step-by-step instructions to solve a problem or accomplish a task. Algorithms might be expressed in words, computer programs, or code, or even as recipes. Some algorithms may be simple routines, directions, or processes you use in your daily life. In computer science, algorithms are represented through a computer program (or set of computer programs) designed to systematically solve certain types of problems. b. The characteristics of the algorithm ➢ Determination

This means specifying a step-by-step sequence and order of steps to turn input into output. Algorithms should be clear, unambiguous, and detailed step by step. If you are ambiguous about something, you can't expect a computer to be able to understand. ➢ Finiteness The algorithm must stop. Meaning you will either get the expected output or will get a response with no possible solution. The algorithm will terminate after a finite number of steps or after a certain number of steps. ➢ Precise and effective For an algorithm to be efficient, all the steps to achieve the output must be feasible given the available resources. It must not contain any redundant or inefficient steps that make the algorithm misleading. That is the accuracy of the algorithm. ➢ Unambiguous A perfect algorithm must be clear and easy to understand. ➢ Independence An algorithm should have step-by-step that are unrelated to any programming code. It is designed to run with any programming language.

Collect feedback and iterate: Gather feedback from users and stakeholders. Use this feedback to make improvements and iterate on the application. Continuously enhance and add new features based on user needs. It's important to note that the specific steps and processes may vary depending on the development methodology, project requirements, and the technologies used. However, this outline provides a general framework for building an application. Problem: Product Manager System Why it needs to be solved: Managing products efficiently is critical for businesses to ensure optimal performance, timely releases, and customer satisfaction. A lack of organized systems for product management can lead to confusion, delays, and a decrease in overall productivity. This problem becomes more pronounced as the number of products and the complexity of their development and release processes increase. A dedicated product manager system is needed to streamline workflows, enhance collaboration, and improve decision-making within the product management process. How an algorithm could help: An algorithm can significantly contribute to solving the product manager system problem by automating and optimizing various aspects of product management. Here are a few ways algorithms can assist: Prioritizing Features: Use algorithms to analyze customer feedback, market trends, and business goals to prioritize features. This ensures that development efforts are focused on the most valuable aspects of a product. Release Planning: Implement algorithms to create optimal release plans considering dependencies, resource availability, and market demands. This helps in delivering products on time and maximizing the impact of each release. Resource Allocation:

Develop algorithms to allocate resources efficiently, balancing workload among team members and avoiding bottlenecks. This ensures that the product development process is smooth and that no team member is overburdened. Risk Management: Use algorithms to assess and manage risks associated with product development. This includes identifying potential issues, estimating their impact, and suggesting mitigation strategies. Collaboration and Communication: Implement algorithms to enhance collaboration and communication among team members. This can include intelligent notification systems and automated progress updates. Data Analysis for Decision-Making: Leverage algorithms to analyze data related to product performance, user behavior, and market trends. This information can aid in making informed decisions about product improvements and future developments. By incorporating algorithms into a product manager system, businesses can create a more streamlined, efficient, and data-driven approach to product management, ultimately leading to better products and improved business outcomes.

P2. Determine the steps taken from writing code to execution....................................................................................

Business Problem Analysis and Algorithm Design for Product Manager System: The business problem revolves around the inefficiencies in product management, necessitating the development of a dedicated Product Manager System. The user requirements can be categorized into task coordination, resource management, decision support, and effective communication. User Requirements:

1. Task Coordination: Users need a system facilitating efficient task assignment, progress tracking, and validation of task completion.

These algorithms, represented through flowcharts, address the application requirements systematically. The Task Coordination Algorithm ensures smooth progress tracking, the Resource Management Algorithm optimizes resource allocation, the Decision Support Algorithm utilizes data for informed decisions, and the Communication Algorithm facilitates effective collaboration. Integrating these algorithms into the Product Manager System will enhance overall product management, providing a structured and user-friendly solution to the identified business problem. Recording 4 steps taken to build an application, writing a code is a step after the work of algorithm and graphics/UI designer. •Coding The purpose of coding is to create and import the algorithm into computer language. The languages, machines, compilers, and interpreters are only tools. Programmer’s mission is to translate and make the computer understand the idea by transferring data to machine code. •Documenting the Program, the purpose of documenting the program is to describe the use, operation, maintenance, or design of software or hardware for other members who work with the previous coder as a team, it helps keep track of all aspects of an application and it improves on the quality of a software product. •Compiling and running the program A compiler is a program that translates from one language into another — in general, it's used to mean a program which reads in a source code language and translates to an object code form. It's quite possible to write a program directly in object code form so people invented a compiler. •Execution Execution is a process without human interaction which is done right by transferring your code into computer language. Most IDE nowadays have automatic execution, which help you execute the program and find out bugs in code. For example: In C#, the coder first writes, explaining the idea of the algorithm into programing language. While code all the solution, the programmer needs to document for other team member to understand what s/he trying to do, to explain the code, to keeping track of the code.

Then the programmer can use the C# compiler to compile the program into EXE file then execute the program

relationship between them......................................................................................................................................... P3. Discuss what procedural, objectorientated and event-driven paradigms are; their characteristics and the

are; their characteristics and the relationship between them.

1. Procedural Programming

Procedural programming is a programming style that divides a program into a collection of reusable procedures or functions. It is a structured programming approach that focuses on a step-by-step approach, a sequence of commands that are executed. In procedural programming, program execution follows a linear path, executing instructions one at a time. This is usually a top-down design approach, where the structure of a program is designed by dividing it into smaller procedures that perform specific tasks. These procedures are called in sequence, with one procedure calling another to achieve the desired functionality. Procedural programming is based on the concept of structured programming, which aims to improve program clarity, maintainability, and reusability by using modular and well-organized code structures. It allows programmers to divide complex problems into simpler tasks and tackle them individually.

Procedural programming is relatively easy to learn and understand. It follows a no-fuss, top-down approach and the program flow is easy to understand, making it ideal for beginners. Modularity Programs are divided into smaller procedures or functions, promoting code reuse. These modular units can be developed independently and tested independently, improving maintainability and scalability. Efficiency Procedural programming tends to be more efficient at runtime compared to other paradigms. Direct and sequential execution of procedures improves performance, especially for simple programs with well-defined procedures. Speed Because procedural programming relies on a series of linear steps, it can be fast interms of execution speed for certain tasks. This eliminates the overhead associated with object-oriented programming. Dynamic dispatch and inheritance. Disadvantages of Procedural Programming No encapsulation Procedural programming does not offer a powerful encapsulation mechanism like object-oriented programming. As a result, data and functionality are often treated separately, which can lead to code duplication and maintainability issues. Limited code reusability Procedural programming increases code reusability to some extent, but it fallsshort when compared to object-oriented programming. Lack of inheritance and polymorphism can limit the flexibility and extensibility of your code. Difficulty managing large projects.

As procedural programs grow and become complex, the code base becomes increasingly difficult to maintain and maintain. Lack of encapsulation and modularity can lead to spaghetti code and poor code comprehension. Lack of flexibility Because procedural programming focuses on algorithms and procedures, it may notbe suitable for areas where complex data structures and dynamic behaviorpredominate. May not be the best choice for applications that require frequentchanges and adaptability.

3. Object orientated programming.

Object-oriented programming (OOP) is a programming paradigm that organizes code around objects, which are instances of classes. It provides a way to structure and design software by modeling real-world entities and their interactions. OOPemphasizes encapsulation, inheritance, and polymorphism. The example of OOPconcepts is shown in fig.

Polymorphism: Polymorphism allows objects of different classes to be treated as instances of a common superclass. It enables the same method to be used for objects of different types, providing flexibility and code reuse. Abstraction: Abstraction focuses on representing essential features of objects and hiding unnecessary details. It allows programmers to create abstract classes or interfaces that define a common structure and behavior for a group of related objects.

5. Event-driven programming and Characteristics

Event-driven programming is a programming paradigm where the flow of a program is determined by events that occur during its execution. In event-driven programming, the program waits for events to happen and then reacts to those events by executing specific code or triggering predefined functions.  Event handling: A core feature of event-driven programming is the handling of events. A program waits for events such as user actions or system notifications to occur and responds to those events by executing specific code.

 Event loop: Event-driven programs typically have an event loop or event dispatcher that continuously listens for events. The event loop monitors events and forwards them to the appropriate event handlers or callbacks.  Asynchronous execution: Event-driven programming is often asynchronous execution in which a program can handle multiple events simultaneously. Asynchronous behavior enables non-blocking operations, ensures responsiveness, and allows programs to perform other tasks while waiting for events to occur.  Event handler or callback: Events are associated with event handlers or callbacks, which are functions or methods that execute when the appropriate event occurs. Event handlers define specific actions or behaviors to be performed in response to an event.  Event-driven architecture: Event-driven programming drives a style of architecture known as event-driven architecture (EDA). In EDA, program flow is driven by events, and communication between various components is primarily event-based.  Loosely coupled: Event-driven programming promotes loose coupling between components. Components communicate through events rather than calling each other's methods directly. This separation allows components to be added, removed, or changed without affecting the entire system.  Event driven GUI: Event-driven programming is commonly used in graphical user interface (GUI) development. User interactions such as key clicks, mouse movements, and key presses are events that trigger appropriate event handlers to update the user interface or perform specific actions.  Event sourcing: Event-driven programming can also include event sourcing, where the state of an application is determined by a series of events. Eventsare stored and replayed to reconstruct application state, providing flexibility, auditability, and fault tolerance. Each has its own set of principles, concepts, and techniques for designing and implementing software solutions. Example program that is written in event driven programming Calculator program is written in event driven programming paradigm. In this program, an appropriate process will execute when the use presses a button tocalculate numbers. Advantages of Event-driven Programming