Ch1 language design issue
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Ch1 language design issue

  • 434 views
Uploaded on

Programming language paradigm

Programming language paradigm

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
434
On Slideshare
434
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
11
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Programming Language Paradigms Chapter 1 Language Design Issues
  • 2. Why Study Programming Language? 1. To improve ability to develop effective algorithms: – Many languages provide features that when used properly are of benefit to programmer but when use improperly may west large amount of computer time, consuming logical errors. – Even programmer who has used a language for years may not understand features. – A typical example is recursion. – New programming methods are constantly being introduced in the literature. – Use of best concept like object oriented programming, logical programming or concepts.
  • 3. Why Study Programming Language? (cont.) 2. To improve your use of your existing programming language: – By understanding how features in your language are implemented, greatly increase your ability to write efficient program. – For example understanding how data in array, string or records are created and manipulated, by understanding class, objects or recursion you can build more efficient program.
  • 4. Why Study Programming Language? (cont.) 3. To allow better choice of programming language: – Knowledge of variety of languages may allow the choice of just language for particular project, there by reducing required coding efforts. 4. To make it easier to learn a new language: – Varity of programming language constructs and implementation techniques allows the programmer to learn a new programming language more easily.
  • 5. Why Study Programming Language? (cont.) 5. To make easier to design a new language: – For programmer who think of themselves as designers can need to have deep understanding of basic languages. – For example many new languages are based on c or pascal as implementation models. This aspect of program design is often simplified if the programmer is familiar with a variety of constructs and implementation methods from ordinary programming language.
  • 6. What is Programming Language? • A language designed for programming computers. • A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely.
  • 7. What is Programming Language? • Programming languages are essentially carefully designed notations. • Programming language use to specify, organize different aspect of problem solving. • The designer of programming languages have twin goal: – Making computing convenient for people – Making efficient use of computing machine.
  • 8. Evolution of software Architecture • Evolution of software is a step by step process
  • 9. Evolution of software Architecture (cont.) • The computing industry has now entered in third major era in the development of computer program. • For certain class of problem certain software or languages are defined which is tested, modified and used with minimum investment. • Smalltalk and Perl are cost effective in that the overall time and effort expended in solving a problem on computer.
  • 10. Evolution of software Architecture (cont.) • Maintenance: – Evolution of software also include maintenance, as studies have shown that the largest cost involved in any program that is used over a period of year is not the cost of initial design, coding and testing of program but total life cycle costs include development as well as maintenance. – Maintenance includes repair error, changes in program if required as the underlying hardware or operating system is updated and extension and enhancement of program.
  • 11. Attributes of language • Syntax and Semantics: – The Syntax of a programming language is what the program looks like. – The Semantics of a programming language is the meaning given to the various syntactic constructs. – For example in C to declare vector V, of integers • Int v[10] – In contrast in Pascal specified as • V array[0…9]of integer – Although they create same object at run time, their syntax is different
  • 12. Language Paradigms • There are four basic computational models that describe most programming today – Imperative – Applicative – Rule based – Object Oriented
  • 13. Language Paradigms • Imperative languages: – Imperative or procedural languages are command driven or statement oriented languages. – The basic concept is the machine state the set of all values for all memory locations in the computer. – A program consists of a sequence of statements and the execution of each statements cause the computer to change the value of one or more locations in its memory that is enter a new state.
  • 14. Language Paradigms • The syntax of such languages generally has the form • Statment1; • Statmenet2; • Applicative language: – An alternative view of the computation performed by a programming language is to look at the function that the program represents rather than just the stat changes as the program executes, statement by statement.
  • 15. Language Paradigms - Applicative language • In applicative language rather than looking at sequence of states that the machine must pass through in achieving an answer the question to be asked is what is the function that must be applied to initial machine state by accessing initial data. • We can view this model as a lens that takes the initial data and by manipulating the view of memory, produce the desired answer. • Program development proceeds by developing functions from previously developed functions to build more complex function.
  • 16. Language Paradigms – Rule based language • Rule based languages execute by checking for the presence of certain enabling condition and when present, executing an appropriate action the most common rule based language is prolog also called a logic programming language. • Enabling conditions determine the order of execution • The syntax is – Enabling condition  action1 – Enabling condition  action2
  • 17. Language Paradigms – Object Oriented Programming • Object Oriented Programming: In this case complex data object are build , then a limited set of functions are designed to operate on those data. • Complex object are designed as execution of simple objects, inheriting property of simpler objects.
  • 18. Language standardization • The need for standards - to increase portability of programs • Problem: When to standardize a language? • If too late - many incompatible versions • If too early - no experience with language • Problem: What happens with the software developed before the standardization? • Ideally, new standards have to be compatible with older standards.
  • 19. Internationalization • How to specify languages useful in a global economy? • What character codes to use? • Collating sequences? - How do you alphabetize various languages? • Dates? - What date is 10/12/01? 10-12-01? 12.10.01 ? Is it a date in October or December?
  • 20. Internationalization • Time? - How do you handle • time zones, • summer time in Europe, • daylight savings time in US, • Southern hemisphere is 6 months out of phase with northern hemisphere, • the date to change from summer to standard time is not consistent. • Currency? - How to handle dollars, pounds, marks, francs, euros, etc.
  • 21. Timeliness • One important issue is when to standardize a language. FORTRAN was initially standardized in 1966 after there were many incompatible version. • This lead a problem because each implementation is different from others. • At the other extreme Ada was standardized in 1983 before there were any implementations • When it was not clear weather the language would even work. • The first effective Ada compiler did not appear until 1987 • C and Pascal were standardized while growing and before there were too many incompatible version.
  • 22. Programming environments Programming environment is where programs are created, tested. Usually consists of support tools and command language for invoking them Typical tools include: •editors •debuggers •verifiers •pretty printers •test data generators
  • 23. Effects on language design Programming environments have had two large effects on language design: • Features aiding separate compilation/assembly from components • Features aiding program testing and debuggin
  • 24. Effects on Language Design Separate compilation: •For large programs, different programmers will be working on separate parts. •This requires a language that can compile the parts and merge together later •Separate compilation can be difficult because subprograms might need each other •There are ways to provide information to subprograms during separate compilation: •Information may need to be redeclared (FORTRAN) •An order of compilation may be required (Ada) •A library containing relevant specifications may be required (Java/C++)
  • 25. Effects on Language Design •Option 1 above uses independent compilation. The subprogram is entirely self contained. •The disadvantage is inability to check inconsistency of data between external declaration and internal re declaration. You will have assembly errors even though the subprograms may have 0 errors. •Options 2 and 3 require the use of libraries. The body is usually omitted during the compilation of subprograms. •Separate compilation has the side effect of enabling name collisions issues •Several subprograms or portions of programs may have the same name •This may not be determined until attempting to merge all subprograms •There are three main ways languages avoid these name collisions •Use of naming conventions (obligation is the programmer's) •Use of scoping rules (Used by Pascal, C, Ada) •Add name definitions from external library(inheritance in Object oriented)
  • 26. Environment Frameworks •Support environment: Uses infrastructure services called environment framework Environment framework: supplies data repository, GUI, security, communication •Ex: An environment framework would contain the following A window manager such as Motif VB and Visual Studio provide for libraries to build windows