1. Trang chủ
  2. » Luận Văn - Báo Cáo

Information technology assignment 2 unit programing

51 1 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Information technology assignment 2 unit: programming
Tác giả Do Quang Trung
Người hướng dẫn Nguyen Hoang Anh Vu
Trường học Btec Fpt International College
Chuyên ngành Information Technology
Thể loại Bài tập
Năm xuất bản 2022
Thành phố Danang
Định dạng
Số trang 51
Dung lượng 12,73 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Cấu trúc

  • ASSIGNMENT 1 FRONT SHEET (1)
  • CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE (11)
    • 2.1 Give explanations of what procedural, object-oriented and event-driven (12)
      • 2.1.1 The definition of programming models (12)
      • 2.1.2 Characteristics of the programming models (19)
      • 2.1.3 Relationship between Procedural, Object-oriented, Event-driven (22)
    • 3.1 Write a program that implements an algorithm using an IDE. (P3) (24)
    • 3.2 Explain the debugging process and explain the debugging facilities available in the IDE. (P4) 28 (0)
    • 3.3 Integrates many programs such as code completion, compiler, editor Outline the (32)

Nội dung

x CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE : 2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct an analysis of a suitab

FRONT SHEET

STUDENT : DO QUANG TRUNG CLASS : IT 05101

SUPERVISOR : NGUYEN HOANG ANH VU

Qualification BTEC Level 1 HND Diploma in Computing

Re-submission date Date received (2nd submission)

DO QUANG TRUNG Student ID

IT05101 Assessor name NGUYEN HOANG ANH VU

I certify that the assignment submission entirely is my own work and I fully understand the consequences of plagiarism I understand that making a false declaration a form is of malpractice

I would like to express my heartfelt gratitude to my family for their unwavering support and encouragement throughout this project Additionally, I extend my sincere thanks to Mr Nguyen Hoang Anh Vu, my teacher, for his invaluable guidance and assistance in helping me achieve my goals Lastly, I appreciate the essential contributions of the BTEC staff, who provided me with the necessary facilities and resources to successfully complete this project.

I verify that the work I've submitted for this assignment all is my own, and that all research sources have been properly credited

Signature of the student: Date:

I affirm that this work is my original creation, derived from my own research, and I have properly acknowledged all materials and sources used in its development, including books, articles, reports, lecture notes, and any other documents or personal communications.

I affirm that I have not submitted this assignment for evaluation in any other course without explicit permission from all relevant unit coordinators, nor have I reused it in this unit Additionally, I confirm that I have not copied or plagiarized ideas from others in any manner.

LIST OF TABLES AND FIGURES vii

CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE :

2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE) (LO2) 11

2.1 Give explanations of what procedural, object-oriented and event-driven paradigms are; their characteristics and the relationship between them (P2) 11

2.1.1 The definition of programming models 11

2.1.2 Characteristics of the programming models 18

2.1.3 Relationship between Procedural, Object-oriented, Event-driven 21

CHAPTER3: THE PROCESS OF DEVELOPING A SOFTWARE USING AN

3.1 Write a program that implements an algorithm using an IDE (P3) 23

3.2 Explain the debugging process and explain the debugging facilities available in the IDE (P4) 28

3.3 Integrates many programs such as code completion, compiler, editor Outline the coding standard you have used in your code (P5) 31 vi

3.4 Analyze the common features that a developer has access to in an IDE (M2) 37 3.5 M3 Use the IDE to manage the development process of the program 41

3.6 Evaluate how the debugging process can be used to help develop more secure, applications

LIST OF TABLES AND FIGURES

Figure 15:windows Forms app NET Framework 24

Figure 20: Code to run the program 26

Figure 23: Error in the program Error! Bookmark not defined

Figure 24:Line show Error 30 viii

Figure 38: Information of each bug 39

Figure 40: This is start program 40

This article emphasizes the importance of understanding various programming models, including procedural, object-oriented, and event-oriented programming It highlights the structure of a program and basic data concepts while introducing students to Integrated Development Environments (IDEs), their functions, and standard coding conventions Additionally, the content aims to equip students with the foundational knowledge necessary for building basic applications.

At the same time, it assists students in learning how to create simple apps Let's find out in this assignment!

This report includes the following:

PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE

Give explanations of what procedural, object-oriented and event-driven

paradigms are; their characteristics and the relationship between them (P2)

2.1.1 The definition of programming models

Procedural programming is a programming paradigm centered on executing sequences of instructions This approach emphasizes dividing programs into named instruction sets known as procedures, similar to functions.

Event-driven programming is a programming model that executes business logic within the program's source code, where the flow of execution is dictated by events These events can include user actions, system changes, or messages from other programs, allowing for a dynamic and responsive application structure.

Click the button on the screen

Press the key on the keyboard

Receive messages from other programs or threads o Example of event-driven programming:

Events.NET is a versatile framework that utilizes events extensively, particularly in UI frameworks like Windows Forms and WPF Additionally, this event-driven model is prevalent across various other libraries, enhancing functionality and interactivity.

We will do a small example with windows Forms to illustrate Since this is not a

Windows Forms lesson, we will still use a regular Console project for simplicity

Step 1: Create a new Console project

Step 2: Refer to the System.Windows.Forms assembly as follows:

Object-oriented programming (OOP) is a programming paradigm that simplifies problem-solving by organizing code into objects and their relationships, making it easier to develop and maintain Each object encompasses properties (data) and behaviors (methods) To effectively design and program using OOP, it is essential to grasp the four core principles: encapsulation, inheritance, polymorphism, and abstraction.

2.1.2 Characteristics of the programming models

State the characteristics and advantages, disadvantages of the 3 models

Procedural programming utilizes a top-down approach, breaking down programs into manageable blocks of code known as functions, each designated for a specific task This methodology effectively models real-world processes through 'procedures' that operate on 'data' The advantages of procedural programming include improved organization, easier debugging, and enhanced code reusability.

- Adopted by many general-purpose programming languages

- Enhances the reusability of the code

- Makes the Implementation of algorithms easy

- Simplifies the code and makes it easy to understand

- Tracking the program flow is easy as the same flow linearly o Disadvantages

- Not much practical for solving real-world problems

- Programs created using this programming paradigm are complex

Encapsulation: Encapsulation allows to hide information and internal processing properties of the object

Inheritance is a widely utilized feature in programming that enables the creation of a new class, known as the Child class, which inherits and reuses properties and methods from an existing class, referred to as the Parent class.

Abstraction: Abstraction eliminates the unnecessary complexity of the object and focuses only on what is essential and important d Figure : Abstraction 14 o Advantages

- We can reuse the code multiple times using class

- Inherit the class to subclass for data redundancy

- It is easy to maintain and modify

- It maintains the security of data

- Size is larger than other programs

- It required a lot of effort to create

- It is slower than other programs

- It is not suitable for some sorts of problems

- It takes time to get used to it

The tutorial event feature utilizes object-oriented construction, incorporating elements such as text boxes, buttons, and labels It has been enhanced to address event capture issues related to mouse actions, including hover and press This approach is widely applied in the development of graphical user interfaces (GUIs) for applications like Win-Forms and games, providing significant advantages in user interaction and experience.

- It allows more interactive programs Almost all modern GUI programs use event driven programming

- It can be done using hardware interrupts, which will reduce the power usage of the computer

- it allows sensors and other hardware to easily interact with the software o Disadvantages

- For simple programs, event-driven programming is often more complex and cumbersome than batch programming

- Program flow is often less logical and clear

2.1.3 Relationship between Procedural, Object-oriented, Event-driven

Procedural programming involves outlining a program and its subprograms as a sequence of steps, whereas declarative programming focuses on describing the desired outcome without specifying the steps needed to achieve it.

- Object oriented programming is a way of organizing code around the principles of encapsulation, inheritance, substitution, programming to interfaces, and so on Object oriented programs are usually mostly procedural

Creating your own event loop can enhance your programming experience, allowing you to leverage various libraries that integrate seamlessly with the system's event loop While event-based programming often employs an object-oriented approach, it is not exclusively limited to this style.

- These three categories are thus not related strictly hierarchically, but in common usage they are mostly nested within one another

CHAPTER 3 THE PROCESS OF DEVELOPING A : SOFTWARE USING AN INTERGRATED DEVELOPMENT

3 Implement basic algorithms in code using an IDE.(LO3) and determine the debugging process and explain the importance of a coding standard (LO4)

Write a program that implements an algorithm using an IDE (P3)

We will code a problem that solves an equation, finding the largest of three digits It includes:

- Solve the equation of max 2 , max3, find the largest number

-We use windown forms and C# language to code this software

- I designed a problem with 3 buttons search, delete, and exit

- 4 labels and 4 textboxes to input number and show result

- 2 radio buttons and a group box to group them together

-First I created 3 textboxes to enter the results in to enter the numbers to find the largest number

-Next will select the radio buttons to choose 2 values or 3 values

-Finally select search to display the results in the lable output

Solve the first order algorithms of the equation:

-First, in order of importance, we ask the user to enter any 3 numbers such as 6, 8, 9 at the button number1,number2,number3

- then the user will choose either max2 or max3 to select the value if the user chooses max2, then number1 and number 2 will display number 6 and 8

- if the user chooses max3, it will show 3 numbers 6, 8, 9 in lable number1,number2,number3 When the user clicks search, the lable output will display the largest number of 9

So the problem was run successfully and met the requirements

I will write a program for the problem max2,max3 to find the largest number and use windows forms to design the interface of the problem

Step1: First, we create a project file and then choose Windown Forms Application (.Net Frame Work)

Figure :windows Forms app NET Framework 15

Step2: We have a pattern like the picture Next, we select the toolbox create the IDE to

Step3: We design the main interface of the program as shown below:

The main interface of the program

Figure : Designs windows forms 17 Step 4 Next, we write the code for the program :

Figure : Code to run the program 20

- we choose max 2 then we will give the result like this

Figure : Result Choose max 2 21 Conversely, if you choose max3, the input will display 3 number values

28 in the IDE (P4) o Definition Debugging

Debugging is a crucial multistep process in computer programming and engineering that entails identifying and isolating problems, followed by correcting the issue or finding an alternative solution The final phase of debugging involves testing the correction or workaround to ensure its effectiveness.

Identify errors: Save time and avoid errors at the user's site Identifying errors at an earlier stage reduces the numbr errors and wasted time of

Locate Errors: It is recommended to find the exact location of the error to fix the error and execute the code faster

Error analysis is crucial for identifying and mitigating errors or failures in applications By thoroughly examining each error, we can resolve issues that may trigger subsequent problems, ultimately streamlining the application process and enhancing overall performance.

Analytical Proof: Once we have finished analyzing the error, we need prove the to analysis It uses a test automation process to write test cases through the test framework

Covering up side damages: Bugs can be resolved by making the appropriate changes and moving on to the next phases of the code or program to correct other errors

Fix and Validate: This the final stage check all new bugs, changes software is to in or program and execute the application

Example about debugging in IDE

I wrote a problem about finding the greatest common divisor and it has errors and I will correct it to make it work

The errors of the problem below are:

Here is the code that shows all the errors of the problem:

Figure 23: Error in the program

The image below shows us that the problem is wrong on lines 21, 17, 11

In line 11 the declaration is missing a sign ; so the report is false and we have to add a ; ] [

The 17th line, the data type declared is wrong, we have to fix it as shown below:

In line 21 the main method is declared wrong, so the problem is faulty We fix the error as follows: class void => static void

After fixing the errors, we proceed to run and check if the problem has been completely corrected

And this is the result after we successfully fix the error, the result is as shown below:

3.3 Integrates many programs such as code completion, compiler, editor

Outline the coding standard you have used in your code (P5)

- The opening braces must a straight column with the closing brace be in

- Each sub-instruction a block must indented in be

- Makes the source code easier to read

- The length the functions should not of be too large

- Avoid using naming numbers for variables

- Global variable names begin using capital letters the beginning each word at of

- The constants should capitalized be

- Limit the use global variables of

- Use comments to explain each function, each variable

- The naming convention for variables

- Naming meaningful and easy to understand

The name of the function:

- The first letters need to capitalized be

- Need to describe its function so that concise it is

Some example set name for winform:

OBJECT NAME SET NAME FOR OBJECT EXAMPLE

Numeric Up Down nud nudHour

- You have applied for an intern position of a software development company and been invited for an interview You passed the presentation demonstrating your problem solving and basic programming skills

- You are now given a more challenging task to create a fully functional, secure application that has been developed with an IDE and adheres to coding standards for a detailed business problem

- With the current complicated conditions of the epidemic, information technology is becoming more and more popular among all people

- Developing an application that can support adding and removing accounts

I am developing an application that allows users to add and delete accounts, with the entered information being stored in a ListView format featuring corresponding information columns.

This program will be developed using C# within Microsoft Visual Studio, an integrated development environment (IDE) that offers essential features to simplify and enhance the coding experience.

Describe the idea of the program algorithm:

We have created formrs with the following controls

1 Panel to create a title for the application

2 GroupBox with two different parts, 1 part with operations and 1 part to perform input and display information

3 Button with 3 functions that are Add, Del and Exit

3 TextBox to enter the corresponding information is Name Acc, Password Acc and ID

1 ListView to store the information of the created account then i named the textbox textbox Account name = txt_name textbox Account password= txt_pass texttbox ID = txt_ID

To enhance user experience, we will design a form that includes fields for Account Name, Account Password, and ID The interface will feature buttons for adding and deleting accounts, as well as an option to exit the application Additionally, a ListView will be implemented to showcase the information entered by the user.

The delete button allows users to remove their desired account by selecting it and clicking the delete account option, which will then prompt a confirmation command.

"you want to delete" then click ok, the account will be deleted will be deleted afterwards

The Exit application button prompts the user to confirm their desire to exit the program If the user selects "YES," the program will close; however, if "NO" is chosen, the exit command will be canceled.

Figure : Forms account manager 29 o Add Account

Figure : Forms account manager 30 o Delete Account

Figure :Forms account manager 31 o Exit Application

3.4 Analyze the common features that a developer has access to in an IDE (M2)

An Integrated Development Environment (IDE) is a comprehensive platform designed for application development, offering essential tools such as a compiler, interpreter, and error checking It enhances coding efficiency through features like code formatting, syntax highlighting, and organized code folder management, making it easier to search and navigate through code.

Figure : IDE 36 Functions of the IDE

Most Integrated Development Environments (IDEs) feature a text editor specifically designed for writing and manipulating source code While some tools may include visual elements for dragging and dropping user interface components, the majority offer straightforward interfaces with language-specific syntax highlighting, as seen in editors like Turbo Pascal and Notepad++.

Debugging tools are essential for programmers and software engineers, as they assist in identifying and rectifying errors within source code These tools simulate real-world scenarios to effectively test functionality and performance, enabling developers to examine various segments of code By utilizing debugging tools, programmers can detect and resolve bugs prior to the release of an application, ensuring a smoother and more reliable user experience.

Compilers are essential tools that convert programming languages into machine-readable formats, like binary code They analyze the machine code for accuracy and subsequently parse and optimize it to enhance performance.

Figure : Information of each bug 38

Code completion: Code complete features assist programmers by intelligently identifying and inserting common code elements These features help developers save time coding and reduce the chance of syntax errors

Figure : This is start program 40

When selecting an Integrated Development Environment (IDE), it's essential to consider the programming language you are using, as most IDEs are tailored to specific languages However, some IDEs, like Sublime Text, provide support for multiple languages, offering greater flexibility for developers.

3.5 Use the IDE to manage the development process of the program (M3)

When selecting an Integrated Development Environment (IDE) for application development, it's crucial to choose one that aligns with your programming language In this context, I will utilize the C# programming language and leverage Visual Studio for creating and managing applications effectively.

Step 1: we want to install visual studio This is probably an IDE well known for its use in development management and application creation we should always install the latest version for more features to use

On the correct side, there are functions wont open files other folders or create to in new file

Open a project solution: or wont open the project within the default directory to that Visual studio had installed before

Open a neighborhood folder: accustomed open a project you downloaded or open a project you saved in another folder

Create a replacement: wont to create a replacement project

We will learn the way make a project using the "create a brand new project" to function

42 middle part will appear select tabs like which language, what operating system to program in, and areas programming like IoT, web, winform, desktop, game, library in

In this section, we are going try and create a project using C # language to on the windows software package

We enter a name, choose a folder save and choose the appropriate framework, and to press "create" to let the IDE create the workspace

In this interface, the IDE will make the code available before it works.to us

We enter a name, choose a folder save and choose the appropriate to framework, and press "create" to let the IDE create the workspace

In this interface, the IDE allows us to access the code before execution We now have a workspace to begin our programming journey Our first simple program will display the line "do quang trung" on the screen.

3.6 Evaluate how the debugging process can be used to help develop more secure, robust applications.(M4)

Introduction to Visual Studio Debugging

Integrates many programs such as code completion, compiler, editor Outline the

Outline the coding standard you have used in your code (P5)

- The opening braces must a straight column with the closing brace be in

- Each sub-instruction a block must indented in be

- Makes the source code easier to read

- The length the functions should not of be too large

- Avoid using naming numbers for variables

- Global variable names begin using capital letters the beginning each word at of

- The constants should capitalized be

- Limit the use global variables of

- Use comments to explain each function, each variable

- The naming convention for variables

- Naming meaningful and easy to understand

The name of the function:

- The first letters need to capitalized be

- Need to describe its function so that concise it is

Some example set name for winform:

OBJECT NAME SET NAME FOR OBJECT EXAMPLE

Numeric Up Down nud nudHour

- You have applied for an intern position of a software development company and been invited for an interview You passed the presentation demonstrating your problem solving and basic programming skills

- You are now given a more challenging task to create a fully functional, secure application that has been developed with an IDE and adheres to coding standards for a detailed business problem

- With the current complicated conditions of the epidemic, information technology is becoming more and more popular among all people

- Developing an application that can support adding and removing accounts

I am developing an application that allows users to add and delete accounts, with all entered information being stored in a ListView, organized into corresponding columns for easy access and management.

This program will be developed using C# in Microsoft Visual Studio, an integrated development environment (IDE) that offers essential features to facilitate easy and convenient coding.

Describe the idea of the program algorithm:

We have created formrs with the following controls

1 Panel to create a title for the application

2 GroupBox with two different parts, 1 part with operations and 1 part to perform input and display information

3 Button with 3 functions that are Add, Del and Exit

3 TextBox to enter the corresponding information is Name Acc, Password Acc and ID

1 ListView to store the information of the created account then i named the textbox textbox Account name = txt_name textbox Account password= txt_pass texttbox ID = txt_ID

To enhance user experience, we will design a form that includes fields for Account Name, Account Password, and ID The interface will feature functional buttons such as "Add Account," "Delete Account," and "Exit Application." Additionally, a ListView will be implemented to showcase the information entered by the user, ensuring easy access and management of their accounts.

The delete button allows users to easily remove their desired account by selecting it and clicking on the delete account option, which will then prompt a confirmation command.

"you want to delete" then click ok, the account will be deleted will be deleted afterwards

The Exit application button prompts users to confirm their desire to exit the program If the user selects YES, the program will close; if NO is chosen, the exit command will be canceled.

Figure : Forms account manager 29 o Add Account

Figure : Forms account manager 30 o Delete Account

Figure :Forms account manager 31 o Exit Application

3.4 Analyze the common features that a developer has access to in an IDE (M2)

An Integrated Development Environment (IDE) is a comprehensive platform designed for application development, offering essential tools such as compilers, interpreters, and error-checking features It enhances the coding experience by providing code formatting, syntax highlighting, and efficient code organization, making it easier for developers to search and manage their code effectively.

Figure : IDE 36 Functions of the IDE

Most Integrated Development Environments (IDEs) feature a text editor tailored for writing and manipulating source code While some tools incorporate visual elements for drag-and-drop user interface design, the majority offer straightforward interfaces with language-specific syntax highlighting, exemplified by programs like Turbo Pascal and Notepad++.

Debugging tools are essential for identifying and resolving errors in source code, allowing programmers and software engineers to simulate real-world scenarios to test functionality and performance These tools enable the testing of various code segments, helping to identify bugs before the application is released.

Compilers are essential tools that convert programming languages into machine-readable formats, like binary code They analyze machine code for accuracy and subsequently parse and optimize it to enhance performance.

Figure : Information of each bug 38

Code completion: Code complete features assist programmers by intelligently identifying and inserting common code elements These features help developers save time coding and reduce the chance of syntax errors

Figure : This is start program 40

When selecting an Integrated Development Environment (IDE), it's essential to consider the programming language you are using, as many IDEs are tailored to specific languages However, some IDEs, like Sublime Text, provide support for multiple languages, making them versatile options for developers.

3.5 Use the IDE to manage the development process of the program (M3)

When managing application development, selecting an Integrated Development Environment (IDE) that aligns with your programming language is crucial For instance, utilizing the C# programming language, Visual Studio serves as an effective tool for creating and managing applications.

Step 1: we want to install visual studio This is probably an IDE well known for its use in development management and application creation we should always install the latest version for more features to use

On the correct side, there are functions wont open files other folders or create to in new file

Open a project solution: or wont open the project within the default directory to that Visual studio had installed before

Open a neighborhood folder: accustomed open a project you downloaded or open a project you saved in another folder

Create a replacement: wont to create a replacement project

We will learn the way make a project using the "create a brand new project" to function

42 middle part will appear select tabs like which language, what operating system to program in, and areas programming like IoT, web, winform, desktop, game, library in

In this section, we are going try and create a project using C # language to on the windows software package

We enter a name, choose a folder save and choose the appropriate framework, and to press "create" to let the IDE create the workspace

In this interface, the IDE will make the code available before it works.to us

We enter a name, choose a folder save and choose the appropriate to framework, and press "create" to let the IDE create the workspace

In this interface, the IDE allows us to access the code before execution We now have a workspace where we will create our first simple program to display the line "do quang trung" on the screen.

3.6 Evaluate how the debugging process can be used to help develop more secure, robust applications.(M4)

Introduction to Visual Studio Debugging

The debugging process in Visual Studio is essential for programmers to identify and fix errors in their code As programming errors are common, utilizing Visual Studio provides an efficient environment for debugging and completing projects effectively.

Give a review of the debugging process in Visual Studio

The Visual Studio debugger is an invaluable tool for programmers, offering numerous features and shortcuts that enhance productivity and streamline the debugging process However, users may encounter challenges, such as occasional freezes and errors during debugging, which can hinder project completion.

Ngày đăng: 13/04/2025, 16:41

TỪ KHÓA LIÊN QUAN