Docsity

Programming Fundamentals: Implementing Algorithms and Debugging in an IDE, Summaries of Information Security and Markup Languages

Partial preview of the text

Download Programming Fundamentals: Implementing Algorithms and Debugging in an IDE and more Summaries Information Security and Markup Languages in PDF only on Docsity!

BTEC FPT INTERNATIONAL COLLEGE

INFORMATION TECHNOLOGY

ASSIGNMENT 2

UNIT: PROGRAMMING

STUDENT : NGUYEN TRINH ANH TUAN

CLASS : IT0510 2

STUDENT ID : BD000 96

SUPERVISOR : NGUYEN HOANG ANH VU

DANANG,AUGUST 2022

i

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 4 HND Diploma

in computing

Unit number and title Unit: Programming Submission date 14/8/2022 (^) Date received (1stsubmission)

Re-submission date Date received (2ndsubmission) Student name

NGUYEN TRINH ANH

TUAN

Student ID

BD000 96

Class

IT

Assessor name Nguyen Hoang Anh Vu Student declaration I certify that the assignment submission is entirely my own work and I fully understand theconsequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature: NGUYEN TRINH ANH TUAN

Grading grid:

P2 P3 P4 P5 M2 M3 M4 D2 D

i

ACKNOWLEDGMENTS

First of all, I would like to thank my teacher Nguyen Hoang Anh Vu for always supporting me in my studies and research, for my patience, motivation, enthusiasm and rich knowledge. His enthusiastic guidance has helped me throughout the time of researching and writing this thesis. Without your wonderful help, I would not have been able to achieve this. Besides the teacher, I would like to thank the friends who helped me improve my subject knowledge. Not only that, they are always there to support me when I need it. And besides, I would like to thank the school for creating all conditions for me to have all the facilities to help me complete my work well. Finally, I would like to thank my family: my parents, who gave birth to me from the beginning and always supported me mentally. They are always behind to care and give me more motivation to do well.

i Declaration of the learner I verify that the work I've submitted for this assignment is all my own, and that all research sources have been properly credited. Signature of the student: Date: TUAN

ASSURANCE

I declare that this is my work, based on my research, and that I have recognized all materials and sources utilized in its production, including books, papers, reports, lecture notes, and any other type of document, electronic or personal communication. I further declare that I have not previously submitted this assignment for assessment in any other unit, except where explicit permission has been granted by all unit coordinators involved, or at any other time in this unit, and that I have not duplicated or stolen ideas from the work of others in any way.

i M4 Evaluate how the debugging process can be used to help develop more secure, robust applications............................................................................................................. 33 Integrates many programs such as code completion, compiler, editor Outline the coding standard you have used in your code. (P5) ........................................................ 38 CRITICAL EVALUATION ........................................................................................ 45 CONCLUSION ........................................................................................................ 46 REFERENCES ....................................................................................................... 47

i

  • Figure 1Procedural programming LIST OF TABLES AND FIGURES
  • Figure 2Key features of Procedural Programming
  • Figure 3Flowchart: Program to solve quadratic equations
  • Figure 4Source code : Program to solve quadratic equations
  • Figure 5Output results
  • Figure 6Event-driven programming
  • Figure 7An example of Event-driven programming
  • Figure 8Object-oriented programming
  • Figure 9example of Object-oriented programming
  • Figure 10Integrated Development Environment (IDE)
  • Figure 11Environments (IDE):
  • Figure 12Unified development environments typically include................................
  • Figure 13Benefits of using IDE software
  • Figure 14Netbeans IDE
  • Figure 15Flowchart
  • Figure 16The interface
  • Figure 17Input table number.
  • Figure 18Export money...........................................................................................
  • Figure 19The code for export information on text box money
  • Figure 20Print bill
  • Figure 21refresh
  • Figure 22Code for refresh buton
  • Figure 23For the Exit button
  • Figure 24Code for Exit botton i
  • Figure 25Creating New Project and Opening Project
  • Figure 26Creating New Project and Opening Project
  • Figure 27Name the project
  • Figure 28Create a program design winform
  • Figure 29Name the winform
  • Figure 30Creating and editing source code
  • Figure 31Using toolbox to design software
  • Figure 32Code
  • Figure 33Code
  • Figure 34The result of the designed software
  • Figure 35The first error is missing using System.Windows.Forms;
  • Figure 36The second error is missing the ")" syntax
  • Figure 37The third error is missing the letter "d" in add
  • Figure 38The fourth error is missing public partial class Coffee_Shop : Form
  • Figure 39The fourth error is missing public partial class Coffee_Shop : Form
  • Figure 40First mistake
  • Figure 41 Second mistake
  • Figure 42 3rd error
  • Figure 43Fourth error
  • Figure 44Error handling
  • Figure 45Error handling
  • Figure 46Error handling
  • Figure 47Error handling
  • Figure 48 Run to Cursor
  • Figure 49 Find the First step of program
  • Figure 50Set break point.........................................................................................
  • Figure 51Press F11 i
  • Figure 52: Run to Click button.
  • Figure 53:Restart button.
  • Figure 54: Run code button
  • Figure 55Program has error.
  • Figure 56IDE debugger find error
  • Figure 57The program is out of error.
  • Figure 58The program has a line of code with the wrong keyword.
  • Figure 59Library
  • Figure 60Namespace..............................................................................................
  • Figure 61Main class
  • Figure 62 Name the interface
  • Figure 63 Class
  • Figure 64 Example naming convention
  • Figure 65 Table
  • Figure 66Table1
  • Figure 67Form Design
  • Figure 68Source code.............................................................................................
  • Figure 69Source code.............................................................................................
  • Figure 70Form Design
  • Figure 71Multiplication
  • Figure 72Plus
  • Figure 73Subtraction...............................................................................................
  • Figure 74Share calculation

i

INTRODUCTION

Programming plays an extremely important role in life. Coming to this report, we will learn about understanding programming models such as procedural programming, object- oriented programming, and event-oriented programming. As well as the structure of a program, data, and basic data, while also introducing students to the use of an integrated development environment (IDE), its functions, and some standard rules, such as naming in code. 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: CHAPTER2: PROBLEMS RELATED TO PROGRAMMING METHODS AND INTEGRATED DEVELOPMENT ENVIRONMENT (IDE)

  1. Explain the characteristics of procedural, object-oriented and event-driven programming, conductance analysis of a suitable Integrated Development Environment (IDE). (LO2)CHAPTER3: THE PROCESS OF DEVELOPING A SOFTWARE USING AN INTERGRATED DEVELOPMENT ENVIRONMENT(IDE)
  2. Implement basic algorithms in code using an IDE (LO3) and determine the debugging
  3. process and explain the importance of a coding standard (LO4)

i Key features of Procedural Programming

  • Predefined functions: Predefined functions are commands that are commonly identified by name.Predefined functions are typically written in advanced programming languages, but are derivedfrom libraries or registries rather than programs. Figure 2 Key features of Procedural Programming An example of proceduaral programming : Program to solve quadratic equations
  • To solve the problem, the programs are divided into subroutines, making the problem simple and easier to understandard Flowchart: Program to solve quadratic equations Figure 3 Flowchart: Program to solve quadratic equations Source code : Program to solve quadratic equations

i Figure 4 Source code : Program to solve quadratic equations Output results Figure 5 Output results Event-driven programming and give examples Event-driven programming is a computer programming model in which the control flow of a program is determined by the occurrence of events. These events are monitored by code called event handlers. If it detects that a specified event has occurred, it runs an event handler (a function or callback method that is fired when the event occurs).

i oriented programming. Most of the programmers have learned about object-oriented programming in university, but the basic principles of object-oriented programming are sometimes not understood, leading to misuse and incorrect philosophy of programming. object oriented. Figure 8 Object-oriented programming An example of Object-oriented programming Figure 9 example of Object-oriented programming

i 2.1.2 Characteristics of the programming models The Programming Paradigm is a way of classifying programming languages based on their characteristics. Programming languages can be classified into many programming paradigms. Some common programming models: Imperative programming is a programming paradigm that uses statements to change the state of a program. Procedure-oriented programming executes groups of statements in procedures/functions Object-oriented programming implements code that creates objects to abstract objects, Declarative programming in which the programmer declares the properties of the desired result, but does not compute it. Functional programming: the desired result is declared as the value sequence of the application function. Logical programming: based on mathematical logic in relationships and inferences Computational programming where the desired result is the solution of optimization problems For example : comparing imperative and declarative programming with C# language, for a set, find numbers that are not divisible by 2: With Imperative Programming, use statements to traverse a list of elements State the characteristics and advantages, disadvantages of the 3 models ➢ Event-driven programming Event-driven programming is a computer programming model in which the control flow of a program is determined by the occurrence of events. These events are monitored by code called event handlers. If it detects that a specified event has occurred, it runs an event handler (a function or callback method that is fired when the event occurs). In theory, all programming languages support the event-driven programming style, although some features of the language, such as closures, make it easier to implement. Other programming environments, such as Adobe Flash, are specifically designed to trigger program code on events. Characteristic

  • Service-Oriented: Service-oriented is a significant aspect of event-driven programming used to develop programs for services. It does not slow down the computer since service-oriented only uses a tiny percentage of the computer processing power, and services typically operate in the operating system's background.

i

  • The whole program is implemented based on actions such as reading, calculating and printing. Therefore, a bunch of functions are written to solve a program from top to down. - Global data is often shared by all functions.
  • Data moves openly from function to function. ➢ Object Orientated Programming : OOP languages are very popular and they are widely used in various different software applications and games. To think about this simply imagine an airplane it has 300 seats, two wings, 2 massive rotor fans and various controls. Now if we want to break it down we can create objects of those 300 seats and instead of making them one at a time we can design the perfect seat once and then have the program make 299 of them exactly the same way. In OOP programming this is called creating an OBJECT. That's the first word in OOP. To make an object in object oriented programming we give the object various different properties for example we need the height, width, color, fabrics, padding, cushion, adjustment features etc for the plane seat. All of them can be inside that one object and then we can use the program to add the chair 300 times to the plane job done right, its awesomely simple Characteristics:
  • Class definitions
  • Basic building blocks OOP and a single entity which has data and operations on data together
  • Objects – The instances of a class which are used in real functionality – its variables and operations - Abstraction – Specifying what to do but not how to do ; a flexible feature for having an overall view of an object's functionality. - Encapsulation – Binding data and operations of data together in a single unit – A class adhere this feature
  • Inheritance and class hierarchy – Reusability and extension of existing classes - Polymorphism – Multiple definitions for a single name - functions with same name with different functionality; saves time in investing many function names Operator and Function overloading - Generic classes – Class definitions for unspecified data. They are known as container classes. They are flexible and reusable. - Class libraries – Built-in language specific classes

i

- Message passing – Objects communicates through invoking methods and sending data to them. This feature of sending and receiving information among objects through function parameters is known as Message Passing. The relationship: Procedural, event-driven and object-oriented paradigms are used to classify programming languages. 2.1.3 Relationship between Procedural, Object-oriented, Event-driven. For relationship between 3 paradigms: The different between 3 paradigms the same with the different between functions, methods and procedures. Procedural programming uses variables to store the state of the application and procedures to change that state. The problem here is that any piece of code can access any variable. That makes it hard to debug this code because a faulty state could have originated anywhere. It also makes it hard to test it because the behavior of a procedure may be different depending on the state of the variables. There are two ways to address that problem: either you restrict access to the variables or youdon't allow modifying them. Restricting access is what OOP does. An object is a group of variables with “procedures” assigned to them. Since they don't access just any variable but only those in the class they are in theyare called methods to tell them apart from procedures. Disallowing modification is what functional programming does. The term function comes from mathematics. If in math you say y=2*x you didn't change x in any way. Instead you calculated a new value. So in programming a (pure) function doesn't change any variables, but it only calculates anew value based on the given parameters. As a rule of thumb procedural programming is the easiest to understand for beginners, but it's also the most bug-prone. Functional programming is the safest but also the least intuitive. OOP isso successful because it's easier than functional programming and safer than procedural. In additionto that it makes communication easier. It takes a programmer to decide which procedures or functions should operate on which variables need to use.