Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Procedural, Object-Oriented, and Event-Driven Paradigms: A Comparison, Assignments of Java Programming

An explanation of procedural, object-oriented, and event-driven paradigms, their differences, and their applications in programming. Procedural programming involves executing code step by step, while object-oriented programming focuses on creating reusable software objects and classes. Event-driven programming, on the other hand, allows computer programs to respond to data sources and events. The document also discusses the advantages and disadvantages of each paradigm and their use in Integrated Development Environments (IDEs).

Typology: Assignments

2020/2021

Uploaded on 11/17/2021

jun_pham
jun_pham 🇻🇳

4

(1)

31 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROGRAM TITLE: BTEC-COMPUTING
UNIT TITLE: Programing
ASSIGNMENT NUMBER: 2
ASSIGNMENT NAME: Paradigms
SUBMISSION DATE: 01/05/2021
DATE RECEIVED: 01/05/2021
TUTORIAL LECTURER: Nguyen MinhTrang
WORD COUNT:3529
STUDENT NAME: TRAN VIET ANH
STUDENT ID: BKC118326
MOBILE NUMBER: 0344169977
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Understanding Procedural, Object-Oriented, and Event-Driven Paradigms: A Comparison and more Assignments Java Programming in PDF only on Docsity!

PROGRAM TITLE: BTEC-COMPUTING UNIT TITLE: Programing ASSIGNMENT NUMBER: 2 ASSIGNMENT NAME: Paradigms SUBMISSION DATE: 01/05/ DATE RECEIVED: 01/05/ TUTORIAL LECTURER: Nguyen Minh Trang WORD COUNT: STUDENT NAME: TRAN VIET ANH STUDENT ID: BKC MOBILE NUMBER: 0344169977

Summative Feedback: Internal verification:

immune to risk. SQL injection, command injection, buffer overflow, and stack buffer overflow assaults are among the most prevalent malicious attacks that can harm a company's reputation. For example, in 2011, LulzSec (a hacking collective) launched a basic SQL injection attack on Sony Pictures, exposing about 1 million user accounts, including passwords, email addresses, home addresses, birth dates, and other personal information, in violation of the company's privacy policies. Citigroup exploited the Insecure Direct Object Reference, a security weakness for several sorts of gardens, in the same year, resulting in the leakage of information from 200,000 credit card holders. Even huge corporations like Apple and Uber were targeted. In 2017, HBO was hacked, with a hacker releasing a screenplay episode of a popular TV series that had not yet been broadcast, as well as financial papers, contact lists of actors and film crew, and other sensitive material. As a result, all of these businesses are enormous and well-known, and they never expose themselves to assault. They were, in fact. Consider what would happen if other companies with fewer resources needed to be secure. Can they calculate the loss if something goes wrong? This is why, because prevention is better than cure, software security should be built from the ground up throughout the design phase.

B. Contents

LO2. Explain the characteristics of procedural, object-orientated and event-driven programming.

1. Give explanations of what procedural, object-orientated and event-driven paradigms are: Procedural Programming A procedural language is a set of instructions that tells a computer how to do something step by step. Developers use this programming technique to construct line-by-line code that performs a single operation each line. The first line of code is run in procedural programming, followed by the second, third, and so on, lines cannot jump from the 1st to the 7th to achieve something it must first complete 1-6 in order to get to the 7th line. All algorithms are executed with functions and data that the developer has access to and can change, according to procedural programming. The execution of codes in procedural programming is done from the top down. BASIC, COBOL, PASCAL, FORTRAN, C, and PL1 are examples of procedural languages. Event Driven Programming Event-driven programming is a well-liked and extensively utilized programming technique. You've probably used this in some form if you own a phone, microwave, toaster, fire alarm, or computer. The code will wait for an event, such as a mouse click, starting the engine, detecting smoke, detecting heat on food, or whatever, and then conduct a specific action in response to that EVENT. Is it starting to make sense? The entire procedure is more intricate than that, but it follows a similar pattern. An EVENT LOOP is a key component of event-driven programming. These loops are required to constantly evaluating the user interface in order to determine whether something has occurred, such as a mouse click or a keyboard key press. There are many other types of loops that a programmer would use, and we've covered how to use clicks, key press events, form load events, and the most significant timer events in many of the MOOICT courses. The major programming languages used to construct GUI applications, such as C#, C++, Java, JavaScript, and Objective C, all have their own version of event driven programming. Object Orientated Programming – OOP OOP languages are quite popular and can be found in a wide range of software applications and games. Consider the following scenario: a plane with 300 seats, two wings, two enormous rotor fans, and different controls. If we want to break it down any

Procedural Application Procedural language application rush to take in this language. Because it is simple and easy to understand, this programming language is ideal for beginners to learn. Procedural language is intended for use in high-volume applications that need to execute quickly. E.g. for when Procedural Programming would be for instance, when a client enters specific details into an application shape for enrolment zones, for example, joining to sites , the enlistment is prepared to the following stage in which they are required to login with the points of interest they enrolled with to have the capacity to affirm the enrolment is finished this technique requires Procedural Programming, Procedural Programming likewise includes capacities, for example, capacity to issue tackle computations for logical utilise.  Limitations of Procedural The disadvantages of procedural are the lack of reusable code and the fact that a large challenging application can use thousands of line of code. If the company has a comparable cause in the future, they can duplicate the project and adjust it, but it is a difficult task. The lines of code in a program are difficult to see however before you change the program then you ought to see all the piece of it. The Limitations of this would be that Procedural Programming can be tedious to compose and can’t be identified with genuine events. Procedural Programming is utilised to teach the Computer to perform basic programmed directions. This Programming language can be hard to control points of interest into once it has been coded onto the projects design highlights and so on. Additionally, when performing huge undertakings on Procedural based projects, the restrictions of his future the application transforms these huge tasks coded onto the application into something many refer to as “Spaghetti-Code. This is the point at which a considerable measure of code is altered that the new software engineer going onto the projects needs 2 months to get ready and comprehend what is occurring inside the undertaking as it’s extremely convoluted to see straight away.  Object orientedLimitations of Object Oriented Programming The disadvantages of object-oriented programming are that it takes a long time to master, therefore you must first understand the theory behind it. In comparison to

Procedural, this language has a slower execution time. This programming language necessitates a more complicated PC environment. Furthermore another limitation is the size of OOP itself. Other programs are much smaller although OOP store more size in your internal or external hard drive however now they take up less space than before. Other limitations of Object Oriented Programming include the lack of extra tools for building applications that may be used as part of Software Websites when using PHP coding, as this lone employs programming such as Adobe Dreamweaver and VB.net, both of which offer these tools. In addition, another urgent confinement of Object Oriented Programming is the way that the improvement must be done physically so in the event that you acquire an expansive task with a vast record measure, the Programming application will have a broad measure of code inside Standard applications.  Encapsulation Encapsulation is just a method of securing anything that is prone to modification. The rationale for encapsulations is that if there is any usefulness that is all over Encapsulated in code, i.e. maintained up in only one location and not distributed across code, it is extremely difficult to change. This can be better clarified with a straightforward case of Encapsulated in Java. We all know that the constructor is used to make a protest in Java, and that the constructor can recognize a protest. Assume we have a class Loan with a constructor, and you've used this constructor to create credit opportunities in other classes. Presently prerequisites change and you have to incorporate period of borrower too while taking advance. Because this code isn't everywhere exemplified, you'll have to update where you're invoking this constructor, which means you'll have to change several documents instead of just one, which is more prone to errors and tedious.  Polymorphism For some cases, the term polymorphism is used. This term is used in programming to refer to the reuse of a single code in multiple situations. Clearly, when we conduct inheritance between two classes, all of the top of the line's strategies and

requirement for continuous dynamic event loops. Other limitations of Event Driven Programming is that the Program doesn’t naturally enable you to adjust and apply Event Loops and triggers which requires the client to physically enter for the circles. In addition, this empowers the Application to utilise huge measure of handling force and CPU inside the undertaking/application because of the need of nonstop dynamic running of Event Loops occurring when the application/project is being tried/utilised. 2.2. The relationship between Procedural, object-orientated and event-driven paradigms.  Programming is purely procedural in nature. The event-driven and object-oriented principles simply assist the programmer in managing the complexity of extremely big programs.  Programs may often become very large and contain hundreds of thousands of lines of code. Old programming languages like COBOL handled this complexity by allowing the creation of paragraphs or by moving some code to external programs which can be called from a main, central or controlling program which assigns values to those variables which will be used as parameters by the called program. The called program would return the control to the calling program on termination and may or may not return some values as instructed. Calling can be nested when a called program calls another sub-program with or without parameters and may or may not receive some return value and so on.  When software design and development are outsourced to a big number of programmers who may be distributed across multiple places, such as Bengaluru and Silicon Valley, this process appears straightforward but can become exceedingly unpleasant and unmanageable.  Event driven programming simply uses event handlers to keep a large amount of code handy and available for use if and when required. If there is no requirement for this code, then it just rests on the sidelines without interfering with or cluttering the other code. Now the program is a cluster of subprograms, each assigned to a distinct and different event of a command button, drop down list or text box etc. The controlling program (for example, a form in Visual Basic) simply keeps track of various events and fires the code inside the event handler set aside for that particular event.

 Object-oriented programming combines procedural and event-driven programming capabilities and takes them a step further. The functions and variables of a module are kept in an object. Objects cannot be created randomly. Each object emerges from a class. A class is a blueprint, a design or an architecture for creating objects. A class encapsulates a lot of functions. Variables can exist in a class or inside its functions. A function can encapsulate other functions and variables and so on. It's just like a good doctor would prescribe a medicine that is neatly packaged in capsules rather than in a big bottle or box.  You can make classes out of other classes. Inheritance is the term for this. A function or variable belonging to one object can be given the same name as another object's function or variable. Polymorphism is the term for this kind of variation.  Objects built from classes interact in a disciplined, well-defined, and organized manner with the primary, controlling function as well as other functions, variables, and objects.

3. Compare and contrast the procedural, object oriented and event driven paradigms used in given source code of an application. Procedural Object-Oriented

4. Define what is an IDE, key components of an IDE with a brief explanation each component. What is an IDE? On a more basic level, IDEs provide interfaces for users to write code, organize text groups, and automate programming redundancies. But instead of a bare bones code editor, IDEs combine the functionality of multiple programming processes into one. Some IDEs focus on a specific programming language, such as Python or Java, but many have cross-language capabilities. In terms of text editing capabilities, IDEs often possess or allow the insertion of frameworks and element libraries to build upon base- level code. Throughout the writing process, one or multiple users create hierarchies within the IDE and assign groups of code to their designated region. From these, groupings can be strung together, compiled, and built. Most IDEs come with built-in debuggers, which activate upon the build. Visual debuggers are a substantial benefit of many IDEs. If any bugs or errors are spotted, users are shown which parts of code have problems. Key components of an IDE with a brief explanation each component.Text editor Virtually every IDE will have a text editor designed to write and manipulate source code. Some tools may have visual components to drag and drop front-end components, but most have a simple interface with language-specific syntax highlighting.  Debugger Debugging tools assist users in identifying and remedying errors within source code. They often simulate real-world scenarios to test functionality and performance. Programmers and software engineers can usually test the various segments of code and identify errors before the application is released.  Compiler Compilers are components that translate programming language into a form machines can process, such as binary code. The machine code is analyzed to ensure its accuracy. The compiler then parses and optimizes the code to optimize performance.  Code completion

Code complete features assist programmers by intelligently identifying and inserting common code components. These features save developers time writing code and reduce the likelihood of typos and bugs.  Programming language support IDEs are typically specific to a single programming language, though several also offer multi-language support. As such, the first step is to figure out which languages you will be coding in and narrow your prospective IDE list down accordingly. Examples include Ruby, Python, and Java IDE tools.  Integrations and plugins With the name integrated development environment, it is no surprise that integrations need to be considered when looking at IDEs. Your IDE is your development portal, so being able to incorporate all your other development tools will improve development workflows and productivity. Poor integrations can cause numerous issues and lead to many headaches, so make sure you understand how well a potential IDE fits into your ecosystem of existing tools.