420 likes | 731 Views
Programming Languages. compiled By Ergin TARI. Programming Language Classification according to Dr. Deryck Brown, School of Computer and Math Sciences The Robert Gordon University. General structured programming user defined data-types data abstraction Imperative procedural
E N D
Programming Languages compiled By Ergin TARI
Programming Language Classification according to Dr.Deryck Brown, School of Computer and Math Sciences The Robert Gordon University • General • structured programming • user defined data-types • data abstraction • Imperative • procedural • assignment statement • Declarative • functional • strict vs. lazy • referential transparency • Object-oriented • single-inheritance • multiple-inheritance • Logic • Structured Programming • An important methodology for dealing with complexity is structured programming • Complex tasks need to be broken down into simpler subtasks • Structured programming reduces complex problems to collections of simple, interconnected modules • It is up to the programmer to implement structured programming
High Level Programming Languages according to Deryck Brown from School of Computer and Math Sciences, The Robert Gordon University Most high-level programming languages can be categorized into one of three main categories: • procedural Languages( Fortran, Basic, COBOL and Pascal) • Hybrid Languages(such as C++). • Object-Oriented Languages (Smalltalk, Effiel ). Example of Procedural languages is FORTRAN, which was designed to perform mathematical calculations that used standard algebraic formulas.
High Level Programming Languages according to Deryck Brown from School of Computer and Math Sciences, The Robert Gordon University The main features of Procedural Languages are: When computers were developed in the 1940’s mathematicians for military purposes-for computing bomb trajectories and decoding enemy ordered and diplomatic transmissions used them. This reality was reflected in the development of “procedural algorithms”. Most data types and functions was build to be used in scientific computation. Accordingly, we had the following features for procedural algorithms: • All user and system interfaces are built into the compiler. An example of such functions are, mathematical operations, I/O interfaces, service libraries…etc. As such, it was impossible for users to develop their own interfaces. Only compiled functions would be used and users were restricted to use ready made facilities without being able to add (include) their own facilities. • All data types are predefined in the compiler. The user can define and use only those types of data such as Real, Integer, Float, Character…etc Each data type is associated with one or more operations. Thus it operations on data are restricts by data type. • Data defined to functions, subroutines and procedures should be available to all parts of the program. The main program (which calls these procedures) should have all data types and parameters defined in all its subroutines or procedures. This type of data specification requires more memory and adds many complications to the program interfaces (performed in the link stage).
High Level Programming Languages according to Deryck Brown from School of Computer and Math Sciences, The Robert Gordon University The main features of Object Oriented Languages (O.O.L) are: The idea of having all function definition performed by the compiler is no longer accepted in today’s programming requirements. We live in a world full of objects-planes, trains, cars, telephones, books, computers, etc. Procedural programming languages does not reflect this at all. As it is mentioned earlier it mostly satisfy the scientific requirements rather than other life requirements. To solve the procedural programming problems, OOL introduced three concepts: • Abstract Data Types(Classes) • Encapsulation. • Inheritance. • Polymorphism. OOL has no default data types. Users have to construct their own "Abstract data type" and use them together with their associated operations.
High Level Programming Languages according to Deryck Brown from School of Computer and Math Sciences, The Robert Gordon University Hybrid programming languages: • Example for this style of programming is C++. Hybrid languages allow the use of both procedural and OOL. It thus has some basic data type, which can be used to create procedural programming. It also has the ability to include Abstract data types to be used as OOL. • Mostly, Hybrid programming Languages are developments of structural languages. This is indeed true for C++, which is based on the structural language C. All basic properties of OOL such as Inheritance and Polymorphism are also applied to Hybrid languages.
Programming Languages according to Kim Taylor from Griffith University, Australia • Structural Programming Languages • Java, C, C++, Visual Basic, Pascal, Turbo Pascal, Modula-2 • Non-Structural Languages • Fortran • Scripting Languages • Bourne Shell, C Shell, Perl • Functional Programming Languages • Prolog, LISP, Hope • Query Languages • MSQL Lite, SQL, DBQ/AG
Programming Languages according to Bryan Pfaffenberger, author of ”Computers in Your Future 2003“ • First-Generation Languages: 1s and 0s • Second-Generation Languages: A Little Easier • Third-Generation Languages: Programming Comes of Age • Fourth-Generation Languages: Getting Away from Procedure • Object-Oriented Programming: A Revolution in the Making? • A Guide to Programming Languages: One Size Doesn’t Fit All
First-Generation Languages: 1s and 0s Terminology Machine Language Machine-dependent
Second-Generation Languages: A Little Easier Terminology Assembly Language Low-level Language Mnemonics Source Code
Third-Generation Languages (3GL): Programming Comes of Age Still procedural but high level languages Compilers and Interpreters Spaghetti Code and the Great Software Crisis Structured Programming Languages (late 1960s) Modular Programming Languages (1970s)
Fourth-Generation Languages (4GL): Getting Away from Procedure Terminology Report Generators Query Languages Structured Query Language (SQL) Natural Language nonprocedural
Object-Oriented Programming (OOP): A Revolution in the Making? Eliminating the Program Versus Data Discrimination What Is An Object? A unit of computer information that contains data as well as procedures and operations Classes Category of objects • OOP Advantages: • Generic objects can be reused in many applications • This reuse of software encourages a building block approach to software development, using standardized parts • Software development is much faster • Software is easier to understand, debug and maintain
Object-Oriented Programming: A Revolution in the Making? cont. Inheritance Objects capacity to “pass on” its characteristics to its “children” or subclasses. Rapid Application Development (RAD) Middleware (Objects Across the Enterprise) How programs can find objects and query • OOP Disadvantages: • Difficult to learn for programmers used to procedural languages • A new way of thinking is required • Objects reduce portability of code
A Guide to Programming Languages: One Size Doesn’t Fit All COBOL and Fortran: For Some People, Retro Rules! COBOL Fortran
A Guide to Programming Languages: One Size Doesn’t Fit All cont. Structured and Modular Languages Ada Visual Basic
A Guide to Programming Languages: One Size Doesn’t Fit All cont. Object-Oriented (OO) Languages Smalltalk C and C++ Java JavaScript (ECMAScript) public class hello { public static void main(String args[]) { System.out.println("Hello, world"); System.exit(0); } } #include <iostream.h> main() { cout << "Hello, world\n"; return 0; } #include <stdio.h> main() { printf("Hello, world\n"); return 0; } <script language=javascript type="text/javascript">document.write ("Hello, World!")</script>
Java The C and C++ versions are similar, but Java is noticeably different. Some of the differences are as follows. • Java has no header files. • Java "knows" about certain system features like the String class and the output stream System.out. • There are no global functions as in C and C++, but instead every function must be a part (a "method") of some class. This includes main(). • main() is a method ("member function" in C++) of the hello class, but it does not operate specifically on object instances of that class, and instead is what is called a "class method" that is part of the class for packaging purposes. In C++ the equivalent would be a static member function. • The hello class must be defined in a file called hello.java. There is no equivalent requirement in C or C++. • To pass out an exit status from the program, Java uses System.exit(n). In C and C++, there is the library function exit(), or one can return a value from main(). The Java approach is different from some other popular languages. Whether it is "right" is a somewhat pointless thing to argue about. For example, there are good reasons for not having a programming language "know" about I/O facilities such as stream I/O, but also good reasons on the other side.
A Guide to Programming Languages: One Size Doesn’t Fit All cont. PostScript and the Desktop Publishing Revolution
Introducing the Program Development Life Cycle (PDLC) Phase 1: Defining the Problem Phase 2: Designing the Prog. Top-Down Program Design Structured Design • Developing an Algorithm • Program Design Tools • Phase 3: Coding the Program
Introducing the Program Development Life Cycle (PDLC) cont. Phase 4: Testing and Debugging the Program Phase 5: Formalizing the Solution Phase 6: Implementing andMaintaining the Program
Scripting Languages from Les LaCroix • Early scripting languages ran commands in “batches” (e.g. DOS .BAT files, Unix shells: sh, csh) • More recent languages are just high-level, practical programming languages • Scripting languages are the “bread and butter” tools of network, system and web administrators
Scripting Languages(common features) • Typeless • Similar available basic data types: • numbers • strings • arrays • associative arrays (a.k.a. hashes or dictionaries)
Scripting Languages(common features) • Dynamically sized structures (strings, arrays, hashes) • C-like “structs” emulated with hashes • Classes, objects, methods • Can be thought of as interpreted languages (as opposed to compiled) • Portability
Scripting Languages(common features) • Extensibility in C • Common extensions: • file-level input/output • math functions • command call-out (“system”, pipes) • network service connectivity (e.g. databases, LDAP, IMAP) • CGI parsing, web server integration
Scripting Languages They are good for • Prototyping/Rapid development • Small programs (<100,000 lines) • Web development
Scripting Languages They are not good for • Writing efficient code • Software engineering; moderate (100,000-500,000 lines) to large programs • no argument checking or type checking • encapsulation is a convention, not enforced • Distributing applications where you want to protect the source code
Scripting Languages(PERL) Perl stands for Practical Extraction and Reporting Language. Perl is a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for many system management tasks. The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal).
Scripting Languages(PHP) • Started as a macro language for HTML • Feels like a “toy” language • Clumsy string manipulation, OOP, extensibility • Wonderfully integrated with HTML: seamless intermixing of PHP and HTML <HTML><HEAD><TITLE>Sample PHP Program</TITLE></HEAD><BODY><P>The day of the week is:<?php $current_date = getdate(time()); print $current_date[“weekday”]?></P></BODY></HTML>
Visual Programming(Event Driven) All the paradigms we’ve examined so far – imperative, object-oriented, functional, and logic programming – are based on a fundamental model of computation in which the program design predetermines what will occur when the program is run. The event-driven programming paradigm turns this world inside out. Event-driven programs do not predict the control sequence that will occur; they are written to run reasonably to any particular sequence of events that may occur once execution begins.
Visual Programming(Event Driven) The input data govern the particular sequence of control that is actually carried out by the program. Moreover, execution of an event-driven program does not typically terminate; such a program is designed to run for an arbitrary period of time, often indefinitely. The most widespread example of an event-driven program is the GUI mouse- and, windows-driven user interface found on most desktop and laptop computers in use today. Event-driven programs also drive web-based applications.
Visual Programming(Event Driven) To provide effective support for event-driven programming, some languages have developed some basic terminology and principles of design. Most recently, these principles have appeared in Java, though other languages like Visual Basic and Tcl/Tk also support event-driven programming.
Visual Programming(Visual Basic) • Visual Basic(VB) is a much-enhanced version of the BASIC programming language and the BASIC Integrated Development Environment (IDE). • One of the many significant improvements is that VB provides massive support for easily creating the user interface to Windows applications. This is accomplished within the VB Integrated Development Environment (IDE), in which you use a mouse to "draw" your application and use the keyboard to type in the code that is to be executed. • VB performs event-handling function for you, and in fact, the only time code will execute in VB is in response to such an event!
Visual Programming(Visual Basic) • Objects provides a way to link together both code and data into a "package" in such a way as to make handling and saving the code/data more intuitively. VB forms are objects, menus are objects, and the so are the intrinsic VB controls. • VB has also provided a wide variety of built-in code that programmers once had to handle themselves. Of most significance is the built-in database handling features of VB. It is generally accepted that over half of all VB applications are written to handle databases! • VB has also begun to provide built-in support of Internet access and web-services as in Visual Basic .NET version.
Visual Programming(DELPHI) • Based on Pascal programming language, • Delphi has developed a huge following. • Designed to be compatible with the OCX family of controls that support Visual Basic, Delphi is very similar to Visual Basic. • The single best feature of Delphi is that it creates completely stand-alone EXE files - unlike Visual Basic which requires the distribution of a huge number of supporting files for even the smallest of applications. • Delphi's use of Pascal, instead of a BASIC-derived language is probably one of the primary reasons that Visual Basic programmers don't jump ship.
Visual Programming(Visual C++) • The visual part of Visual C++ is virtually identical with Visual Basic in terms of the ease of creating Windows programs. • It's the underlying difficulty of the C coding process that keeps users away. • Many programmers get their start by reading/learning on their own. Unfortunately, C (or C++) simply is not an easy language to learn. Beginning programmers usually need a classroom environment with a skilled instructor to enable them to understand the intricacies of the C(or C++) programming language.
Visual Programming(Visual C++) • At the overview level, C (or C++)is just another programming language and is not that difficult to understand in concept. • It's in the details of coding that new users find themselves bogged down with questions that give the most difficulty. • Visual Basic, on the other hand, is a more intuitive, English-like language which users have found they can work through on their own (or with minimal help from other programmers).
Macros and Application Customization (by R.O Buchal) • Many useful applications can be created by building on existing software • Word and Excel can be extensively programmed using Visual Basic for Applications • For example, you could create a program to accept data using an input form, analyze the results, and plot a graph, all in Excel
Computer Aided Software Engineering (CASE) (by R.O Buchal) • CASE is a set of productivity tools for programmers and software developers • The tools are analogous to wordprocessors and spreadsheets for business people • CASE is still immature, but will become increasingly important in the future
Computer Aided Software Engineering (CASE) (by R.O Buchal) The CASE toolkit includes: • Design tools • flow diagrams, structure charts, etc. • Prototype tools • user interface, screen generators, report generators • Information repository tools • database for the software development project
Computer Aided Software Engineering (CASE) (by R.O Buchal) • Program development tools • organize, generate and test code • Methodology tools • support standard development methodology