Download programming assignment2 , pASS and more Assignments Information Technology 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 16/08/2023 Date Received 1st submission 16/08/ Re-submission Date Date Received 2nd submission Student Name Nguyen Ngoc Doanh Student ID BC Class SE06202 Assessor name Tran Van Nhuom 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 P2 P3 P4 P5 M2 M3 M4 D2 D3 D
❒ Summative Feedback: ❒ Resubmission Feedback:
Grade: Assessor Signature: Date: Lecturer Signature:
- A. INTRODUCE
- B. CONTENT......................................................................................................................................................
- I. Programming Model
- Procedural Programming (POP)
- Event-driven programming (EDP)
- Object-Oriented Programming (OOP)
- Relationship between 3 programming models.
- II. Implement basic algorithms in code using an IDE.
- III. Explain the debugging process and explain the debugging facilities available in the IDE
- you have used in your code IV. Integrates many programs such as code completion, compiler, and editor. Outline the coding standard
- Denifition
- Coding Standard
- V. Integrated Development Environment
- Analyze the common features that a developer has access to in an IDE
- C. CONCLUSION
- D. REFERENCES
- Figure 1 : Procedural programming paradigm LIST OF FIGURES
- Figure 2: Event-driven programming (EDP)....................................................................................................
- Figure 3: Object-oriented programming (OOP)
- Figure 4: Login form......................................................................................................................................
- Figure 5: Source of the code Login form
- Figure 6: Main form
- Figure 7: Add Button
- Figure 8: Source of code Add buttons
- Figure 9: Delete Button
- Figure 10: Source of code Delete button
- Figure 11 : Edit button
- Figure 12: Source of the code Edit button
- Figure 13: Search button
- Figure 14 : Source of the code Search button
- Figure 15: Set the breakpoint
- Figure 16 : Start debug
- Figure 17: Step over......................................................................................................................................
- Figure 18: Step out
- Figure 19: Coding Standard
- Figure 20: Coding Standard
A. INTRODUCE
In the rapidly evolving world of technology, programming has become an essential skill for creating software applications that power our daily lives. To realize this objective, significant strides have been made in the realms of procedural, object-oriented, and event-driven programming paradigms. Concurrently, the concept of an 'IDE' - Integrated Development Environment has been developed. IDEs provide developers with a unified platform, encompassing code writing, debugging, and deployment tools, to streamline the creation of software applications. Furthermore, this report delves into the practical application of fundamental algorithms within the IDE framework and elucidates the nuances of the debugging process. Finally, a comprehensive appraisal of the pivotal role played by coding standards in promoting effective programming practices brings this exposition to a conclusion.
- Modularity : When two different systems have two distinct jobs at hand but are grouped to perform a bigger job first, this is referred to as modularity. Modularity is a powerful tool for reducing the complexity of systems.
- Parameter Passing : It is a mechanism to pass parameters to procedures, functions, or routines. Parameter passing can be done through pass-by-value and pass-by-reference. Advantages:
- Simple data structures
- Use fewer operating costs
- Easier to trace the program logic and debug errors
- Data processing, and algorithm development Disadvantage:
- Difficult to manage and maintain
- Less flexible
- Limited reusability
- Program code is difficult to write when programming 2. Event-driven programming (EDP) Definition: Event-driven programming (EDP) is a programming paradigm in which the flow of a program's execution is determined by user events or actions. In event-driven programming, the program responds to external events, such as user input, sensor output, or messages from other programs, by executing specific pieces of code that are called event handlers or callbacks.
Figure 2 : Event-driven programming (EDP) The key features of Event-driven programming are given below:
- Events: Events are occurrences or interactions that trigger the execution of specific code. These events can include user actions (e.g., clicking a button, typing).
- Event Handlers: Event handlers are functions or blocks of code that are executed in response to specific events. They define how the program should respond when a particular event occurs.
- Event Loop: The event loop is a central component of event-driven programming. It continuously checks for the occurrence of events and dispatches their corresponding event handlers when events are detected.
- Trigger Functions: Trigger functions in event-driven coding are functions that decide what code to perform whenever there is a specific event occurs.
- Time-Driven: It is code that runs on a time trigger, a time engine can be thought of as a specific code that works for a specific time, be it once an hour, once a week or once a month. Advantages:
- Use object-oriented programming as the basis.
- Better software design results.
- Better responsiveness and flexibility of resulting programs.
- Classes and Objects : A class is a blueprint or template that defines the properties and behaviors that objects of that class will have. Objects are instances of classes, representing specific instances of the described entity.
- Encapsulation: involves bundling data and methods that operate on that data into a single unit. Access to an object's data is controlled through well-defined interfaces, promoting data hiding and reducing direct manipulation.
- Inheritance: Inheritance allows a new class to inherit attributes and behaviors from an existing class. This promotes code reuse and the creation of hierarchies of related classes.
- Polymorphism : enables objects of different classes to be treated as objects of a common superclass, allowing different classes to have methods with the same name but varying implementations. Advantages:
- Modularity: Encapsulation enables objects to be self-contained, making troubleshooting and collaborative development easier.
- Reusability: Code can be reused through inheritance, meaning a team does not have to write the same code multiple times.
- Productivity: Programmers can construct new programs quicker through the use of multiple libraries and reusable code.
- Easily upgradable and scalable: Programmers can implement system functionalities independently.
- Security: Using encapsulation and abstraction, complex code is hidden, software maintenance is easier and internet protocols are protected. Disadvantages:
- Not suitable for many problems: There are problems that are consistent with useful programming styles, rational programming styles, or strategy-based programming styles, and the application of object-oriented programming in those fields. That case will not bring efficiency to the projects.
- Complexity: OOP can cause complexity, especially in larger projects, due to the need to define and manage class relationships and hierarchies.
- Operational overhead: In some cases, the overhead of managing objects and method calls can lead to slightly slower performance than with more procedural methods.
- Abuse of inheritance: Improper use of inheritance can lead to overly complex class hierarchies, making the codebase difficult to maintain and understand.
- Excessive abstraction: Excessive abstraction can lead to unnecessary complexity, making code harder to track and maintain. 4. Relationship between 3 programming models. The relationship between these models lies in their complementary nature. While each programming model has its distinct characteristics, they are not mutually exclusive. In fact, they can often be combined to leverage the strengths of each approach. Combining POP and EDP: Procedural code can be integrated into an event-driven environment to handle specific actions triggered by events. For instance, a button click event might call a procedural function to perform a specific task. Incorporating EDP in OOP: Event-driven interactions can be implemented within an object-oriented structure. Objects can listen for events and respond by invoking methods, allowing for a dynamic and interactive user experience. Integrating OOP with POP: Object-oriented design can encapsulate procedural code within methods, maintaining the benefits of both modularity and efficient sequential execution. The choice depends on the nature of the project and the problem you're solving. The key is to leverage the strengths of each paradigm to create well-structured, efficient, and maintainable software solutions. II. Implement basic algorithms in code using an IDE. To manage students, I created a program called "Student Management". With this program you will experience a convenient means of student management, allowing you to perform data management operations such as adding, deleting, modifying, and calculating student information quickly. The program not only helps you browse through a wide range of student personal information, but also provides analytical, reporting, and statistical tools to monitor academic progress and evaluate results. With the help of (IDE) Visual Studio 2022, I was able to implement object-oriented programming and event- oriented programming principles, creating a complete, flexible and powerful application. The main object of this program is "Student," so it should be the main object for object-oriented programming. This program has the following properties created:
The users will provide the correct username and password in the textbox, in this case, “Doanh”, to access. If any data field is empty, the program will inform a warning in order to remind the user to full fill in the data field, or if the input data are incorrect, it will send a warning to inform the user. If the user wants to exit the program, they can do so by clicking the "Cancel" button. Figure 6 : Main form After the user successfully logs into the program, the main screen will appear automatically. This main screen is divided into two main functional tabs: "Student Information" and "Look Up Information". Student Information tab: In this tab, you can perform important functions related to student information: Add: Click the "Add" button to enter a student's information and add it to the list. After you finish entering, press "Add" and the information will be saved. Edit: When you need to correct a student's information, click the "Edit" button. You will have the opportunity to edit the information and save it when finished. Delete: To remove a student from the list, simply click the "Delete" button. The system will warn before deleting to ensure accuracy. Tab Look up information:
In this tab, you will have tools to search and look up student information: Information search: Here, you can perform an information search easily using options such as search by ID, date of birth, gender, course, or city. With these two functional tabs, you have the ability to manage and look up student information efficiently and conveniently. Figure 7 : Add Button
Figure 9 : Delete Button Figure 10 : Source of code Delete button When a user wants to remove a student from the list, they can tap the "Delete" button. To ensure accuracy and avoid mistaken deletion, the program will warn the user before performing the deletion,
especially in case of any error. Figure 11 : Edit button Figure 12 : Source of the code Edit button
Figure 14 : Source of the code Search button The search Information tab allows users to easily find information quickly and conveniently. The user can use the options below by selecting the corresponding radio button: ID, Date of Birth, Gender, Course, and City. Using the above options, users can easily find the information they are looking for without spending too much time. III. Explain the debugging process and explain the debugging facilities available in the IDE
1. Debugging process Debugging, in computer programming and engineering, is a multistep process that involves identifying a problem, isolating the source of the problem, and then either correcting the problem or determining a way to work around it. The final step of debugging is to test the correction or workaround and make sure it works. In software development, the debugging process begins when a developer locates a code error in a computer program and is able to reproduce it. Debugging is part of the software testing process and is an integral part of the entire software development lifecycle. In hardware development, the debugging process looks for hardware components that are not installed or configured correctly. For example, an engineer might run a JTAG connection test to debug connections on an integrated circuit.
2. Debugging step Step 1: Set the breakpoint Figure 15 : Set the breakpoint When the program starts the marked Breakpoint, the line will turn yellow as shown below. Step 2: Start debug Figure 16 : Start debug