Csc 311 Survey of Programming of Programming Languages Overview of Programing Languages
Total Page:16
File Type:pdf, Size:1020Kb
CSC 311 SURVEY OF PROGRAMMING OF PROGRAMMING LANGUAGES OVERVIEW OF PROGRAMING LANGUAGES LECTURE ONE Lesson objectives By the end of this lesson, students should be able to: Understand programming and programming language Describe flow of programming language Describe the structure of programming language Describe different classification of programming language Identify why are there so many programming languages Identify what makes a language successful Describe importance of programming language What is Programming? A program is a set of instructions use in performing specific task. Therefore, Programming is an act of writing programs. Meaning of Programming Language Programming Languages are important for software technologies. It is a basic one, without it programming could not do a thing about software. It is a key factor to every software. There are different types of programming languages that are currently trendy. Such as: • C • C++ • Java • C# • Python • Ruby. etc Normal Language is a communication between two people. We are using English, Tamil, Hindi and so on using communication between two people. Flow of programming Languages Compiler Compiler is an intermediary to understand each language. Compiler converts High level languages to low level languages as well as low level languages convert to high level languages. Each language needs at least one compiler. Without compiler we could not understand low level language. Input Output Structure of Programming Languages Each programming Language has separate structure but a little bit changes in each programming change. Syntax wise we only have changes of each programming language otherwise it's the same structure. Header file is some supporting files. It is located at the top of program. Header file is the head of program. We call header file a different name in different languages. Like bellow. Header File -> C Language Header File -> C++ Language Package -> Java Language Namespace -> C# Language Main Function is important part of programming languages. Main function is like our body, each and every function happens in main function section. Main function is starting point of programming languages. Sub function is optional one. If need it we can use, otherwise leave it. All programming language is syntax wise different apart from others, these are same. For example if I need to print one line using any program using below. printf(“Welcome To C# Corner”) C Language cout<<”Welcome To C# Corner”; C++ Language System.out.print(“Welcome To C# Java Language Corner”); Console.WritLine(“Welcome To C# C# language Corner”); A classification of languages There are many systems of classifying languages, but for the present purposes the following division into four kinds of languages seems appropriate. Traditional programming languages include C, Pascal, Java, and many more; a first course in just "programming" will usually teach programming in one of these (but the exact choice beyond that has varied considerably over time). Common for these is that one uses an external compiler to transform source code into executable code (often but not always native machine code for the computer you run the compiler on). Primary concerns are speed of the executable code, detail specification of what should be done, and the ability to write large programs. Dynamic programming languages (also known as 'scripting languages') do typically not have a separate compiler; they may be interpreted (parse one instruction and then immediately execute it), compiled (at the time you run the program), or a combination thereof. Primary concerns are that programs should be easy to write and modify. Dynamic programming languages can often be run interactively, where you type instructions at a prompt and see them executed in turn. Specialised programming languages are in principle similar to the dynamic programming languages, but with a particular focus on one kind of data or one problem domain. This class includes the major computer algebra systems (Maple, Mathematica, Maxima), the matrix-oriented Matlab, and the statistics-oriented language R. Unconventional programming languages is a catch-all category for "everything else". These are things which you can use for programming, but may be strange to use as such. If you end up in this category, you're probably doing something very clever or something very stupid, possibly both. Notes on specific languages .Traditional languages C is a very low level language — it's been described as "structured assembly language" — but it constitutes a reference point to which most later languages have needed to relate themselves (as evidenced by the large number of languages that are named 'C-something'). The main thing to realize about C is that everything you write maps very directly onto machine code. The good thing about this is that C lets you do pretty much anything. It is perfectly possible to code anything in C, but it requires knowing what you're doing and also some discipline to keep things sane. Coding something in C means you're starting at a very low level, even if there are plenty of code libraries out there which might provide you with higher level operations. C++ (a name that may be interpreted as "successor of C") is an extension of C with features for object-oriented programming (OOP), which simplifies higher-level programming. C++ is a very large language, both because it contains all of C in addition to the object-oriented extensions, and because of how these extensions were implemented; a design goal has been that programmers should be free to pick their own programming style (meaning that C++ should support some realization of said style, for every style imaginable). A good thing about C++ is that it comes with a standard library of data structures, that cater for most needs one tends to have in that direction. A problem can however be that the design of this library prioritizes being optimal (in the eyes of theoretical computer scientists of the 1990's), so sometimes the interfaces may appear obscure to the user who is not schooled in computer science. C# (Microsoft), Java (Sun/Oracle), and Objective-C (Apple) are three other languages that — like C++ — aim to be "similar to C, but higher level with object-orientation". Whereas C++ aims to support everything, these three are more inclined to pick one thing as the "correct" way of doing something, which allows them to be smaller. Another difference is that they are all being promoted by a particular company (as indicated), either because the language was invented there, or because it got adopted by the company. Haskell is a pure functional programming language (in contrast to the imperative nature of mainstream programming languages); this makes it close to pure mathematics, but can also make it hard to comprehend. The language has ties to category theory, which places it in high regard in certain research communities. The reason it is listed under "Traditional languages" is that one still uses a compiler to produce executable code. Dynamic languages JavaScript (or ECMA-script, as is nowadays the official name) is a dynamic programming language most known for its use in web pages (client-side scripting), but it is in fact a general programming language. Some nice things about it is that it is probably the most widely deployed dynamic language today (pretty much every web browser has it built in), it is fairly easy to make user interfaces for it (embed your program in an HTML file that serves as the user interface), and it's pretty fast (because much effort has been spent on optimizing engines for it) for being a dynamic programming language. A disadvantage is that since it's predominantly being used for scripting in webpages, it might be hard to find information about how to use this language for doing anything else. LISP is one of the oldest programming languages there is, and for many decades the obvious choice for anything "AI" (which was short for "Artificial Intelligence", but in practice could mean just about any computation that was not on simple numerical data). Though since the 1990's not fashionable anymore, it remains among the languages used for doing mathematical things, and the ELISP dialect is built into every Emacs editor. A close (and more modern) relative of LISP is Scheme. There is a rigorous definition distinguishing dialects of LISP from dialects of Scheme, but the details are somewhat technical (i.e., unless you know what to look for it might as well appear to be two dialects of a single language). A word of warning is that LISP (and Scheme) handles data at a pretty low level (similar to how C programs are close to machine code: you can express things using only structured concepts, but they really map onto lower level realizations, and there is little cushioning); this is in part due to the age of the language, as early LISP programs had to keep their data in very tiny memories (by today's standards). If you choose to use LISP, then you need to be aware of things like how what looks like a list of items is actually a linked list of cons cells, since most language operations presume that you know this. Python is probably the most fashionable dynamic language for mathematical/scientific calculations nowadays. It fits well within the current programming language mainstream, except perhaps in that it uses indentation to encode (rather than just indicate) block structures in programs. Tcl is a very simple language, and may as such be appropriate for the beginner programmer, although some experienced programmers are confounded by it because the language does not implicitly do several things that they may be used to from other languages (such as distinguish between the number 11 and the string of two digits 1).