information technology assignment 2 unit programming

59 0 0
Tài liệu đã được kiểm tra trùng lặp
information technology assignment 2 unit programming

Đ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

13 CHAPTER 3 IDE problems, debugging procedures, and coding standards…...14LO3 Implement basic algorithms in code using an IDE .... Programming is one of the subjects to master the knowl

Trang 1

BTEC FPT INTERNATIONAL COLLEGE

INFORMATION TECHNOLOGYASSIGNMENT 2

Trang 2

ASSIGNMENT 2 FRONT SHEET

QualificationBTEC Level 4 HND Diploma in Computing

Unit number and titleUnit: Programming

Submission date14/8/2022Date received (1stsubmission)

Trang 3

Grade:Assessor Signature:Date:Internal Verifier’s Comments:

Signature & Date:

Trang 4

First of all, I would like to express a special and enormous thanks to my family for theirinvaluable encouragement, enthusiasm, and support Without all of this, I couldn't haveachieved it Second, I would like to sincerely thank teacher NGUYEN HOANG ANH VU forenthusiastically supporting me to achieve my academic results and thanking him for hissupport 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 Collegefor 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-

Trang 5

I certify that this assignment is my work, based on my study and that I have acknowledgedall 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 Ialso certify that this assignment has not previously been submitted for assessment in anyother unit, except where specific permission has been granted from all unit coordinatorsinvolved, or at any other time in this unit, and that I have not copied in part or whole orotherwise stealing ideas the work of other persons.

Trang 6

INTRODUCTION VIIICHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE 1

LO2 Explain the characteristics of procedural, object-oriented and event drivenprogramming, conduct an analysis of a suitable Integrated Development Environment (IDE)… 1

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

2.1.1Procedure-Oriented Programming(POP) 1

2.1.2Event-driven programming 2

2.1.3Object-oriented programming (OOP)… 5

2.1.4 Characteristics of the programming models… 6

2.1.5What is the difference between procedural programming (POP) and object-oriented programming (OOP)… 9

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

2.2.1 IDE definition 10

2.2.2Basic features of common IDE… 10

2.2.3Benefits 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 143.1Write a program that implements an algorithm using an IDE(P3) 14

Trang 8

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

Trang 9

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 10

Programming is one of the subjects to master the knowledge base, understandingprogramming models such as procedural programming, object-oriented programming, andevent-oriented programming, the structure of a program, data, basic data, at the sametime to introduce to students the knowledge of IDE, the functions of the IDE and somestandard rules, rules of naming in code At the same time, it helps students gainknowledge 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

Trang 11

2.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 computerprograms (software) People who do programming work are called programmers Usingavailable code, programming languages, and utilities, they build, debug, or improveprograms, applications, games, software, websites, processing systems, and more.Help users interact with each other through electronic devices or execute commandswith computers.

2.1.1Procedure-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 largeprogram into many small programs, and the programs are analyzed into several partsto complete a large program called a function Each function will take on a differentfunction 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 12

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 graphicalinteractive interface through objects and defining the behavior of the system through the eventsof the objects In software development, events -driven programming is a programming model inwhich all business logic is performed in the program's source code The program's runtime flowwill be determined based on events Events here can be:

Click the button on the screenPress the key on the keyboardHover

Receive sensor output signal

Receive messages from other programs or threads…

Trang 13

Button" to click the result and delete the result Data A when entering them shouldenter a non-zero number if entering 0 it will say "Or enter another 0"

Trang 44

Application" it will get an error as shown above.

To fix that error, I will Declare the library "using System.Windows.Forms;" as shown below.

Trang 45

robust applications(M4)

Debugging:

Debugging is the process of finding out the error or the cause of the error (where thebug is) to have a direction to fix the error (fix the bug) Debugging is not only to removeerrors from the program, but more importantly, to help the programmer betterunderstand the execution of the program A programmer without the ability to debugeffectively is like being blind

It is normal for any programmer to have an error in thousands of lines of code Theprogram may not run according to the programmer's intention, or run the wrongfunction it is prescribed, causing the program to be rated shoddy So when there is anerror, the programmer must debug to fix the error to help the program run well.

IDE debugger:

IDEs allow programmers to write code to develop applications In addition, it alsointegrates a lot of different software development tools such as: code search support, compiler and interpreter creation, code organization and sorting

In addition, the IDE helps to optimize the coding process It provides a suitable interface for code generation and helps to automate the programming steps In simpler terms, an IDE is an environment that integrates the functions of many processes together It allows users to use popular programming languages such as Java, Python, etc Besides, the IDE environment also supports programmers to install plugins to make the coding process simpler.

What makes IDEs superior is the ability to chain pre-assigned groups of code from one or more people Users simply build hierarchies and systems together incodes The IDE also comes with both an intuitive debugger and checker, which greatly saves time re-testing the program.

Software is difficult to install and consumes memory space of the computer.Sometimes the IDE can't find the error and fix it

Trang 46

and debugging IDE debugging found error

Trang 47

Figure3-25 The program is out of error.

Trang 48

the individual(D4).

Define:

Coding conventions: A coding convention is a set of guidelines for a

language-engineering language that recommends setting styles, practices, and methods for eachaspect of programs written in that language These conventions typically include file organization, margining, comments, declarations, statements, spaces, naming conventions, set implementations, setup rules, setup rules, methods best in architecture, etc This is a guide to quality structural software Software developers should follow guidelines to help improve the readability of their source code and make it easier to maintain Coding conventions are applicable only to human maintainers andpeer reviewers of a project software Conventions can be formalized in a well-documented rule that the entire team or company follows, or can be as informal as information that lowers an individual's code Coding conventions are not enforced by the compiler

Trang 49

Increase quality

It is common to find that software developers spend most of their time solving code quality problems that could have been prevented Implementing programming standards and best practices will help the team detect problems early or even prevent them altogether This will increase efficiency throughout thesoftware process.

The risk of project failure is minimized

Many times it happens that IT projects fail due to problems while developing software Implementing code quality standards reduces many problems and the risk of project failure.

Minimum complexity

If a code is complex, then the chances of it being error-prone are higher Coding standards make it possible to develop less complex software programs and thus reduce errors.

Easy to maintain

If programming standards in software engineering are followed, the code will be consistent and easily maintainable This is because anyone can understand it and can modify it at any time.

The benefit of coding standard for a team or personal:

Implementing code quality standards reduces many problems and the risk of project failure If a piece of code is complex, the chances of it being error-prone are higher Coding standards make it possible to develop less complex software

Trang 50

the same way, it would be easier for everyone to predict and be more organizedRead more codes Declare variables in the usual place, in the usual order, declared in the same and usual way.

For example, my current employer has a very specific standard for how digital identities should be declared We have to capitalizeLikeThis I hate it Terrible But everyone does it the same way, allOfTheTime It becomes completely 100% predictable And that's better

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

Variable:

Avoid using multiple variables as a whole to avoid influence use only when necessary• I will put captions for each section

• We need names that are memorable and meaningful

Some notes in naming:

• Do not reuse the same names or change only a few characters such as capital letters In many cases it will lead to confusion

• Do not set up two namespaces with the same name, but only change it with uppercase letters, so there are more numbers

• Don't build a method with the same parameters and only different cases.• Abbreviations should not be used in IDs or parameter names.

• When naming abbreviations, you can use Pascal case or Camel case for naming.

Naming rules:

Common capitalization styles:

Pascal Case: The first letter of the identifier and the first letter of each subsequent word must be capitalized For names of three or more characters, use Pascal Case.

Camel Case: The first letter in the identifier is a lowercase letter and the first letter of the followinghyphen must be capitalized.

All characters in the identifier must be capitalized Use this rule for identifiers with 2 characters or less.

Named Assembly and DLL: Use a name to collectively describe the internal functions of the

Assembly.

Trang 51

Use Pascal syntax to name the namespace.

Use the prefix of company and organization names to limit the conflict of namespaces with the same name.

For example:

Name the class, struct, and interface:

Use nouns or noun phrases to name classes, struct Use Pascal's case.Name the interface an adjective phrase, or you can use a noun or a noun phrase.Do not use the prefix "C" for class names.

Should end the name of the inheriting class with the name of the base class.Use the "I" prefix for the interface name.

For example: Name the class

Name the interface:

Name the method, property, and field of a type:Name the method:

Use verb or verb phrase for method names.Name properties

Use nouns, noun phrases or adjectives.

Trang 52

Use Pascal case to name the field.Use nouns, noun phrases or adjectives.Do not use prefixes for field names.

it makes the source code easier to learn, easier to understand it makes the source code easier to learn, easier to understand.

Every substatement inside a block must be indented.

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

we need to avoid confusing using verbose encodings, length of functions we shouldkeep to a minimum and easy to understand.

For example: Solve equations of degree 1:

Ngày đăng: 13/05/2024, 14:53

Tài liệu cùng người dùng

Tài liệu liên quan