1. Trang chủ
  2. » Công Nghệ Thông Tin

Assignment 2 1618 Programming (Merit) Greenwich

67 4 1

Đ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 đề Programming
Tác giả Tran Duc Long
Người hướng dẫn Pham Danh Tuyen
Trường học Greenwich
Chuyên ngành Computing
Thể loại assignment
Năm xuất bản 2022
Thành phố London
Định dạng
Số trang 67
Dung lượng 4,84 MB

Cấu trúc

  • A. Task 1: Introduction to your program (P3) (7)
    • 1.1. Introduce the Overview/ Context of the problem (7)
    • 1.2. List out the application’s requirements (7)
    • 1.3. How can my program solve the problem (7)
  • A. Task 2: Explain programming paradigms(P2) (7)
    • 2.1 Explain what is Procedural Programming with source code and illustrations (7)
    • 2.2 Explain what is Object-Oriented Programming with source code and illustrations (9)
    • 2.3 Explain what is Event-Driven Programming with source code and illustrations (11)
    • 2.4 The relationship between them (13)
    • 2.5 Conclude which paradigms will be used to develop the application with explanation (13)
  • B. Task 3: IDE features(P4-M2-M3-M4) (16)
    • 3.1 Introduce what is IDE (16)
    • 3.2 Introduce features of IDE with illustrations (17)
    • 3.3 An explanation and evaluation of the debugging process in the IDE used and how it helped with development (18)
    • 3.4 Evidences that you have used debugging during the implementation (19)
    • 3.5 An evaluation of developing applications using an IDE versus developing an application without (22)
  • C. Task 4: Design and Implementation(P3-P5) (23)
    • 4.1 Flowchart of the application (23)
      • 4.1.1 User case (23)
      • 4.1.2 Flow Chart (24)
      • 4.1.3 Class diagrams (29)
    • 4.2 Source code and screenshots of the final application with explanation (29)
      • 4.2.1. Screenshots of the program (29)
      • 4.2.2. Source code of the program (37)
    • 4.3 Explain and evaluate coding standards used in the program (58)
    • 4.4 Explain the benefits of using coding standards (62)
    • 4.5 Evaluate my entire program (62)
  • D. Conclusion (63)
  • E. Reference (64)

Nội dung

A Greenwich winform programming assignment received Merit points. Language C#. This assignment will provide detailed reports about library management software, common c# code syntax in C# programming, APIE rules in object-oriented programming are all used.

Task 1: Introduction to your program (P3)

Introduce the Overview/ Context of the problem

Everything in our current civilization is modern and inventive Every day, there is a great deal of innovation, particularly in technology We must acknowledge that technology has invaded every part of our life, from basic gadgets like phones and computers to complicated programming programs

In this assignment, I will talk about library management, or called librarian software, precisely how I can use it, as well as extensive explanations of its features and characteristics, and ultimately an evaluation of the functions and the overall program In addition, I included many alternatives in my application for users to choose from, each with its own purpose and information to allow them to develop a range of programs These capabilities will aid the archivist in entering the book's information such as type book , as well as finding which author.

List out the application’s requirements

This system will give the archivist power and flexibility to manage the entire book from a single online portal Librarians can do:

+ Create a new book including id, name, type book, adding date , and author

+ Edit/delete/save the book's information

+ Sorting books by name/type book/added date/author/id

+ Searching for books by name/type book/id/date of adding/author.

How can my program solve the problem

+ After the user logs into the program, there will be a total screen including the functions

+ When user press new/add books button, program will show a form where they can enter book’s information then book's information will show on main screen

+ Users can edit/delete/save/refresh the information books have just entered according to the corresponding messageBoxes

+ Users can view sorted book’s information as well as search for books through menu 2 combobox sort and search on the main screen.

Task 2: Explain programming paradigms(P2)

Explain what is Procedural Programming with source code and illustrations

• Procedural programming is a programming paradigm that teaches a computer to execute a program logically Fundamentally, procedural programming is the process of writing a set of instructions that the computer may follow step by step The procedural programming paradigm divides codes into processes, with each block of code performing a specific purpose Procedures, often known as routines, subroutines, or functions, are essentially a collection of computing processes that must be performed in the sequence specified by developers (isaaccomputerscience, n.d.)

+ Procedural program models imitate real-world processes on data

+ Data flows freely throughout a software

+ The program's flow is simple and straightforward

+ Big jobs are broken down into smaller ones (functions)

+ Uses a top-down approach to program design

+ The majority of functions exchange global data (Chakrabarty, 2013)

Explain what is Object-Oriented Programming with source code and illustrations

• Object-oriented programming (OOP) is a fundamental programming paradigm that almost all developers employ The most common programming paradigm and the conventional approach to code are OOP It is a programming paradigm centered on classes and objects rather than functions and logic It is used to divide a software program into basic, reusable classes that may then be utilized to produce individual instances of things Object-oriented programming languages include JavaScript, C#, Java, and Python A class is a type of object that is used to construct distinct, concrete things Classes, like functions in procedural programming, can contain methods, but they are only available to objects of that kind These functions, which are specified within the class, carry out some operation (Doherty, 2020)

+ Encapsulation: data and information concealment

+ Abstraction: displays just important qualities and conceals irrelevant information

+ Inheritance: the ability to derive a class for a hierarchy from another class + Objects: an object is a class instance

+ Class: a group of objects with similar properties (Doherty, 2020)

Figure 4:Object-oriented paradigm characteristics (Doherty, 2020)

Explain what is Event-Driven Programming with source code and illustrations

• "Event-driven programming is a programming paradigm in computer programming in which the flow of the program is governed by events such as user actions (mouse clicks, key presses), sensor outputs, or message passing from other programs or threads," according to Wikipedia Event-driven programming is the prevalent paradigm in graphical user interfaces and other programs (for example, JavaScript web applications) that are focused on doing specific actions in response to user input This is also true for device driver programming (e.g., P in USB device driver stacks)

A main loop in an event-driven application normally listens for events and then calls a callback function when one of those events is recognized In embedded systems, this can be accomplished by employing hardware interrupts rather than a continually running main loop Event-driven applications may be developed in any programming language, however languages with high-level abstractions, such as await and closures, make the work simpler."(Anon., n.d.)

Figure 6: Event-driven paradigm (Anon., 2021.)

+ Service-Oriented: The service-oriented requires less computer resources and typically runs in the background of the operating system

+ Time-Driven: code that only executes at a given time

+ Trigger Functions: These are functions that run when a specified event occurs + Events: The user must interact with a software object (click a button by a mouse, use the computer keyboard to choose a button)

+ Programming Simplicity and Development Ease: Event-driven programming is significantly simpler and easier to implement than other types of programming For example, you may place a button by choosing it, dragging it to a form, and assigning it a listener (Kolenikova, 2022)

Figure 7: Event-driven paradigm characteristics (Baral, 2012)

Figure 8: Event button in Event-driven

The relationship between them

• Because of increased consumer demand, programs/applications are getting increasingly complicated Developers mix two or three programming paradigms in one software to simplify them Here's how they may be combined in a program:

+ The procedural paradigm represents the issue solution, defining procedures and data flows

+ Looking at models and developing objects to represent those models is what object oriented is all about

+ When events are triggered, the event programming paradigm generates actions for both procedural programming and programming objects, which aid in the development of human engagement with the program.

Conclude which paradigms will be used to develop the application with explanation

In my program, I have used procedural programming, object-oriented programming and event- driven paradigms

Firstly, I used for and for each loops to conduct tasks like as looking for book information I also used if-else and switch statement to test the condition when the user entered data This simplifies and makes the code easier to understand

Figure 9: Loop for in my program

Figure 10: Loop foreach in my program

Figure 11: if-else in my program

Figure 12: Switch in my program

Secondly, I mostly user Object-Oriented Programming Paradigm because it suitable for the scenario I can create class of books in OOP

Figure 13:Class book in my program

Secondly, I use Event-Driven programming paradigm to build event listener for buttons, objects,… Have them perform specific tasks when pressed

Figure 14: An event listener in my program

Figure 15: Event button Cancel in my program

Task 3: IDE features(P4-M2-M3-M4)

Introduce what is IDE

An integrated development environment (IDE) is application development software that integrates common developer tools into a single graphical user interface (GUI) An IDE is often made up of the following components:

+ Source code editor: A text editor that can help you write software code by highlighting syntax with visual clues, giving language-specific auto-completion, and checking for flaws as you type

+ Local build automation: Tools for automating simple, recurring operations associated with making a local build of software for usage by developers, such as converting computer source code into binary code, packaging binary code, and performing automated tests

+ Debugger: A software that can graphically indicate the location of a defect in the original code and is used to test other applications

Because different tools do not need to be manually installed and integrated as part of the setup process, an IDE allows developers to start writing new apps fast When every utility is represented on the same workbench, developers no longer need to spend hours separately learning how to utilize different tools This is also valuable for onboarding new engineers, who may use an IDE to learn about a team's standard tools and procedures In reality, most IDE capabilities, such as intelligent code completion and automatic code creation, are designed to save time by eliminating the need to write out whole character sequences (redhat.com, 2019)

Introduce features of IDE with illustrations

The shell is the environment in which the user may write code The code editor is a text editing area where developers may write, modify, and save code documents It has capabilities that aid in the authoring and modification of code These are some examples: + Auto-completion (or code completion)

+ Bracket matching + Syntax checks b)Other IDE tools:

• Translator This compiles or interprets the code

• Documentation for automobiles This defines the function and purpose of the code, for example, by identifying the modules and variables used, as well as its anticipated behavior, and compiles this information into a text file that other developers may use to understand how and why the code was generated

• Libraries These provide functions that are not included in the programming language's core These functions can be imported and utilized in the program code at the beginning

In Python, for example, the Turtle Graphics module gives access to some basic drawing and graphics capabilities

• Create automation These tools save time by automating operations that would otherwise be performed by hand These may involve testing and compilation When a software contains thousands of lines of code, these tools come in handy They increase software quality by reducing faulty software builds and saving time and money

• Debugger This is an IDE application that is used to identify mistakes If the debugger finds an error, it may indicate what sort of error it is and what line it is on n.d (bbc.co.uk, n.d.)

Figure 16: Screenshot of an IDE

An explanation and evaluation of the debugging process in the IDE used and how it helped with development

Debugging is the act of finding and eliminating current and prospective problems (often known as "bugs") in software code that might cause it to behave abnormally or crash Debugging is the act of finding and eliminating current and prospective problems (often known as "bugs") in software code that might cause it to behave abnormally or crash When many subsystems or modules are tightly coupled, debugging becomes more challenging since each change in one module may cause more flaws to appear in another.(Anon, 2022)

I used Microsoft Visual Studio Community 2022 to implement the solution to this situation

+ Locate the error (at line )

+ Rerun the application to see if any errors remain

• The debugging procedure will assist us in locating and correcting program errors, making the application usable and bug-free

Evaluation: A debugger is a software tool that can help with software development by finding code mistakes at various phases of operating systems or application development Some debuggers will evaluate the test run and establish break points to see which lines of code are not executed This tool allows coders or rookie IT students like me to waste less time looking for issues and more time solving them This feature also makes it easy for coders or programmers to keep their applications updated.

Evidences that you have used debugging during the implementation

• I will debug this code section:

• I will put a break point at the line I need to debug.

• Next, I will start debugging, the program will run until the breakpoint.

Page 21 of 66 Figure 19: Start debugging

• After having done the debugging process, I have got the expected result.

An evaluation of developing applications using an IDE versus developing an application without

Almost every developer nowadays uses an IDE to code and increase developer productivity The IDE assists developers in reducing coding time and increasing application completion speed Also, the IDE lets developer avoid the errors and make the code easier to comprehend based on their characteristics

Figure 21: Algorithm linear search with IDE

The IDE: integrated is what makes an IDE so valuable You could use almost anything as a development environment, and many people do, in place of an IDE, use a range of simple, standalone tools, but an integrated environment allows you to accomplish everything in a single editor

Most IDEs, for example, have debuggers This implies you may develop and debug code in the same application You'd have to write your code in a text editor and then debug it with an external linter or compiler if you didn't have an IDE This might be a frustrating mess depending on the language

Many IDEs additionally provide convenience features (such as simple navigation, code auto-completion, class explorers, hierarchy diagrams, and so on) as zwell as tools to assist you automate work (e.g source version control, testing tools, etc) Not all IDEs contain all of these tools, and you may want to use one with fewer functionality if that is more convenient for you

IDEs enable developers to program more effectively by aggregating all of these elements and interacting with them through a single interface You do not have to learn numerous applications, test their compatibility, get them to function together, or even switch between them This can save you a significant amount of time and energy (ALBRIGHT,

Task 4: Design and Implementation(P3-P5)

Flowchart of the application

Page 24 of 66 Figure 22: User case in my program

Page 25 of 66 Figure 23: Flowchart my program

Figure 24: Algorithm linear search to find book's location

Page 26 of 66 Figure 25: Flowchart of methods searching in my program

Page 27 of 66 Figure 26:Flowchart of methods sorting in my program

Page 28 of 66 Figure 27: method form Login in my program

Figure 28:Event update and remove books in my program

Figure 29: Class diagram of my program

Source code and screenshots of the final application with explanation

➢ I have a loading bar to enter the program, this loading bar will make my program more colorful and nicer interface

Figure 30: form Loading in my program

➢ The password is masked in the login screen by "*" signs, making the application more secure; nonetheless, users may see the password by clicking the eye symbol next to it

➢ When the user is logged in, the program screen will be displayed, the other form program showed some books because I created a dummy data function inside the program:

➢ when the user clicks on the add book button a form to add the book will be displayed

Figure 33: Form to add and update Book

➢ When the user does not enter anything but clicks on add new, an error message box will be displayed and force you to enter the correct information as the program requires If you press the cancel form button, the book will automatically close

Figure 34: Message box to exception handling

➢ When you finish entering valid information because the messagebox asks you to click add new, the book information will be displayed on the datagridView table of the program

➢ If this time you don't change what which press add new next, the program will report an error because the list id you entered already exists

➢ If you want to save any book, you can click on that book and then press the save button, the program will automatically save the information of that book

➢ If you want to sort books by name, id, type, author, then click on combox to select the sort criteria you want to choose

Figure 38: Example: sorting book by date added

➢ If you want to search for books by name, id, type, author, click on combox to select search criteria and then press search button

Figure 39: Example: searching by book's name in my program

➢ In addition, you can edit the book information by clicking the edit button, the form for you to update the book will automatically appear and you just need to change the information and press the update button

➢ If you want to delete a book, click on the delete button the book will be deleted

➢ Users can change the color of the program, by clicking on the edit menu and choosing the color they want to change

➢ If you want to delete all, click the refresh button, the program will automatically delete all information and return to the original state

4.2.2 Source code of the program:

I created events for buttons/progressBar to create toolbar loading effects when enter program

Figure 44:View code of form frmRunning

I create events for buttons/textbox to check username and password, I create two more eye events so that clicking will hide/show password

Figure 45: View code of form Login

I have created a Book class to implement the properties of the book information, in this class I have created a [] PropertiesToArray() object containing the implemented properties to dump the data into the dataGridViewBook table

I created this interface for exception handling:

Figure 47: interface IChecker in my program

This class to implement the IChecker interface I created above In this class I use the Regular expression inside (System.Text.RegularExpressions) to check id, author, addDate, Name:

Figure 48: Class CheckerImp to exception handling

I created this interface to perform the functions of sorting, searching, deleting information:

Figure 49: interface IController in my program

This class implements the IController interface, in this class, I still use regular expressions to find information, in addition, I also use for and foreach loops to perform searching method, if-else statements to check the condition in the sort method:

Page 45 of 66 Figure 50:Methods searching in my program

Figure 51: Methods sorting in my program

I created this interface to perform adding and updating:

Figure 52: Interface IViewController in my program

Interface IViewController will be exploited in this frmLogin In this form, I create a method to fake data book and events for buttons click, comBoBox, textBox, dataGridView, contextMenuStrip:

Page 55 of 66 Figure 53: View code frmProgram

This form to add student information, I have created events for buttons, radionButtons, textBox:

Figure 54: View code of AddUpdateForm

Explain and evaluate coding standards used in the program

A coding standard assures that all developers creating code in a certain language follow the principles established This makes the code easier to comprehend and ensures consistency The uniformity of the coding standard is one of the most important aspects

Page 59 of 66 of a software system Consistency has a good influence on program quality and should be maintained during coding It should also be ensured that coding guidelines are followed consistently throughout all layers of the system and do not contradict one another The completed software code should appear to have been produced in a single session by a single developer (Inc, 2020)

In my program, I used the following criteria: a) Layout:

A good layout highlights the structure of my code and makes it easier to read:

+ Write each statement or define each variable on a separate line

+ Insert at least one blank line between method and property

Figure 55: Layout in my program b) White space:

+ White space separates the design's aims and divides the code's layout into pieces for easy comprehension

+ Because of the usage of whitespace, the reader may quickly understand the designer's intent in the code

Figure 56: White space in my program c) Indentation:

+ Each nested block has been indented and spaced

+ Indentation at the start and end of each block

+ All braces should start on a new line, and the code after the braces should also start on a new line

Figure 57: Indentation in my program d) Naming rules:

I named variables according to camel rule:

+ Naming variables meaningful and understand

+ Avoid the use of digits

I usually annotate in two styles:

+ "///" to annotate libraries such as functions

Figure 59:Types note in my program

Explain the benefits of using coding standards

A coding standard assures that all developers working on the same project follow the same set of rules The code is easy to read and maintains proper consistency Here are some advantages of following coding standards:

➢ Implementing coding standards would assist the team in recognizing problems early on, if not completely preventing them This will increase productivity during the software development process

➢ The risk of project failure is lowered because code that adheres to standards makes it easier for other developers to comprehend and discover errors

➢ Simple to maintain, bug correction

➢ Cost-effective: Developers may reuse code that has been written clearly whenever they require it This can significantly reduce development costs as well as time spent on it

Evaluate my entire program

After present all information that related directly to my program: “Librarian management” In this portion, I am going to assessment my program, design, that demonstrate clearly what is benefits and negatives in my program and what I need to change

➢ Have all the basic functions in requirements

➢ The interface is very friendly, user does not take too much time to understand how it work It is simple to use and easy to understand

➢ The function of hiding the password will help my program be more secure

➢ In my program, I have used most of procedural programming, object-oriented programming and event-driven programming

➢ My program has not connected to databases such as MS SQL server, Oracle, MySQL to read or save files, so the amount of book information is only manipulated on the interface

Conclusion

C# is currently one of the most used programming languages in the world and it is becoming more and more popular This report allows me to practice with it In addition, in doing this exercise, I have broadened my knowledge of programming on winform interface or dotnet framework in C#, and based on what I have learned from this course, I will develop myself more and more and try to refine knowledge about Fullstack

Ngày đăng: 24/02/2024, 01:06

TỪ KHÓA LIÊN QUAN

w