Leaning Outcomes Concepts of Basic Programing Languages State
Leaning Outcomes Concepts of Basic Programing Languages. • State The Definition of Program , Language and Programming Language. • Example of Programming Language • Elements of programming Language • Levels of Programming Language. • Generations Of programming Language. • Translators Of programming Language • Defining Source Code, Object Code, and Machine Code, • Binary Numbers • Programming Development Cycle. • History of C++, Python , Java , PHP and Visual Basic Language and How to install. • Creating 3 Basic Projects with different Language • Free Sources You Can Learn
Definitions of Language, Program and Programming Language. • Computer Language: are the by which a user command a computer to work on the algorithm with a sure has a written to get an output. • A computer program: is a series of organized instructions that directs a computer to perform a tasks. • Programming Language: is a set of words, symbols and codes that enables human to communicate with computers.
• Programming languages are use to write application programs which are used by end users. • The programming languages are generally used only by professional programmers to write programs. • The development of programming languages has improved considerably with the ease and ability of programmers to write powerful applications programs that can solve any task in the world today. • Each computer programming language has its own distinctive grammars and syntax and its own manner of expressing ideas. In principle most computational task could be accomplish by any of the languages but the programs would look very different moreover, writing a program for a particular task could be easier with some languages than the others.
• BASIC programming language plays great role to start learning programming. • After learning BASIC language, you can easily learn other programming languages using concepts of BASIC programming language. • BASIC is stand for Beginner's allpurpose Symbolic Instructions Code.
Examples of programming Language • Hundreds of programming language exists today, each language has its own standards or rules for writing the commands and/or instructions and the most popular programming Language are: • • • C++ C# Python. Java. Script, Visual Basic, PHP Swift Ruby SQL
• Python is an object-oriented programming language created by Guido Rossum in 1989. It is ideally designed for rapid prototyping of complex applications. It has interfaces to many OS system calls and libraries and is extensible to C or C++. Many large companies use the Python programming language include NASA, Google, You. Tube etc. • Python programming is widely used in Artificial Intelligence, Natural Language Generation, Neural Networks and other advanced fields of Computer Science.
• C++ is a high-level, general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". • uses of C++ allows procedural programming for intensive functions of CPU and to provide control over hardware, and this language is very fast because of which it is widely used in developing different games or in gaming engines. C++ mainly used in developing the suites of a game tool. • Visual Basic 1. 0 was introduced in 1991. The drag and drop design for creating the user interface is derived from a prototype form generator developed by Alan Cooper and his company called Tripod. . Microsoft decided to combine Ruby with the Basic language to create Visual Basic.
• Uses: Visual Basic can create executable (EXE files), but is primarily used to develop Windows applications and to interface database systems. • Dialog boxes with less functionality can be used to provide pop-up capabilities
Basic Programming Elements 1. input: getting data and commands into the computer 2. output: getting your results out of the computer 3. arithmetic: performing mathematical calculations on your data 4. conditional: testing to see if a condition is true or false 5. looping: cycling through a set of instructions until some condition is met. Example • Let's look at an ATM. You walk or drive up to it, swipe your ATM card, tell it how much money you want, and, after chugging for a moment or two, it spits out cash and a receipt. You can withdrawal your account amount like 50$.
• Input: Input can come from just about anywhere: a keyboard, a touchscreen, a text file, and another program are just a few examples. Input is one of the two elements that are used by every program because every program needs some data to work with. When you use an ATM, the input comes from two things: your ATM card and the information you enter on the keypad. Your ATM card has some customer identification on the magnetic strip on the back. It tells the ATM who you are so it can get your account information.
Computers can perform all kinds of mathematical operations and functions, from the simple addition or subtraction needed to update your checking account balance after a withdrawal or deposit, to the complex calculus needed to put a satellite into orbit. Not every program needs to do calculations on the data that's entered, but it may still need to do some in order to control what is happening inside the program itself. We'll see that in a minute. In our example, the ATM will check your balance and, if you have enough money, subtract $40 from it. And, that's the arithmetic part - the subtraction. So, this part of our flowchart is a process showing subtraction. • Arithmetic:
• Conditional: Conditionals: conditionals specify the execution of the statements depending on the whether condition is satisfied or not. Basically it refers to an action that only fulfil when the applied condition on instructions satisfied. They are one of the most important components of the programming language because they give freedom to program to act differently every time when it execute that depends on input to the instructions • A loop: is a sequence of instructions that repeat the same process over and over until a condition is met and it receives the order to stop. In a loop, the program asks a question, and if the answer directs the program to perform an action, the action is performed, and the loop runs again, performing the same task. It runs until the answer is such that no action is required and the code can proceed further. Loops are considered one of the most basic element and powerful programming.
Levels of Programming Languages There are two levels of programming languages. • Low level language. • high-level language (HLL). 1. Low level language: is a language that is very close to machine language and provides a little abstraction of programming concepts. Low-level languages are closer to the hardware than human languages. The most common examples of low-level languages are assembly and machine code. • Low-level languages are divided into two generations each more powerful than the last! a) First Generation b) Second Generation
Advantage. • The main advantage of programming in 1 GL is that the code can run very fast and very efficiently, precisely because the instructions are executed directly by the CPU. Disadvantages. • One of the main disadvantages of 1 GL programming in a low level language is that when an error occurs, the code is not as easy to fix.
First Generation Language(1 GL) • The first generation languages, or 1 GL, are low-level languages that are machine language. • Programming language history really began with the work of Charles Babbage in the early nineteenth century who developed automated calculation for mathematical functions. • Further developments in early 1950 brought us machine language without interpreters and compilers to translate languages. And the first generation computer language was machine language, all the machine used machine code which consisted of 0 s and 1 s. • Machine language is highly efficient and allows direct control of each operation; however programmers had to write computer programs using 0 and 1. •
Second Generation Language (2 GL) • The second-generation languages, or 2 GL, are also low- level assembly languages. • They are sometimes used in kernels and hardware drives, but more commonly used for video editing and video games. • Symbolic addresses allowed programmers to represent memory locations, variables and instructions with names. • They had the capability to performs operation such like add, sum. Like machine languages, assembly languages were designed for specific machine and microprocessor, this implies that the program cannot be move from one computer architecture without writing the code which means learning another language where you are to transfer the programs.
2. high-level language (HLL) is a programming language that lets the developer write programs irrespective of the nature or type of computer. But if a computer has to understand a high-level language, it should be compiled into a machine language. HLLs are considered high-level because they are in close proximity to human languages and further from machine languages. a. Thirty Generation b. Fourth Generation c. Fifty Generation
• Advantages: • Easy to learn and use (reliability). • Better communication. • This language is easy to program and understand. • Also, easy to modify errors and mistakes. • Similarly, it is easy to translate the language into machine language • Disadvantages: • It has less efficiency. • The translator is necessary to translate languages. • Conversion time is slower than low level language.
Thirty Generation Language (3 GL) • The third-generation languages, or 3 GL, are high- level languages such as C, C++, Java. Script, and Visual Basic. • Most of these languages had compilers and the advantage of this was speed. • Independence was another factor as these languages were machine independent and could run on different machines. • The advantages of high level languages include the support for ideas of abstraction so that programmers can concentrate on finding the solution to the problem rapidly, rather than on low-level details of data representation.
Fourth Generation Language (4 GL) • The fourth-generation languages, or 4 GL, are languages that consist of statements similar to statements in a human language. Fourth generation languages are commonly used in database programming and scripts examples include PHP, Python, Ruby, and SQL. • Programmers who use the computers and programs to solve problems from other applications are the main users of the fourth generation languages, fourth generation languages must be user friendly, portable and independent of operating systems, usable by nonprogrammers, having intelligent default options about what the user wants and allowing the user to obtain results fasts using minimum requirement code generated with bug-free code from high-level expressions (employing a data-base and dictionary management which makes applications easy and quick to change).
Fifty Generation Language (5 GL) • The fifth-generation languages, or 5 GL, are programming languages that contain visual tools to help develop a program • Most constraint-based and logic programming languages and some declarative languages are fifth-generation languages. • Complex processes like understanding speech would appear to be trivial using these fast inferences and would make the software seem highly intelligent. • Structured Approach in programming • Object Oriented Approach in programming
Defining Source Code, Object Code and Machine Code, • Source Code: is in the form of text, Source Code is human readable, Source Code is generated by human and Source Code input given to compiler Ø Object Code: is in the form of Binary Numbers, Object Code is in machine readable, Object Code is generated by Compiler and Object Code is output of compiler. ØMachine code: also known as machine language, is the elemental language of computers. It is read by the computer's central processing unit (CPU), is composed of digital binary numbers and looks like a very long sequence of zeros and ones.
• A Translators in Programming Language : is a programming language processor that converts a computer program from one language to another. • It takes a program written in source code and converts it into machine code. It discovers and identifies the error during translation. Purpose of Translator • It translates high-level language program into a machine language program that the central processing unit (CPU) can understand. • It also detects errors in the program.
Types of Translators • Assemblers: - The Assembler is used to translate the program written in Assembly language into machine code. The source program is a input of assembler that contains assembly language instructions. The output generated by assembler is the object code or machine code understandable by the computer. • Compilers: -Compilers function differently. They convert the source code in its entirety via a compilation process to binary. The binary is then executed. If there were errors in the source code, they are detected during the compilation time and flagged. This interrupts the compilation process, and no binary is generated. • Interpreters: -The translator processes the source code line by line and runs every line in the final program or app. This means that interpreted source code starts running until it encounters an error
What does Binary Number mean • A binary number is a positional numeral system with two as the base. • The binary number system consists of two different numerals, namely zero and one. These can be used to represent all other numbers. • As it has the advantages of easy implementation by logic gates, it is mostly used in electronic and computer-based devices, networking and digital signal processing.
Example Of Binary System
Programming Terms and Definitions • Algorithm: is a set of instructions or rules designed to solve a definite problem. The problem can be simple like adding two numbers or a complex one, such as converting a video file from one format to another. • Application Programming Interface (API) is a set of rules, routines, and protocols to build software applications. APIs help in communication with third party programs or services, which can be used to build different software. Companies such as Facebook and Twitter actively use APIs to help developers gain easier access to their services.
• Variables: are used to store information to be referenced and • • • manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program. Example : irb : 001 > first_name = 'Joe' => "Joe Control Structures: A control structure is a block of programming that analyzes variables and chooses a direction in which to go based on given parameters. The term flow control details the direction the program takes (which way program control “flows”). Hence it is the basic decision-making process in computing; flow control determines how a computer will respond when given certain conditions and parameters
• Syntax: is the set of rules that define what the various combinations of symbols mean. This tells the computer how to read the code. • Syntax refers to a concept in writing code dealing with a very specific set of words and a very specific order to those words when we give the computer instructions. • This order and this strict structure is what enables us to communicate effectively with a computer. Syntax is to code, like grammar is to English or any other language. A big difference though is that computers are really exacting in how we structure that grammar or our syntax.
Tools: A tool in programming is a piece of software that, when used while you code, allows you to get your program done faster!, • An Integrated Development Environment is a piece of software that will make your coding life so much easier. • IDEs will check the syntax of your code to ensure you don’t have any errors, they will organize your files and give you a nice way to view them (i. e. applies colours schemes to your code so it’s easier to interpret), they tend to have code completion.
• Declaration: A statement that describes a variable, function or any other identifier is called a declaration. A declaration helps the compiler or interpreter identify the word and understand its meaning, and how the process should be continued. Even though they are important, they are optional and may be used depending on the nature of the programming language.
Programming Development Cycle. • The program development cycle consists of four basic steps to follow when planning a computer program. However, often there are two more steps included in this cycle. By following this step-by-step process, the chance of making mistakes is minimal. We are going to take a look at each step in the cycle and what it is used for as well as why it is important when it comes to programming. • The first step in the cycle is analyzing: Analyzing basically defines the problem, this is a very important step in the process in order to develop an appropriate solution. At this time, an outline is made which defines the entire process including the program's input, output, and processing components.
• The second step in the cycle is design. At this time, any problems found during the analysis are broken down. • The method and appropriate programming language are chosen during this process. • Structured design allows the problem to be broken down into sections called modules. • This can be done so that each routine performs a single task. The structured design is important because it turns the main routine into smaller ones which helps the programmers locate any problems easily and stay organized. • The third step in the process is validating the design. • Besides the programmer, there are many other people involved in the stages of the program development cycle. System analysts, designers, system architects, coders and testers are also involved in the cycle. They are all important when it comes to developing a successful program
• This is done by computer programmers who code the design into a programming language. • Implementing the design is step four: this is when the code to translate the design into a program is written. • The new system is installed at this time. • Steps five and six are testing and documenting the solution. • The program is maintained and if any changes are needed, the cycle begins again. • The program development cycle is in fact called a cycle because any phase can lead to the previous or next step in the process. This normally happens only if an error is found. It is also referred to as a cycle because once it ends it begins again.
• LET’S BUILD THREE PROJECTS With C++, PYTHON, JAVA & VISUAL BASIC
C++ #include <iostream> It is the predefined library function used for input and output also called as header files. iostream is the header file which contains all the functions of program like cout, cin etc. and #include tells the preprocessor to include these header file in the program. • using namespace std; : means that you are going to use classes or functions (if any) from "std" namespace, so you don't have to explicitly call the namespace to access them. Functions • int main() • { • int main – 'int main' means that our function needs to return some integer at the end of the execution and we do so by returning 0 at the end of the program. 0 is the standard for the “successful execution of the program” cout << "Hello world!" << endl; : cout is an object of the output stream that is used to show output. Basically • return 0; : The return value of the main function is considered the "Exit Status" of the application. On most operating systems returning 0 is a success status like saying "The program worked fine". . In C++ it is optional to type "return 0; " at the end of the main function and the compiler includes it automatically • } • Between 2 big bracket called Statement •
• Example 2: • If you want to print the name of five countries, you can write • • • using Python print("USA") print("Canada") print("Germany") print("France") print("Japan") How to print simple string? Let us print 8 blank lines. You It is because we did not declare the call function "if__name__== "__main__". It is important that after defining the main function, you call the code by if__name__== "__main__" and then run the code, only then you will get the output "hello world!" in the programming console. Consider the following code def main(): print("hello world!") if __name__ == "__main__": main() print("Guru 99") can type: , print (8 * "n")
• Dict = {'Tim': 18, 'Charlie': 12, 'Tiffany': 22, 'Robert': 25} print (Dict['Tiffany']) • Python 2 Example • Dict = {'Tim': 18, 'Charlie': 12, 'Tiffany': 22, 'Robert': 25} Boys = {'Tim': 18, 'Charlie': 12, 'Robert': 25} Girls = {'Tiffany': 22} student. X=Boys. copy() student. Y=Girls. copy() print student. X print student.
• Example 1: List Count • Following example shows the working of count() function on a list: • list 1 = ['red', 'green', 'blue', 'orange', 'green', 'gray', 'green'] color_count = list 1. count('green') print('The count of color: green is ', color_count) • Output: The count of color: green is 3 • Example 2: Find the count of elements (Duplicates) in a givenlist • list 1 = [2, 3, 4, 3, 10, 3, 5, 6, 3] elm_count = list 1. count(3) print('The count of element: 3 is ', elm_count)
• Integer Variable Java • int i 1 = 27; int i 2 = -45; • //String is an array of characters char[] arr. Sample = {'R', 'O', 'S', 'E'}; String str. Sample_1 = new String (arr. Sample) • //Representation of String str. Sample_2 = "ROSE";
Free Sources You Can Learn • . Learn Python: https: //www. guru 99. com/python-tutorials. html • Learn Java: https: //www. guru 99. com/java-tutorial. html • R Course for Beginners: https: //www. guru 99. com/r-tutorial. html • Java. Script Course: https: //www. guru 99. com/interactive-javascript • • • tutorials. html Introduction to C++: https: //www. guru 99. com/cpp-tutorial. html C# Training: https: //www. guru 99. com/c-sharp-tutorial. html Learn PHP online: https: //www. guru 99. com/php-tutorials. html Free SQL Training: https: //www. guru 99. com/sql. html Go Tutorial: https: //www. guru 99. com/google-go-tutorial. htm Learn to code for free and get a developer job: https: //www. freecodecamp. org Read hundreds /
• https: //visualstudio. microsoft. com/vs/older-downloads: • https: //java-runtime-environment. en. softonic. com/download • Link to download dev c++ - https: //sourceforge. net/projects/orwe. . . • https: //visualstudio. microsoft. com/vs/express/ • http: //www. codeblocks. org/
- Slides: 43