Computer Programming For Beginners, Programming Environment Setup, Basic Syntax, keywords, Identifiers, Data Types, Variables, Operators, Control Flow, Functions/Methods, IO, Exception Handling, etc.
Selenium Online Training with Project (by G C Reddy)
1. Introduction to Computer Programming
2. Computer Programming Environment Setup
3. Keywords, Identifiers, and Code Libraries.
4. Computer Programming Syntax and Structure
5. Data Types and Variables
7. Control Flow Statements
8. String Handling
9. Data Structures
10. Functions / Methods
11. Input & Output
12. File Handling.
13. Exception Handling
14. Object Oriented Programming.
Basics Of Computer Programming For Beginners
What Is Computer Programming?
A computer program is a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer.
Computer programming is used for:
1. Frontend Development
2. Backend/Database Development
3. Desktop Development
4. Web Development
5. Mobile Development
6. Cloud computing development
7. API development
8. Data science
9. Software tools development
10. Security software development
11. Video game development
12. Embedded systems development
13. System/Network Administration
Computer Programming Language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may be also be graphical.
Popular computer programming languages:
Important components to write computer programs
An editor, a compiler/interpreter, keywords, identifiers, code libraries, basic syntax, and program structure.
A source-code editor is a text editor program designed specifically for writing and editing source code of computer programs.
It may be a standalone application or it may be built into an integrated development environment (IDE) or web browser.
A compiler is a special program that translates a programming language’s source code into machine code, bytecode or another programming language. The source code is typically written in a high-level, human-readable language.
Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier.
Identifier refers to name given to entities such as variables, functions/methods, objects, and structures etc.
Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program.
Syntax in computer programming means the rules that control the structure of the symbols, punctuation, and words of a programming language.
The overall form of a program, with particular emphasis on the individual components of the program and the interrelationships between these components.
Computer Programming For Beginners
Computer Programming Language Elements
Programming environment setup
Programming or Development Environment Setup is the process of installation and configuration of software required for writing programs in a computer programming language.
To write programs a computer programming language we need two things:
A text editor is a software used for writing code in c. Example Windows Notepad, Notepad++, vim for Linux.
A compiler is a software required to compile your source code into machine-executable code.
An interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program.
Note: With the help of the above two software, we can start writing programs, But to make it simple we will use free software for programming. This type of software is known as an IDE (Integrated Development Environment).
Below are the names of free IDE software available on the internet. You can download any of the software mentioned below for writing programs.
- Microsoft Visual Studio
A keyword is a word that is reserved by a programming language because that word has a special meaning, typically a command or parameter.
Keywords are used in many different languages, but they all have similar functions and purposes.
Keywords help programmers to write code more efficiently by allowing them to use words instead of having to spell out every single command.
Ex: if, for, while, public, private, etc.
Identifiers represent the name in the program, for example, variables, functions/methods, arrays, structures, objects, unions, labels, etc.
An identifier can be composed of letters such as uppercase, lowercase letters, underscore, digits, but the starting letter should be either an alphabet or an underscore.
Libraries in programming languages are collections of prewritten code that users can use to optimize tasks.
Libraries example in java are, System, Scanner, File, Math, ArrayList, etc.
Basic syntax represents the fundamental rules of a programming language. Without these rules, it is impossible to write functioning code.
Every language has its own set of rules that make up its basic syntax. Naming conventions are a primary component of basic syntax conventions and vary by language.
- Case-sensitive language
- Statement ends with Semicolon (;)
- Adding Comments to Code
- When we write a code block, its body is enclosed in curly braces.
The structure of a program means the specific structure to start the programming in a programming language. Without a proper structure, it becomes difficult to analyze the problem and the solution. It also gives us a reference to write more complex programs.
Example: A typical structure of a Java program contains the following elements:
- Documentation Section
- Package Declaration
- Import Statements
- Interface Section
- Class Definition
- Class Variables and Variables
- Main Method Class
- Methods and Behaviors
A data type, in programming, is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error.
Variables are the names you give to computer memory locations which are used to store values in a computer program.
Creating variables is also called declaring variables in C programming. Different programming languages have different ways of creating variables inside a program.
For example, Java programming has the following simple way of creating variables −
String city = “Hyderabad”;
char a = ‘Y’;
boolean val = true;
An operator in a programming language is a symbol that tells the compiler or interpreter to perform specific mathematical, relational or logical operation and produce final result.
We have various categories of operators in computer programming:
10+20 = 30
18*7 = 126
100 != 110 – true
In computer science, control flow (or flow of control) is the order in which individual statements, instructions, or function/method calls of an imperative program are executed or evaluated.
We have three types of control flow statements in computer programming:
- Conditional/Decision making statements
- Interactive/Loop statements
- Branching/Jump statements
A string is any series of characters that are interpreted literally by a script.
For example, “Hello world” and “India123” are both examples of strings.
In computer programming, a string is attached to a variable as shown in the example below.
String name = “G C Reddy”;
In computer programming, a data structure is a predefined format for efficiently storing, accessing, and processing data in a computer program.
Types of data structures:
1. Primitive data structures – A primitive data structure can hold a single value.
2. Compound data structures
Compound data structures can contain multiple elements. These elements are usually values of a primitive data type, such as an integer or character. Some compound structures are restricted to a single data type, while others permit a mixture of data types.
Method and a function are the same, with different terms. A method is a procedure or function in object-oriented programming.
A function is a group of reusable code which can be called anywhere in your program. This eliminates the need for writing the same code again and again. It helps programmers in writing modular codes.
Input & output
Input and output, or I/O is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system.
Inputs are the signals or data received by the system and outputs are the signals or data sent from it.
Exception is an unwanted or unexpected event, which occurs during the execution of a program, i.e. at run time, that disrupts the normal flow of the program’s instructions. Exceptions can be caught and handled by the program.
Exception handling in computer programming is one of the effective means to handle the runtime errors so that the regular flow of the application can be preserved.
Object oriented programming
Object-oriented programming (OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field that has unique attributes and behavior.
Structure of object-oriented programming:
Principles of object-oriented programming (OOP)
Computer Programming For Beginners
Computer Programming For Beginners