Programming Languages & Data Types Presentation. Programming Languages A programming language is a...

21
Programming Languages & Data Types Presentation

Transcript of Programming Languages & Data Types Presentation. Programming Languages A programming language is a...

Page 1: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Programming Languages & Data Types Presentation

Page 2: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Programming LanguagesA programming language is a language designed to communicate a set of instructions to a machine. They can be used to create programs that control a machine, as well as expressing algorithms accurately. The description of a programming language is usually split into the two components of syntax (form) and semantics (meaning). Although there are thousands of different programming languages which have been created, with continual updates and improvements, there are three basic types: machine, assembly and high-level.

Machine language Machine language uses different combinations of zeroes and ones to send different instructions

to the computer.

Assembly language Assembly language uses easy to recognise codes alongside another program called an

assembler which will translate it into machine language. The program will typically be stored in non-volatile memory until it is requested , when it will be loaded into random access memory (RAM). Once it is loaded into the RAM it then can be accessed by the central processing unit (CPU). It will then execute instructions until terminated by the user or software or hardware

error.

High-level languagesHigh-level languages contain commonly used English words and phrases, which typically

translate into several instructions in machine language.

Page 3: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Python

Page 4: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Python is a widely used and high level programming language. Since 2008, it has consistently ranked in the top eight most popular programming languages as measured by the TIOBE Programming Community Index. Python uses common readable English words, instead of punctuation, to express commands in a simpler format. This enables

programs to be run on both a small and large scale.

Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk and Unix shell and other scripting languages

Page 5: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Python Features: - Has relatively few keywords, simple structure, and a clearly defined syntax. - Code is much more clearly defined and visible to the eyes. - Can be used as a scripting language or can be compiled to byte-code for building large applications. - Can interact with the interpreter directly to write your programs - Has a source code which is fairly easy-to-maintain. - Supports Object-Oriented style or technique of programming that encapsulates code within objects. - The bulk of the library is very portable and cross-platform compatible on UNIX, Windows and Macintosh. - Allows interactive testing and debugging of snippets of code. - Can run on a wide variety of hardware platforms and has the same interface on all platforms. - Enables programmers to add to or customize their tools.- Provides interfaces to all major commercial databases. - Supports GUI applications that can be created and ported to many system calls, libraries and windows systems, such as Windows MFC, Macintosh and the X Window system of Unix. - Supports dynamic type checking - Provides a better structure and support for large programs than shell scripting. - Can be easily integrated with C, C++, COM, ActiveX, CORBA and Java.

Page 6: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Python UsesPython is a great language for the beginner programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games. Large organizations that make use of Python include Google, Yahoo!, CERN, NASA and some smaller ones like ILM and ITA. Python has also been successfully embedded in a number of software products as a scripting language, including in finite element method software , visual effects compositors and 2D imaging programs. It can however also be used in a wide range of non-scripting contexts. Python to be used effectively in scientific computing and even video games.

Python Comparisons Python is processed at runtime by the interpreter and you do not need to compile

your program before executing it. This is similar to PERL and PHP. The standard library has two modules (itertools and functools) that implement functional tools borrowed

from Haskell and Standard ML.

Van Rossum, the creator, designed a small core language with a large standard library and an easily extensible interpreter from the very start because of his frustrations

with ABC.The Python philosophy rejects exuberant syntax, such as in Perl, in favor of a sparser, less-cluttered grammar. Python's philosophy rejects the Perl "there is more than one

way to do it" approach to language design in favor of "there should be one—and preferably only one—obvious way to do it".

Page 7: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

JavaScript

Page 8: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

JavaScript (JS) is an interpreted computer programming language with dynamic typing and has first-class functions. It is a multi-

paradigm language, supporting object-oriented, imperative and functional

programming styles.JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics.

Newer and faster JavaScript VMs and frameworks built upon them have also increased the popularity of JavaScript for server-side web applications.

Page 9: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

JavaScript Features:- Allows client-side scripts to interact with the user.- Allows control of the browser.- Allows communication asynchronously.- Allows the user to alter the document content that is displayed.- An indefinite number of parameters can be passed to a function - Can be used outside of web pages—for example, in PDF documents, site-specific browsers and desktop widgets.- Supports much of the structured programming syntax from C.- Supports various ways to test the type of an object, including duck typing.- Properties and their values can be added, changed, or deleted at run-time- Includes an eval function that can execute statements provided as strings at run-time.- Simulates many class-based features with prototypes.- Includes property getter and setter functions - new language features are added periodically

Page 10: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

JavaScript Uses JavaScript has become common in server-side programming, game

development and the creation of desktop applications.

JavaScript Comparisons JavaScript’s syntax was influenced by C. Like C, JavaScript makes a distinction

between expressions and statements. One syntactic difference from C is automatic semicolon insertion, in which the semicolons that terminate statements can be

omitted.

JavaScript has many features adopted from Python including iterator protocol, shallow generators-coroutines,

array comprehensions and generator expressions .

Page 11: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Perl

Page 12: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Perl is a family of high-level, general-purpose, interpreted dynamic programming languages. The languages in this family include Perl 5 and Perl 6.

Though Perl is not officially an acronym, there are various backronyms in use, such as: Practical Extraction and Reporting Language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing

easier. Since then, it has undergone many changes and revisions. The latest major stable revision of Perl 5 is 5.18, released in May 2013. Perl 6, which began as a redesign of Perl 5 in 2000, eventually evolved into a separate language. Both

languages continue to be developed independently by different development teams and liberally borrow ideas from one another.

8]. Perl 5 gained widespread popularity in the late 1990s as a CGI scripting language, in part due to its parsing abilities.

Page 13: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Perl Features:

- Is procedural in nature, - Provides powerful text processing facilities.- Facilitates easy manipulation of text files .- Has many built-in functions that provide tools often used in shell programming- Simplifies and facilitates many parsing, text-handling, and data-management tasks.- Allow variables to be interpolated directly into strings.- Supports complex data structures, first-class functions.- Has the ability to package code as reusable modules .

Page 14: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Perl Uses Perl has chiefly been used to write CGI scripts. Perl 5 is used for graphics

programming, system administration, network programming, finance, bioinformatics and other applications. High-traffic websites that use Perl extensively

includeAmazon.com, bbc.co.uk, Priceline.com, and Ticketmaster. Graphical user interfaces (GUIs) may also be developed using Perl, for example, Perl/Tk and WxPerl.

Perl Comparisons The overall structure of Perl derives broadly from C. The Perl languages borrow

features from other programming languages including shell scripting , AWK and sed. Perl takes lists from Lisp hashes ("associative arrays") from AWK, and regular

expressions from sed.

Page 15: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Haskell

Page 16: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Haskell is a standardized, general-purpose, purely functional programming language with non-strict semantics and strong static typing. It is named after logician Haskell

Curry. In Haskell. As a functional programming language, the primary control construct is the function.

Page 17: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Haskell Features:- Lazy evaluation, pattern matching, list comprehension, type classes and type polymorphism.- Is based on Hindley–Milner type inference.- High-performance implementation of concurrency and parallelism.

- Has a strong, static type system.- Is both an interpreter and native-code compiler.- Has an open, published specification.- Has multiple implementations.- Has more than 5400 third-party open-source libraries and tools available

Page 18: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Data Types Almost all programming languages explicitly include the notion of data type,

though different languages may use different terminology. Common data types may include:

integersbooleans

charactersfloating-point numbers,

alphanumeric strings

Different type systems ensure varying degrees of type safety. Most programming languages also allow the programmer to define

additional data types, usually by combining multiple elements of other types and defining the valid operations of the new data type.

Page 19: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Machine data typesAll data in computers based on digital electronics is represented as bits (alternatives 0 and 1) on

the lowest level. The smallest addressable unit of data is usually a group of bits called a byte(usually an octet which is 8 bits). The unit processed by machine code instructions is called

a word (as of 2011, typically 32 or 64 bits). Most instructions interpret the word as a binary number such that a 32-bit word can represent unsigned integer values from 0 to or signed integer values from to . Because of two's complement the machine language and machine

doesn't need to distinguish between these unsigned and signed data types for the most part.

Boolean typeThe Boolean type represents the values: truea nd false Although only two values are possible, they are rarely implemented as a single binary digit for efficiency reasons. Many programming

languages do not have an explicit boolean type, instead interpreting (for instance) 0 as false and other values as true.

Numeric typesSuch as:

The integer data types, or "whole numbers". May be subtyped according to their ability to contain negative values (e.g. unsigned in C and C++). May also have a small number of predefined subtypes (such as short and long in C/C++); or allow users to freely define subranges such as 1..12

(e.g. Pascal/Ada).Floating point data types, sometimes misleadingly called reals, contain fractional values. They

usually have predefined limits on both their maximum values and their precision.Fixed point data types are convenient for representing monetary values. They are often

implemented internally as integers, leading to predefined limits.

Page 20: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Composite types

Composite types are derived from more than one primitive type. This can be done in a number of ways. The ways they are combined are called data

structures Composing a primitive type into a compound type generally results in a new type, e.g. array-of-integer is a different type to integer.

EnumerationsThe enumerated type. This has values which are different from each other, and which can be compared and assigned, but which do not necessarily have any particular concrete representation in the computer's memory; compilers and

interpreters can represent them arbitrarily.

String and text types

Alphanumeric character : A letter of the alphabet digit, blank space, punctuation mark, etc.

Alphanumeric strings a sequence of characters. They are typically used to represent words and text.

Character and string types can store sequences of characters from a character set such as ASCII Since most character sets include the digits, it is possible to have a numeric string, such as"1234". However, many languages would still

treat these as belonging to a different type to the numeric value 1234.

Page 21: Programming Languages & Data Types Presentation. Programming Languages A programming language is a language designed to communicate a set of instructions.

Other typesTypes can be based on, or derived from, the basic types explained above. In some

languages, such as C, functions have a type derived from the type of their return value

Pointers and referencesThe main non-composite, derived type is the pointer a data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory

using its address. It is a primitive kind of reference (

Function typesAny type that does not specify an implementation is an abstract data type. For instance, a stack(which is an abstract type) can be implemented as an array (a

contiguous block of memory containing multiple values), or as a linked list a set of non-contiguous memory blocks linked by pointers.

Utility typesA type system associates types with each computed value. By examining the flow of

these values, a type system attempts to prove that no type errors can occur. The type system in question determines what constitutes a type error, but a type system

generally seeks to guarantee that operations expecting a certain kind of value are not used with values for which that operation does not make sense.