1 LO2 Explain the characteristics of procedural, object-oriented and event driven programming, conduct an analysis of a suitable Integrated Development Environment IDE…...1 2.1 Give expl
Trang 1BTEC FPT INTERNATIONAL COLLEGE
INFORMATION TECHNOLOGY
ASSIGNMENT 2 UNIT: PROGRAMMING
STUDENT : LE TRAN QUOC BAO CLASS : IT05102
STUDENT ID : BD00033
SUPERVISOR : NGUYEN HOANG ANH VU
DaNang, August 2022
Trang 2ASSIGNMENT 2 FRONT SHEET
Qualification BTEC Level 4 HND Diploma in Computing
Unit number and title Unit: Programming
Trang 3i
Summative Feedbacks: Resubmission Feedbacks:
Internal Verifier’s Comments:
Signature & Date:
Trang 4ii
ACKNOWLEDGMENTS
First of all, I would like to express a special and enormous thanks to my family for their invaluable encouragement, enthusiasm, and support Without all of this, I couldn't have achieved it Second, I would like to sincerely thank teacher NGUYEN HOANG ANH VU for enthusiastically supporting me to achieve my academic results and thanking him for his support in the exercises as well as the knowledge that he taught and taught solve whole- heartedly.Besides, I would also like to thank my friends at BTEC FPT International College for allowing me to exchange knowledge and help me understand the issues in this course Finally, I would also like to thank the authors, brothers, sisters and friends who have pro-
vided a lot of knowledge to use as references throughout this exercise
Trang 5iii
ASSURANCE
I certify that this assignment is my work, based on my study and that I have acknowledged all material and sources used in its preparation, whether they be books, articles, reports, lecture notes, and any other kind of document, electronic or personal communication I also certify that this assignment has not previously been submitted for assessment in any other unit, except where specific permission has been granted from all unit coordinators involved, or at any other time in this unit, and that I have not copied in part or whole or otherwise stealing ideas the work of other persons
Learners declaration
I certify that the work submitted for this assignment is my own and research sources are fully acknowledged
LE TRAN QUOC BAO
Trang 6CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE 1
LO2 Explain the characteristics of procedural, object-oriented and event driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE)… 1
2.1 Give explanations of what procedural, object-oriented and event-driven paradigms are;their characteristics and the relationship between them (P2)… 1
2.1.1 Procedure-Oriented Programming(POP) 1
2.1.2 Event-driven programming 2
2.1.3 Object-oriented programming (OOP)… 5
2.1.4 Characteristics of the programming models… 6
2.1.5 What is the difference between procedural programming (POP) and object-oriented programming (OOP)… 9
2.2 Analyze the common features that a developer has access to in an IDE(M2)… 10
2.2.1 IDE definition 10
2.2.2 Basic features of common IDE… 10
2.2.3 Benefits of IDE for programmers… 13
CHAPTER 3 IDE problems, debugging procedures, and coding standards… 14
LO3 Implement basic algorithms in code using an IDE 14
LO4 Determine the debugging process and explain the importance of a coding standard 14 3.1 Write a program that implements an algorithm using an IDE(P3) 14
3.2 Use the IDE to manage the development process of the program(M3)… 23
Trang 7v 3.3 Evaluate the use of an IDE for development of applications contrasted with not using an
Trang 8vi
LIST OF TABLES AND FIGURES
Table 2-1 Compare POP and OPP 9
Table 3-1: Some coding standard… 36
Figure 2-1 Example for Procedural programming 2
Figure2-2 CODE 4
Figure 2-3 Result… 5
Figure 2-4 Object Oriented Programming (OOP)… 5
Figure 2-5 algorithm results… 6
Figure2-6 Abstraction 8
Figure 2-7 Encapsulation 8
Figure 2-8 Inheritance 8
Figure 2-9 Polymorphism 8
Figure 2-10 Example about text editor in Visual studio… 11
Figure2-11 This is a debugger in Visual studio 11
Figure2-12 Debugging in Visual studio… 12
Figure2-13 Debugging in Visual studio… 12
Figure 2-14 Several languages are supported in Visual Studio… 13
Figure 3-1 Main interface 15
Figure 3-2 Create new project… 16
Figure 3-3 Main Form 17
Figure 3-4 Adding elements to form 18
Figure 3-5: Element properties… 22
Figure 3-6 Example of IDE project… 22
Figure 3-7 results… 23
Figure 3-8 Create a new project or open project… 24
Figure 3-9: Create a new project… 25
Trang 9vii
Figure 3-10: Choose project templates… 26
Figure 3-11: Set the name of the new project and select a framework 26
Figure 3-12: Introduce workspace in Visual studio… 27
Figure 3-13 count the factorials from 1 to n 27
Figure 3-14 Result… 28
Figure 3-15: Create a new item in Visual studio 28
Figure3-16: Create a new class… 29
Figure3-17 Workspace of class in Visual Studio… 29
Figure3-18 Set breakpoint in Visual studio… 30
Figure3-19 How to follow the program 30
Figure3-20 Some IDEs 31
Figure3-21 Result… 32
Figure3-22 Result… 36
Figure3-23 Program has error… 39
Figure3-24 IDE debugger find error 39
Figure3-25 The program is out of error 40
Figure3-26 For example 41
Figure 3-27 The program has a line of code with the wrong keyword 41
Figure 3-28 Symbolic of Coding standards… 46
Figure 3-29 Form Design 47
Figure 3-30 Code Form 48
Figure 3-31 Finish form 49
Figure 3-32 Test 49
Trang 10viii
INTRODUCTION
Programming is one of the subjects to master the knowledge base, understanding programming models such as procedural programming, object-oriented programming, and event-oriented programming, the structure of a program, data, basic data, at the same time to introduce to students the knowledge of IDE, the functions of the IDE and some standard rules, rules of naming in code At the same time, it helps students gain knowledge to build basic applications
This report includes the following:
CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE LO2 Explain the characteristics of procedural, object-oriented and event driven
programming, conduct an analysis of a suitable Integrated Development Environment (IDE) CHAPTER 3 IDE problems, debugging procedures, and coding standards
LO3 Implement basic algorithms in code using an IDE
LO4 Determine the debugging process and explain the importance of a coding standard
Trang 112.1 Give explanations of what procedural, object-oriented and event-driven paradigms are;their characteristics and the relationship between them (P2)
Programming:
Programming is a job where programmers design, build, and maintain computer programs (software) People who do programming work are called programmers Using available code, programming languages, and utilities, they build, debug, or improve programs, applications, games, software, websites, processing systems, and more Help users interact with each other through electronic devices or execute commands with computers
2.1.1 Procedure-Oriented Programming(POP):
POP is a way to establish information Procedural programming is the main focus for completing tasks sequentially supporting the concept of procedure calling Procedures (regular form or subroutine) simply contain a series of steps Calculations be done Save control of the program's organizational flow If the program is extensible, it is structured in a number of small units called functions, which share data system-wide
A function:
Structured Programming (POP) is a programming technique that divides a large program into many small programs, and the programs are analyzed into several parts to complete a large program called a function Each function will take on a different function in the system The small process will be done until the function is simplified
This purpose is to simplify the structure of the program
For example: Create a recursive function to calculate the factorial of a number
The first is to create the main function:
Trang 122
When running the program will get results
Figure 2-1 Example for Procedural programming
2.1.2 Event-driven programming:
Event-oriented programming is a method of building a system based on developing a graphical interactive interface through objects and defining the behavior of the system through the events of the objects In software development, events -driven programming is a programming model in which all business logic is performed in the program's source code The program's runtime flow will be determined based on events Events here can be:
Click the button on the screen Press the key on the keyboard Hover
Timeout
Receive sensor output signal
Receive messages from other programs or threads …
For example: Generate electricity bill
Trang 188
Figure2-6: Abstraction
Encapsulation: This property does not allow the user of the object to change
the internal state of an object Only the internal methods of the object allow to change its state How the external environment is allowed to affect an object's internal data is entirely up to the coder This property ensures the integrity of the object
Figure 2-7 Encapsulation
Inheritance: This property allows an object to have properties that another object
already has through inheritance This allows objects to share or extend existing properties without having to redefine them However, not all object-oriented languages have this property
This means that the parent class can share data and methods among classes Subclass from must be DEFINITION, outsiders can extend inherited elements and add new ones Reuse source code Optimize one way, make use of source code
Trang 199
Polymorphism: Expressed through sending messages (message) Sending
these messages is comparable to calling the internal functions of an object The methods used to respond to a message will respond differently depending on the object to which the message is sent The programmer can define a property (by method names, for example) for a series of close-by objects, but when implemented using the same name, the implementation of each object will be automatic occurs according to the characteristics of each object without confusion
Figure2-9 Polymorphism
2.1.5 What is the difference between procedural programming (POP) and object-ori- ented programming (OOP)
BASIS FOR COMPARISON
Basis Main focus is on "how to get the task done"
i.e on the procedure or structure of a
program
Main focus is on 'data security' Hence, only
objects are permitted to access the entities
Trang 2010
BASIS FOR COMPARISON
Inheritance Their is no provision of inheritance Inheritance achieved in three modes public
private and protected
Data hiding & security There is no proper way of hiding the data, so
data is insecure
Data is hidden in three modes public,
private, and protected hence data security
increases
Data sharing Global data is shared among the functions in
the program
Data is shared among the objects through
the member functions
Friend functions or
friend classes
No concept of friend function Classes or function can become a friend of
another class with the keyword "friend"
Note: "friend" keyword is used only in c++
Virtual classes or
virtual function
No concept of virtual classes Concept of virtual function appear during
inheritance
Table 2-1 Compare POP and OPP
Trang 2111
2.2 Analyze the common features that a developer has access to in an IDE(M2) 2.2.1 IDE definition: IDE (short for Integrated Development Environment) integrated
environment used to write, develop code for applications
In addition, the IDE is also integrated with other support tools such as compiler, error checking, information service, directory organization code, search code, formatting highlight code IDE will make it more convenient and easier for you to develop applications without an IDE At that time, you can still write the source code, because in fact, the source code of a certain programming language can run, you just need the corresponding compiler of that language itself
The IDE also has a compiler or interpreter built into it From there, it helps you to execute code directly while programming the application Typically: Visual Studio, Eclipse, Xcode, Android Studio,
2.2.2 Basic features of common IDE:
Text editor: code editor is a feature designed to write and edit code.
Figure 2-10 Example about text editor in Visual studio
Debugger: Debugging tools help programmers identify errors in the source code
When there is an error, it will report the error to the programmer and indicate the error line so that the programmer knows and corrects the error.
Trang 2212
Figure 2-11 This is a debugger in Visual studio
Compiler: is the component that translates from this programming language into a
computer-processable language, such as binary code.
Code completion: Full code features help programmers by intelligently detecting
and adding common code elements These features help developers save coding time and reduce syntax capabilities law.
Figure 2-12 Debugging in Visual studio
Trang 2313
Programming language support: IDEs are typically specific to one programming
language, however, some applications such as Sublime Title and Visual Studio are supported in multiple languages Before we go into coding, we need to find out the language we want to use and then choose a suitable IDE.
Figure 2-14 Several languages are supported in Visual Studio
Trang 2414
2.2.3 Benefits of IDE for programmers:
The IDE allows developers to start setting up new applications quickly because many add-ons do not need to be configured and are actively manual as part of the setup process Developers also don't need to spend time learning how to use different tools when all utilities are combined into one
This can be special owner is help the new member settings, these people can rely on the IDE to get up to speed on specified tools and jobs In fact, most of the IDE's features are aimed at saving time, like smart code completion and code auto-generation, eliminating the whole string character problem
Various feature popular IDEs are intended to help developers organize their processes and solve problems IDE parsing code when it was writing, because that the error give up by the HUMAN was identified in quick time.
Trang 2515
CHAPTER 3 IDE problems, debugging procedures, and coding standards
LO3 Implement basic algorithms in code using an IDE
LO4 Determine the debugging process and explain the importance of a coding standard
3.1 Write a program that implements an algorithm using an IDE(P3)
I will write an event-driven program that creates a Windows form to manage employee information First, I will talk about the properties of the components that I will use to write the program:
I write software to manage employee information and find employee information, it includes:
Enter information: Staff code, full name, date of birth, hometown, Age, Gender, salary
In the information section, I use 3 buttons "Button" The first button I named " Additional" is used to add the data I entered above into the system, the second button is named "Amend" it has a function to correct information when we fill in the wrong information, the third button is called "Delete" it has the function of de- leting information on the system we entered
I use the "TextBox" button to record the employee's information and there is a "DateTime picker" button that has the function to select the date of the year Find employee information by searching by hometown, Gender, hometown In the search section, I use the "checkBox" button to mark the information I need
to search and I also use the "Button" button called "search" it has the function of searching for data information on the system the system that I entered earlier in the information section
These are the steps I took to create a cinema simulation from Visual Studio software
Step 1: Create a new Project
Trang 2616
Figure 3-1 Main interface
Step 2: when entering the previously created project, we will create window forms in
that project I will show you the steps to do it with pictures as follows First we right click on ConsoleApp1
After right clicking on ConsoleApp1, it will appear on the table, click Add and then we select Form(windows form)
Trang 2717
After selecting the Form (window form) it will ap+pear a table for us to name the project
Step 3: Enter a name for the project Here I will default to the initial name is :Form1.cs
and click Add
Figure 3-2 Create new project
Step 4: In the Properties section of the Form you can change the Text as you like,
this is the title of the software Will appear in the upper left corner of the form Here I will leave the default as Form1
Trang 2818
Figure 3-3 Main Form
Step 5: You add the necessary components to the Form, here I will add Label,
TextBox, Button, Datatimepicker, Panel, ComboBox , and checkBox (These components are in the ToolBox section)
Figure 3-4: Adding elements to form
Trang 2919
Step 6: To edit you can edit in the Properties of the components
Figure 3-5: Element properties
Step 7: After preparing the interface, I start to code You double click on the button1
to capture the event (or the event in Properties) You can coding like a picturebelow:
Trang 3020
Trang 3121