Programming Paradigms: Procedural, OOP, and Event-Driven Explained with Examples, Assignments of C programming

An explanation of three programming paradigms: Procedural, Object-Oriented, and Event-Driven. It includes definitions, characteristics, illustrations, and source code examples. The document also covers the relationship between these programming models and the features of an Integrated Development Environment (IDE).

Typology: Assignments

2021/2022

Uploaded on 09/12/2022

andrew-2709
andrew-2709 🇻🇳

4.8

(20)

33 documents

1 / 32

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 2 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Submission date
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Duong Trong Qui
Student ID
GBS200716
Class
GCS1005A
Assessor name
Nguyen Tuan Dang
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
Qui
Grading grid
P2
P3
P4
P5
M2
M3
M4
D2
D3
D4
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Programming Paradigms: Procedural, OOP, and Event-Driven Explained with Examples and more Assignments C programming in PDF only on Docsity!

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Duong Trong Qui^ Student ID GBS Class GCS1005A^ Assessor name Nguyen Tuan Dang 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 Qui Grading grid P2 P3 P4 P5 M2 M3 M4 D2 D3 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

  • Task 1 – Introduction to your program(P3)
    • 1.1. Introduce the Overview/ Context of the problem:
    • 1.2. List out application requirements:
  • Task 2 – Explain programming paradigms (P2)
      1. Procedural paradigm:
    • 2 .1. Explain what is Procedural Programming with source code and illustrations
      • a. What is procedural programming?
      • The characteristics of procedural paradigm:..................................................................................
    • 2.2 Explain what is Object-Oriented Programming with source code and illustration:
      • a. What is object-oriented programming?
      • What are the characteristics of Object Oriented programming language?
      • Some key features of the Object-Oriented programming are:
      • b. Illustration:...............................................................................................................................
    • 2.3 Explain what is Event-Driven Programming with source code and illustrations
      • a. What is event-driven programming?
      • The characteristics of event-driven paradigms:
      • b. Illustration:..............................................................................................................................
  • Task 3 - IDE features (P4)
    • 3.1. Introduce what is IDE?..............................................................................................................
    • 3.2 Introduce features of IDE with illustrations:...............................................................................
    • development: 3.3 An explanation and evaluation of the debugging process in the IDE used and how it helped with
    • 3.4 Evidences that you have used debugging during the implementation:
      • Definition of the debugging process in the IDE:
      • a. Debug:
      • b. The debugging processes:
  • Task 4 – Design and Implementation(P3-P5)
    • 4.1 Flowchart of the application:
    • 4.2 Source code and screenshots of the final application with explanation:
    • 4.3 Explain and evaluate coding standards used in the program:
    • Include Test cases:
    • 4.4 Explain the benefits of using a coding standards:
  • REFERENCES

ASSIGNMENT 2 ANSWERS

Task 1 – Introduction to your program(P3)

    1. Introduce the Overview/ Context of the problem: Student Management System, With the software's student information input function, display student, student ID list function, student search function, delete student information function, and program exit, the problem has been solved.
    1. List out application requirements:
  • Input function
  • Display student
  • Student ID
  • Update student information
  • Create struct
  • Search student function
  • Delete student information function
  • Exit program.

Task 2 – Explain programming paradigms (P2)

  1. Procedural paradigm: 2 .1. Explain what is Procedural Programming with source code and illustrations a. What is procedural programming? Definition: Procedural programming could be a programming paradigm built around the thought that programs are arrangements of enlightening to be executed. They center intensely on part up programs into named sets
  • A function can access other function's data by calling that function. b. Illustrations: Figure 1.1: Source code about procedural programming Source :https://medium.com/swlh/procedural-vs-object-oriented-coding-style-a25b0a78f01b 2.2 Explain what is Object-Oriented Programming with source code and illustration: a. What is object-oriented programming? Definion: According to Gillis, 2021, Object-Oriented Programming (OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field with unique properties and behaviors.

Figure 2: Object-Oriented Programming System Source: https://viblo.asia/p/tong-quan-lap-trinh-huong-doi-tuong-qua-vi-du-cu- the-4dbZNRBLZYM The characteristics of object-oriented paradigm: The object-oriented strategy depends on three characteristics that characterize object-oriented dialects: encapsulation, polymorphism, and inheritance. What are the characteristics of Object Oriented programming language?

  • Encapsulation – Encapsulation is capturing information and keeping it securely and safely from exterior interfaces.
  • Inheritance - This is the process by which a class can be determined from a base course with all highlights of the base class and a few of its own. This increments code reusability.
  • Polymorphism- Usually the capacity to exist in different shapes. For a case, an administrator can be overloaded to add two integer numbers and two floats.
  • Abstraction- The capacity to represent information at a really conceptual level without any points of detail. Some key features of the Object-Oriented programming are:
  • Emphasis on information instead of procedure.
  • Programs are separated into substances known as objects.

a. What is event-driven programming? Definion: According to Computer Hope, 2018, Event-driven programming is a computer programming paradigm where the 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). Event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions. Event-driven programming is the dominant paradigm used in graphical user interfaces and other applications that are centered on performing certain actions in response to user input. Figure 3: Event-driven Programming Source: https://commons.wikimedia.org/wiki/File:Event_driven_programming_Simply_Explained.jpg The characteristics of event-driven paradigms:

  • Service-oriented could be a key include in event-driven programming that is utilized to type in programs that are made for administrations and it takes does not moderate down the computer

as service-oriented as it devoured small of the computer processing control and more often than not, administrations run within the foundation of OS.

  • Time-Driven: In event-driven programming, time-driven could be a worldview, it’s a code that runs on a time trigger, time-driven can be a particular code that runs on a particular time, which might be once an hour, once a week, or once a month, this implies it’s a pre-set to-do assignment.
  • Event handlers are a sort of work or strategy that run a particular activity when a particular occasion is activated. For case, it may well be a button that when the user clicks it'll, show a message, and it'll near the message when the client clicks the button once more, typically an occasion handler.
  • Trigger functions in event-driven programming are capacities that choose what code to run when there is a particular occasion happens, which are utilized to choose which occasion handler to utilize for the occasion when there's particular occasion happened. The relationship between them: To disentangle these programs, customary software engineers utilize coordination between two or three programming models to rearrange calculations. Extra models for each other are as:
  • The procedural paradigm considers the forms required to unravel an issue, giving arrangements, deciding forms, and information streams.
  • Object-oriented is looking at the actor and making objects to create for those actors.
  • The event programming demonstrate makes actions when encountering both procedural programming and programming objects. Thanks to the relationship between them: software engineers can oversee the complexity of major programs and make more complex programs. Three models depend on their possess points of interest and drawbacks the disturbance of the rest, making a difference in the software. b. Illustration:
  • Local build automation: Utilities that robotize straightforward, rehashed operations such as compiling computer source code into double code, bundling parallel code, and performing robotized tests as a portion of making a nearby form of the item for utilization by the engineer.
  • Debugger: A computer program that can outwardly demonstrate the area of imperfection within the source code and is utilized to test other. Figure 4: What is IDE? Source: https://topdev.vn/blog/ide-la-gi/ 3.3 An explanation and evaluation of the debugging process in the IDE used and how it helped with development:
  • Using the IDE investigate, you'll adjust the esteem of variables whereas the program is executing. Once you begin running, the IDE investigation include permits you to see the esteem of factors you didn't realize you needed to see.
  • You will observe the calling and confirm the status of the work utilizing odd values within the IDE investigation.
  • The IDE investigates include permits you to break execution conditions at any point within the code based on a single condition instead of the number of lines.
  • If the exemption has not been treated rather than fair showing up, the IDE investigation will permit you to screen the state of the application. 3.4 Evidences that you have used debugging during the implementation: Definition of the debugging process in the IDE: a. Debug: In computer programming and software advancement, investigating finds and settles bugs (abandons or issues that avoid rectifying operation) inside computer programs, programs, or frameworks. Debugging strategies can include intelligently analyzing, control stream examination, unit testing, integration testing, log record investigation, checking at the application or framework level, memory dumps, and profiling. Numerous programming language and program advancement apparatuses also offer programs to help investigate, known as debuggers. Figure 5: What is Debugging?
  1. Analyze the Error: Within the third step, you would like to utilize a bottom-up approach from the blunder area and analyze the code. This makes a difference in understanding the mistake. Analyzing a bug has two fundamental objectives, such as checking around the blunder for other blunders to be found, and making sure almost the dangers of entering any within the settlement.
  2. Prove the Analysis: Once you're done analyzing the initial bug, you wish to discover many more mistakes that will show up on the application. This step is approximately composing computerized tests for these regions with the assistance of a test system.
  3. Cover Lateral Damage: In this stage, you would like to create a form or gather all the unit tests for the code where you're aiming to make changes. Presently, if you run these unit tests, they all ought to pass.
  4. Fix & Validate: The final stage is fixing all the errors and running all the test scripts to check if they all pass.

Task 4 – Design and Implementation(P3-P5)

4.1 Flowchart of the application: a. Create struct:

Figure 7: A flowchart about create struct in system b. Search function:

Figure 9 : A flowchart about Update in system d. Delete information:

Figure 10 : A flowchart about Delete in system