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
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)…
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
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
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:
Perfomed Student LE TRAN QUOC BAO 2
When running the program will get results
Figure 2-1 Example for Procedural 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
Receive messages from other programs or threads
For example: Generate electricity bill
Perfomed Student LE TRAN QUOC BAO 8
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
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
Perfomed Student LE TRAN QUOC BAO 9
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
2.1.5 What is the difference between procedural programming (POP) and object-ori- ented programming (OOP)
Basic Procedure/Structure oriented Object oriented
Approach Top-down Bottom-up
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 of a class
Division Large program is divided into units called functions
Entire program is divided into objects
Perfomed Student LE TRAN QUOC BAO 10
No access specifier observed Access specifier are "public", "private",
Neither it overload functions nor operators It overloads functions, constructors, and operators
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
Example C, VB, FORTRAN, Pascal C++, JAVA, VB.NET, C#.NET
Table 2-1 Compare POP and OPP
Perfomed Student LE TRAN QUOC BAO 11
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.
Perfomed Student LE TRAN QUOC BAO 12
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
Perfomed Student LE TRAN QUOC BAO 13
Figure 2-13 Debugging in Visual studio
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
Perfomed Student LE TRAN QUOC BAO 14
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.
Perfomed Student LE TRAN QUOC BAO 15
IDE problems, debugging procedures, and coding standards…
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
Perfomed Student LE TRAN QUOC BAO 16
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)
Perfomed Student LE TRAN QUOC BAO 17
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
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
Perfomed Student LE TRAN QUOC BAO 18
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
Perfomed Student LE TRAN QUOC BAO 19
Step 6: To edit you can edit in the Properties of the components
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:
Perfomed Student LE TRAN QUOC BAO 20
Perfomed Student LE TRAN QUOC BAO 21
Perfomed Student LE TRAN QUOC BAO 22
Perfomed Student LE TRAN QUOC BAO 23
Perfomed Student LE TRAN QUOC BAO 24
Figure 3-6: Example of IDE project
Step 8: After saving your project, press F5 or the Start button on the toolbar to run the program Once running, enter your information and find yours in the search section The result is as shown below
Perfomed Student LE TRAN QUOC BAO 25
Use the IDE to manage the development process of the program(M3)…
If we want to use a good IDE suitable for our work, we need to choose a language in the IDE that is suitable for our individual and intended use for me here i will use the c# programming language and the way it uses to create a program I use Visual Studio software to manage and test them
Step 1: Step 1: first we need to download a new and suitable programming language here I use visual studio code 2019 it can be considered a quite famous and very popular programming language
Once installed and open it, we will get something like below
Perfomed Student LE TRAN QUOC BAO 26
Figure 3-8 Create a new project or open project
On the screen will appear two main interface parts:
• On the left side of the interface, it will show all the drafts that you have
• On the right side of the interface there is a function to open files in other folders and create new files
• Open project or solution: used to open the project in the default folder previously installed by Visual studio
• Open local folder: it is used to open a project that you created earlier and is saved in a certain folder
• Create a new project: used to create a new project
Step 2: Create new project by clicking on create new project
Perfomed Student LE TRAN QUOC BAO 27
• After you click new item, or press "New item " Then, a new window ap- pears
Perfomed Student LE TRAN QUOC BAO 30
We will select an item and give it a name In this picture, I choose "class"
Figure3-17 Workspace of class in Visual Studio
I will use break-point, by clicking on the left sidebar it will appear a red dot, so I can see how the program does the steps
Figure3-18 Set breakpoint in Visual studio
Then press