COMPUTER-PROGRAMMING-1
COMPUTER-PROGRAMMING-1
Computer programming is the process of designing and developing various computer programs to
complete specific tasks in either application or software or within the computers. The process
constitutes many tasks, like analyzing the problem, generating an algorithm to solve it, and then
examining the output generated. Computer programming is creating a series of programs to resolve
a problem in a computer.
The whole procedure of writing computer programs is called Computing Programming. The
programming also has another name called "coding" and the person who writes the code is
referred as the "Programmer" or "Coder". Programming is inputting instructions to the computer or
machines that describe how to carry out a task. Programmers use various programming languages to
code the different parts of the system, like software, hardware, and applications in computers and
digital devices, which helps us use them for many tasks. There are various programming languages
to write programs which include:
The main goal of programming is to make tasks easier because if we program a task for one time, we
can reuse it in many similar situations, saving time. With the help of programming, only machines
can understand user-given commands. Computer programming will impact the future by creating
even more automated processes requiring less human interaction.
Banking from any location is possible only by programming. For example, consider an online banking
website or application which opens a user portal from which the applicants can make transactions
using a smartphone or computer; by this, we can save time, energy, and physical work of going to
the bank for every small need.
Apart from the advantage mentioned above, we can also make our carrier in programming, which is
a huge demand nowadays.
There are various groups of programming languages. Let us discuss some of them on this page,
described below.
Programming Language
What is Language?
Language is a mode of communication that is used to share ideas, opinions with each other. For
example, if we want to teach someone, we need a language that is understandable by both
communicators.
A programming language is mainly used to develop desktop applications, websites, and mobile
applications.
Machine Language
The advantage of machine language is that it helps the programmer to execute the programs
faster than the high-level programming language.
Assembly Language
The advantage of assembly language is that it requires less memory and less execution time
to execute a program.
The main advantage of a high-level language is that it is easy to read, write, and maintain.
High-level programming language includes Python, Java, JavaScript, PHP, C#, C++, Objective
C, Cobol, Perl, Pascal, LISP, FORTRAN, and Swift programming language.
The advantage of POP language is that it helps programmers to easily track the program flow
and code can be reused in different parts of the program.
The main advantage of object-oriented programming is that OOP is faster and easier to
execute, maintain, modify, as well as debug.
The main advantage of natural language is that it helps users to ask questions in any subject
and directly respond within seconds.
Middle-level programming language lies between the low-level programming language and
high-level programming language. It is also known as the intermediate programming language and
pseudo-language.
A middle-level programming language's advantages are that it supports the features of high-
level programming, it is a user-friendly language, and closely related to machine language and
human language.
As we all know, the programming language makes our life simpler. Currently, all sectors (like
education, hospitals, banks, automobiles, and more ) completely depend upon the programming
language.
There are dozens of programming languages used by the industries. Some most widely used
programming languages are given below -
1. Python
Python is one of the most widely used user-friendly programming languages. It is an open-
source and easy to learn programming language developed in the 1990s. It is mostly used
in Machine learning, Artificial intelligence, Big Data, GUI based desktop applications, and Robotics.
Advantages
o Python is easy to read, easy to understand, and easy to write.
o It integrates with other programming languages like C, C++, and Java.
o Python executes code line-by-line, so it is easy for the programmer to find the error that
occurred in the code.
o Python is platform-independent means you can write code once and run it anywhere.
Disadvantages
2. Java
Advantages
o Java is easy to write, compile, learn, and debug as compared to other programming
languages.
o It provides an ability to run the same program on different platforms.
o It is a highly secured programming language because in java, there is no concept of explicit
pointers.
o It is capable of performing multiple tasks at the same time.
Disadvantages
o Java consumes more memory and slower than other programming languages like C or C++.
o It does not provide a backup facility.
3. C
C is a popular, simple, and flexible general-purpose computer programming language.
Dennis M Ritchie develops it in 1972 at AT&T. It is a combination of both low-level programming
language as well as a high-level programming language. It is used to design applications like Text
Editors, Compilers, Network devices, and many more.
Advantages
Disadvantages
4. C++
C++ is one of the thousands of programming languages that we use to develop software. C++
programming language is developed by Bjarne Stroustrup in 1980. It is similar to the C programming
language but also includes some additional features such as exception handling, object-oriented
programming, type checking, etc.
Advantages
o C++ programming language is not secured as compared to other programming languages like
Java or Python.
o C++ can not support garbage collection.
o It is difficult to debug large as well as complex web applications.
5. C#
Advantages
o C# is a modern, type-safe, easy, fast, and open-source programming language that is easily
integrated with Windows.
o The maintenance of C# (C sharp) is lower than the C++ programming language.
o C# is a pure object-oriented programming language.
o C# includes a strong memory backup facility. That's why it avoids the problem of memory
leakage.
Disadvantages
6. JavaScript
JavaScript is a type of scripting language that is used on both client-side as well as a server-
side. It is developed in the 1990s for the Netscape Navigator web browser. It allows programmers
to implement complex features to make web pages alive. It helps programmers to create dynamic
websites, servers, mobile applications, animated graphics, games, and more.
Advantage
Disadvantage
7. PHP
Advantages
Disadvantages
o PHP is not capable of handling a large number of applications and not suitable for large
applications.
o It is quite difficult to maintain.
Computer programs solve many problems and create something innovative in various fields like
agriculture, education, entertainment, etc.
o Graphics are used in developing cartoons and adding realistic effects to movies using
programming languages.
o Computers are used to build various techniques in medical tests to detect diseases using
artificial intelligence and deep learning techniques.
o Used to develop mobile and android applications.
o Used Word and Excel to accomplish tasks with efficiency.
o Computer programming is also useful in business and marketing, where people in business
use applications and tools to interact with customers.
o Programming helps to carry out government functions where people can access services
more effectively, designing news portals to provide information about the government's
tasks and building websites to provide government services online.
o Programming helps in every point of our lives, from using smartphones to watching movies
online. Everything is possible because of coding itself.
o Computer Programmers, as said before, write code for the specific problem using various
programming languages like Java, C, python, JavaScript, and pearl. They also use scripting
languages like HTML and CSS based on their field of work.
o Consider a computer programmer developing a website, which will require all the
programming languages to develop the front-end, and backend.
o Programmers must be well versed in more than one programming language because as they
work in groups, one programmer should understand the code written by the other to
communicate the logic and code.
o Programmers must mingle and cooperate with software developers (to discuss ideas) and
business analysts (to adjust the finance) for outputting software design models.
o Programmers must be able to construct prototypes from the given constraints.
o They should be able to convert software models and instructions into a functioning code
with high efficiency.
o They should be capable of quickly debugging and modifying the code according to the
requirements.
The procedure of developing the program from scratch to deployment involves many steps, which
are described as follows:
o The programmer will first understand the problem statement and quickly builds an idea.
o The programmer will visualize the concepts he can apply to resolve a problem.
o Then they develop and writes the code, which is a preferable quality in a computer
programmer.
o The programmer then removes errors by debugging the code written.
o After debugging, he will test the code and application created before handing it over to the
users. Testing helps in reducing the bugs in code.
o The programmers will often encounter errors that can take a long time to remove. In such
situations also, they should have patience and dedication to solve the errors and bugs.
Web Developer
Web developers are the persons who are responsible for designing the web page,
maintaining the content, and looking after the performance of web site. Web Developers build
applications for the web by using languages like HTML, CSS, JavaScript, Python, and others. They
design interfaces like graphical user interfaces to communicate with the web pages. The web
developers combine various content into the page to meet the organization's needs.
These web developers are also categorized into three types, namely backend, front-end, and full-
stack developers.
1. Back-end web developers - The web developers who design a website template, develop
code and test the code to know the website's working are called backend developers.
Backend developers develop the server-side software. They mostly work with databases and
applications to give the data to the intended and verified users. They are the persons who
give different access levels to website content based on users' privileges.
2. Front-end web developers - The web developers who work and develop the visible part of
the website are called front-end developers. They work for client-side software. They design
the template of each page, including graphics, and use languages such as HTML, CSS, and
JavaScript to develop interactive pages for website users. For example, the pages visitors see
and interact with which is also known as the user interface.
3. Full-stack developers - The web developers who develop and work for both the backend
and front end are called full-stack developers. They develop client and server-side software.
These developers can build a fully working website and work for companies.
Web admins are also web developers who manage websites regularly. They are the persons who
update the websites and links of the web pages to redirect the users to the appropriate page
according to their requirements.
Mobile Developer
The app developer designs, develop, and implement mobile applications. Mobile developers
build applications for mobile phones (like smartphones and tablets). They are specialized in mobile
technology and build applications for Android, Apple (iOS applications), and Microsoft Windows
Phone platforms. The developers can use the android studio application to build the android apps
using Java Java, Kotlin, and flutter languages. Mobile developers also develop IOS applications for
macOS. Mobile developers are in huge demand because every person, from students to older
people, uses smartphones and their applications to meet their requirements.
Mobile developers should have good programming skills, especially related to object-oriented
concepts and problem-solving knowledge, so they try to build better applications that are helpful for
everyone.
Game Developer
The game developers build games compatible with mobiles, laptops, and desktops. They will
develop new ideas and build better games that may be related to education and entertainment.
They will make code from the ideas, which is a very creative task. These games can be simple to
create and some are even more complex to design and develop.
Designing skills, creativity, cognitive and analytical thinking, animation, computing, and problem-
solving skills are very important for game developers.
Computer System Engineers have much respect and need in government, transportation, and
Telecommunications industries to maintain the huge traffic and networks and maintain the
information flow between the senders and receivers.
Database Administrator
The database administrator maintains and operates the database. In these, the Database
architects design and develop the programs to meet the user requirements. They secure them from
various types of attacks.
Software engineers are also computer programmers who program for a specific domain. The
software developers will think in depth about a project, like the design and features of an application
they are going to develop.
The programmers will write code for a specific problem rather than create a whole project
or website.
The software developers will create a featured application to meet the client's needs using
many concepts like object-oriented programming, functional programming, etc. But the
programmers will not consider the clients as they will not design the complete application. The
programmer always aims to deliver code for a particular problem instance.
The software developers will know computer programming, but only some of the
programmers can be software developers.
Computer programming includes creating and developing code to build new things to
eliminate problems and bring solutions by creating applications. The job roles under the computer
programming categories are software developer, web developer, mobile application developer, and
quality assurance (QA) analyst.
Coming to computer science is a field with no application development but involves solving
problems by applying abstract algorithms. Computer scientists develop ideas, and then computer
programmers implement those ideas by coding. The job roles which come under the computer
science field are software engineer, hardware engineer, system analyst, and software architect.
Hence without one field, the other cannot sustain.
We came across the concept of computing programming, its uses, and different
programming languages and fields using programming for their enhancement. But one big question
which always roams in everyone's mind is which programming language should we select for a
particular project?
To answer this question, first, you need to gather some information about the project you will
develop. The information includes:
After the above survey and gathering the information, the project team members should choose
a language to program. Can take the following suggestions to select the language.
1. The first step is to know about the available programmers and their preferred language.
Then selecting according to their choice satisfies the project requirements and the
programmer's choice of programming language.
For example, when developing the backend, select the language the team knows better
when every language can fulfill your requirements. Should not select the language because
the language is popular and easy. We have to check whether it can meet the functionality of
our project.
2. Please choose a language so that even when you want to upscale the already-developed
project in the future, your language should support it.
3. Also, know about the client's preferential language, as after the project deployment, it will
be used by the clients themselves.
4. Check whether your chosen language supports the project's constraints like cost, schedule,
scope, quality, and resources.
5. Language speed, performance, and security are important in building a good project.
6. We may require more than one language to complete a project. In such situations, we
should choose languages compatible with each other.
7. Finally, language selection completely depends on the nature of the project (whether it is
related to web development or mobile development, etc.) and requirements. Some
languages may have very good frameworks to support your idea, while others may not, so
discuss with your group before moving further.
You may choose between JavaScript, HTML, and CSS. If you want to work on front-end
development.
You can select from JavaScript, C#, and Python when you work on backend development.
While designing a project on web development, use object-oriented languages like Python,
Java, and C++.
If you work on machine learning and data science projects, use either python or R languages. The R
language supports statistical analysis and its visualization in a better way.
The above given are the only suggestions. If you are comfortable with other languages, which suit
your project, go with them.
How to learn to program?
To start with programming, first choose any basic language like C or C++ to understand the
programming concepts, the syntax of the language, and basic things like knowing about the
datatypes, operators, conditional statements, etc.
The best way to learn to program in less time is through self-practice itself. Then start
mastering algorithms and the data structures present in that language. While learning the
algorithms and data structures, take help from websites, books, and youtube videos to visualize the
concepts better. You can practice them in online sites and compilers, or you can even participate in
competitive programming available on various websites.
After you understand and learn the programming language, the next step is creating
small projects by applying the knowledge gained. If you can only partially develop a project, then at
least try to design small parts like creating a web page, building a calculator app, etc. The project
building boosts your confidence, and at the same time, you know how to apply the learned
programming language in real-time applications.
Then you can try complex projects and deep dive into emerging technologies like Machine
Learning, Artificial Intelligence, Deep learning, Cloud Computing, Mobile Development, Web
Development, etc. The more you explore, learn and practice, the more you gain and become
perfect.
Conclusion
The computer Programming field covers the various fields of computer science we
discussed. Programming is a developing and demanding career shortly. The only thing is to keep
updated with the emerging technologies and skills to stand strong in programming.
II. Programming tool
A programming tool is an application that helps developers create, test, optimize,
debug, and maintain other programs. It is designed to assist programmers in various tasks
throughout the software development life cycle. Programming tools can be part of a larger
single program called an IDE (integrated development environment) or run by themselves
from the command line.
Programming tools are categorized as different types based on their functions and
purpose, but the most basic are compilers, interpreters, and source code editors (like
Notepad++ and Atom). Some tools, like debuggers and profilers, are made with a specific
purpose.
Text editors - Text editors are uncomplicated tools designed for editing source code.
Lint software - Lint software identifies syntax errors, deviations from industry
standard syntax, common programming errors, and potentially incorrect constructs.
It is specific to the programming language it's checking.
Debuggers - Debugging tools help programmers identify and fix errors (bugs) in their
code.
Version Control Systems - VCS tools, such as Git, help developers manage changes
to source code over time. They enable collaboration by allowing team members to
track and revert each other's changes using a system of pushes and pulls.
Compilers and interpreters - Compilers translate source code to machine code or
some intermediate form, while interpreters can execute code directly. Examples
include GCC (GNU Compiler Collection), a compiler, and Python, an interpreted
language.
Performance profilers - These tools help developers analyze the performance of
their code by identifying bottlenecks and resource-intensive areas.
Database management tools - Tools like MySQL assist in the development,
querying, and management of databases.
Republic of the Philippines
President Ramon Magsaysay State University
(Formerly Ramon Magsaysay Technological University)
Iba, Zambales, Philippines
Tel/Fax No.: (047) 811-1683
OBJECT ORIENTED PROGRAMMING
JAVA OVERVIEW
WHAT IS JAVA?
Java is a popular programming language, created in 1995. It is owned by Oracle, and more
than 3 billion devices run Java.
It is used for:
Mobile applications (specially Android apps)
Desktop applications
Web applications
Web servers and application servers
Games
Database connection
And much, much more!
JAVA QUICKSTART
In Java, every application begins with a class name, and that class must match the filename.
Let's create our first Java file, called Main.java, which can be done in any text editor (like
Notepad).
The file should contain a "Hello World" message, which is written with the following code:
JAVA SYNTAX
Every line of code that runs in Java must be inside a class. In our example, we named the class Main.
A class should always start with an uppercase first letter.
The name of the java file must match the class name. When saving the file, save it using the class
name and add ".java" to the end of the filename.
The main() method is required and you will see it in every Java program:
2. System.out.println()
Inside the main() method, we can use the println() method to print a line of text to the screen:
Note: The curly braces {} marks the beginning and the end of a block of code.
System is a built-in Java class that contains useful members, such as out, which is short for "output".
The println() method, short for "print line", is used to print a value to the screen (or a file).
Don't worry too much about System, out and println(). Just know that you need them together to
print stuff to the screen.
You should also note that each code statement must end with a semicolon (;).
1. Print Text
You can add as many println() methods as you want. Note that it will add a new line
for each method:
2. Print Numbers
You can also use the println() method to print numbers.
However, unlike text, we don't put numbers inside double quotes:
You can also perform mathematical calculations inside the println() method:
JAVA COMMENTS
Comments can be used to explain Java code, and to make it more readable. It can also
be used to prevent execution when testing alternative code.
1. Single-line Comments
- Single-line comments start with two forward slashes (//).
- Any text between // and the end of the line is ignored by Java (will not be executed).
This example uses a multi-line comment (a comment block) to explain the code:
Java Variables
Where type is one of Java's types (such as int or String), and variableName is the name of
the variable (such as x or name). The equal sign is used to assign values to the variable.
1. To create a variable that should store text, look at the following example:
2. To create a variable that should store a number, look at the following example:
3. You can also declare a variable without assigning the value, and assign the value later:
4. Note that if you assign a new value to an existing variable, it will overwrite the previous
value:
2. Final Variables
If you don't want others (or yourself) to overwrite existing values, use the final keyword (this
will declare the variable as "final" or "constant", which means unchangeable and read-only):
3. Other Types
A demonstration of how to declare variables of other types:
1. Display Variables
The println() method is often used to display variables.
You can also use the + character to add a variable to another variable:
For numeric values, the + character works as a mathematical operator (notice that we
use int (integer) variables here):
2. Declare Many Variables
To declare more than one variable of the same type, you can use a comma-separated list:
You can also assign the same value to multiple variables in one line:
JAVA IDENTIFIERS
1. Identifiers
All Java variables must be identified with unique names.
These unique names are called identifiers.
Identifiers can be short names (like x and y) or more descriptive names (age, sum,
totalVolume).
Primitive data types - includes byte, short, int, long, float, double, boolean and char
Non-primitive data types - such as String, Arrays and Classes
A primitive data type specifies the size and type of variable values, and it has no additional
methods.
JAVA NUMBERS
1. Integer types stores whole numbers, positive or negative (such as 123 or -456), without
decimals. Valid types are byte, short, int and long. Which type you should use, depends on the
numeric value.
2. Floating point types represents numbers with a fractional part, containing one or more
decimals. There are two types: float and double.
Integer Types
1. Byte
The byte data type can store whole numbers from -128 to 127. This can be used instead
of int or other integer types to save memory when you are certain that the value will be
within -128 and 127:
2. Short
The short data type can store whole numbers from -32768 to 32767:
3. Int
The int data type can store whole numbers from -2147483648 to 2147483647. In
general, and in our tutorial, the int data type is the preferred data type when we create
variables with a numeric value.
4. Long
The long data type can store whole numbers from -9223372036854775808 to
9223372036854775807. This is used when int is not large enough to store the value.
Note that you should end the value with an "L":
The precision of a floating point value indicates how many digits the value can have after the
decimal point. The precision of float is only six or seven decimal digits, while double variables
have a precision of about 15 digits. Therefore it is safer to use double for most calculations.
Scientific Numbers
A floating point number can also be a scientific number with an "e" to indicate the power of
10:
Very often in programming, you will need a data type that can only have one of two values,
like:
- YES / NO
- ON / OFF
- TRUE / FALSE
For this, Java has a boolean data type, which can only take the values true or false:
Java Characters
1. Characters
- The char data type is used to store a single character. The character must be
surrounded by single quotes, like 'A' or 'c':
2. Strings
- The String data type is used to store a sequence of characters (text). String
values must be surrounded by double quotes:
Non-primitive data types are called reference types because they refer to objects.
The main difference between primitive and non-primitive data types are:
- Primitive types are predefined (already defined) in Java. Non-primitive types are
created by the programmer and is not defined by Java (except for String).
- Non-primitive types can be used to call methods to perform certain operations, while
primitive types cannot.
- A primitive type has always a value, while non-primitive types can be null.
- A primitive type starts with a lowercase letter, while non-primitive types starts with an
uppercase letter.
- Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc.
REFERENCES
What is Computer Programming - javatpoint