Assignment Programming
Assignment Programming
WORD COUNT:
Internal verification:
CONTENTS
I. Introduction
II. THEORY
1. ALGORITHM
- Algorithms are an important, indispensable part when approaching problems related to the field of
programming.
- Good algorithms bring high efficiency, helping programs work efficiently with fast processing
speed, saving resources.
- Algorithms help programmers understand more deeply about applications and programs more.
- As part of the role of the algorithm introduced, the importance of the algorithm for practice is not
small. Algorithms help programmers assess whether new software is working effectively.
- Besides, to understand deeply what the algorithm is, you should predict the possible cases. This
has the effect of minimizing errors for new programs.
- Algorithms are not only used to find the results of good problems in the field of programming. It
is also used to find a way to solve life problems.
- Using pseudo-code
+ Pseudocode is a formal language that helps programmers develop algorithms. Pseudocode often
borrows the syntax of a certain language to represent the algorithm.
+ Pseudocode programs are not executable on the computer. They just help you sketch out an
algorithm and represent it in an easy-to-understand way before writing it in a programming
language.
- Considering the algorithm, it must be considered that the algorithm works in any programming
language.
- Which programming language does that algorithm? When any programming language changes,
the algorithm changes to follow.
Ex: check if any 3 numbers entered from the keyboard are 3 sides of a triangle.
Flowchart:
Code:
2. PROGRAMMING DIRECTIONS
+ It also divides the larger program into smaller parts called functions.
+ Makes debugging easier. Compared to finding errors in many places in the code, finding errors in
(pre-structured) classes is simpler and less time-consuming.
+ Encapsulation
+ Inheritance
+ Polymorphism
+ Abstraction
- In an event-driven application, there is generally a main loop that listens for events and then
triggers a callback function when one of those events is detected. In embedded systems, the same
may be achieved using hardware interrupts instead of a constantly running main loop. Event-driven
programs can be written in any programming language, although the task is easier in languages that
provide high-level abstractions, such as await and closures.
- Special features of the setup guide event: Applications, where control flows based on internal or
external events rather than the application's structure, are ideally suited for flexibility and
naturalness.
Some use cases Create functions to An object is defined Make a form for users
of programming enter data, display it, as a person if it has to fill up with
directions sort it, etc. Create methods like input information like their
arrays to store and display as well as login details, data for
information. properties like name the interface to
and address. calculate with, etc.
The reasons for - The program is very - You have multiple - Using the event
choosing those unique and few programmers who capturing system, you
applications elements were shared. don’t need to can do things that
understand each regular programming
- The program is
component. instructions can't, such
static and not
- There is a lot of as show the user a
expected to change
code that could be simple graphical
much over time.
shared and reused. interface connected to
- None or only a few
the code.
features are expected - The project is
to be added to the anticipated to change
project over time. often and be added to
over time.
- Different sections
can benefit from
different resources
like data-source or
hardware.
- Definition of IDE: IDE is an integrated environment for programmers to write code, code (short
for Integrated Development Environment) to develop and improve applications. Besides, this
environment also supports programmers with many utilities, such as + Compiler + Interpreter +
Debugger – Check for errors. + Highlight code – Highlight important sections of code. + Search for
codes. + Code directory organization.
- Definition of the Text editor: A text editor is any word processing program that you can use to
type and edit text. Hey, they don’t call it a text editor for anything... Word Pad and NotePad for
Windows and SimpleText and TextEdit for Mac are common text editors. Larger programs such as
Microsoft Word and Word Perfect are also text editors, but they have many more features. You can
write HTML code and create HTML pages with a simple text editor, as long as you know the
correct HTML syntax.
+ A Source Code Editor (code editor): used to write the source code for the application
+ Compiler and/or interpreter
+ Auto Build tool: It will help you link the source code and build the application automatically.
When running the program on localhost on the browser, the source code is also built on it, so it is
very convenient to visually observe the display interface of the program, and can also view the
source code, and can directly edit the code of HTML files, this change of code will change the
display interface directly. Visually observing what your program is doing and directly editing
HTML files and CSS elements for an element (1 tag/1 class...) is a great thing, with a lot of support
and reduction. maximum time spent designing CSS for program interface – the interface is an
indispensable element of web pages; An eye-catching, scientifically arranged, user-friendly
interface is always required in web application development.
+ Debugger: The IDE will make it easier for you to detect and debug.
Advantages Disadvantages
- Less time and effort - Learning curve: IDEs are complicated tools.
- The entire purpose of an IDE is to make - Maximizing their benefit will require time
developing faster and easier. and patience. A sophisticated IDE may not be a
good tool for beginning programmers.
- Its tools and features are supposed to help
you organize resources, prevent mistakes, and - Will not fix bad code, practices, or design:
provide shortcuts. you still need to be proficient and meticulous.
An IDE will not eliminate efficiency or
- Enforce project or company standards: performance problems in your application.
Simply by working in the same development
environment, a group of programmers will - IDEs are like paintbrushes.
adhere to a standard way of doing things.
- Compare the advantages and disadvantages of software development using IDE and software
development without using IDE:
Advantages Disadvantages
3.2 Debug
- Definition: is the process of finding and discovering errors as well as the causes of these errors to
have a fix. Error control of thousands of lines of code is not easy for programmers, especially those
who do not have much experience.
-Purpose of debugging: Debugging is not only to remove errors from the program but also to help
programmers better understand the program and the software that is running. Therefore, debugging
is also an ability used to assess the level of the programmer.
-The importance of debugging: Debugging is important because it allows software engineers and
developers to fix errors in a program before releasing it to the public. It's a complementary process
to testing, which involves learning how an error affects a program overall. If you examine each
section of code, you can discover which variables and functions to adjust systematically. Debugging
can also improve the quality of a product, which may increase the number of positive reviews a
company receives.
Step 4: Analyse the snapshot based on the state and action. Based on that try to find the cause of the
bug
Step 5: Fix the existing bug, but also check that any new bug does not occur.
-Definition: Think of coding standards as a set of rules, techniques, and best practices to create
cleaner, more readable, more efficient code with minimal errors. They offer a uniform format by
software engineers can use to build sophisticated and highly functional code.
+ Naming Convention
+ Rule of quantity
+ Disembarkation Rules
+ Comment
- Input: IMEI, Name, price, RAM, ROM, screen_size, width, thickness, foundIMEI, name,
manufacturer, chip, month, year, day, choose1, choose2, choose3, choose4, choose5.
- Output:
+ Display
+Filter by manufacturer
+Filter by price
+Order by release desc
+Order by price desc
- Handle: Create 3 classes including main, Phones and Menus Create an ArrayList named
phonesList to manage the phones after adding and putting the phones into the phone list through the
created Phones data type object.
And after creating an object with data types Phones and ArrayList PhoneList:
+Add phone function:
+Update phone function:
+Delete phone function
+Display all phone functions:
+ Phone filter tool by manufacturer:
+ Phone filter tool by price:
+ Order by release desc
+ Order by price desc
-Charts:
- Filter By Manufacturer:
- Order By Release Date:
- Filter By Price:
- Order By Price:
3. Code Deployment
•Class Main:
- Filter by price:
- Order by price:
- Menu:
- Menu Phone:
- Menu Tools:
- Display All:
- Filter by manufacturer:
Order by release date:
- Filter by price:
- Order by price:
5. Debug the code of the written program
- Naming rules: The naming of identifiers (including variables, constants, classes, etc.) also has a
significant impact on the readability of the code. Imagine a giant software like Windows but each
function is only named like a, b, c, function1, function2, ... then surely the management and
maintenance of the code is extremely difficult. There are three common naming rules: camelCase,
PascalCase, and snake_case. and in the code, I use Pascal Case and Snake Case
- Some general rules for naming:
+ It is not recommended to use magic numbers (using numbers directly in the code) but should give
a separate name for the constant. For example:
- Rule of quantity:
+ Each function should only do one thing, if it serves two different purposes, the function name
should clearly show this.
- Disembarkation Rules:
+ If a function has multiple levels of nesting, each level should be a new line.
+ The qualifications code should be in the same column together, the line down should start at the
same level as the line above.
- Comment rules:
+ Comments clarify the meaning of the code (if the logic is complex).