Unit 5 - Programming Languages PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Neagu Iulia Veronica

Unit 5 Programming languages

Unit 5 Programming Languages


A programming language is a notation for writing programs, which are specifications of a computation or algorithm. Many programming languages have some form of written specification of their syntax (form) and semantics (meaning). Traits often considered important for what constitutes a programming language include: Function and target: a computer programming language is a language used to write computer programs, which involve a computer performing some kind of computation or algorithm and possibly control external devices such as printers, disk drives, robots, and so on Abstractions: programming languages usually contain abstractions for defining and manipulating data structures or controlling the flow of execution Expressive power: the theory of computation classifies languages by the computations they are capable of expressing Thousands of different programming languages have been created mainly in the computing field. Programming languages differ from most other forms of human expression in that they require a greater degree of precision and completeness. A programming language provides a structured mechanism for defining pieces of data, and the operations or transformations that may be carried out automatically on that data. Programs for a computer might be executed in a batch process without human interaction, or a user might type commands in an interactive session of an interpreter. In this case the commands are simply programs, whose execution is chained together. It is difficult to determine which programming languages are most widely used, and what usage means varies by context. One language may occupy the greater number of programmer hours, a different one may have more lines of code, and a third utilize the most CPU time. Some languages are very popular for particular kinds of applications. For example, COBOL is still strong in the corporate data center, often on large mainframes; FORTRAN in engineering applications; C in embedded applications and operating systems. PHP is a widely used, general-purpose scripting language that was originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. SQL is a database computer language designed for managing data in RDBMS, and originally based upon relational algebra. Its scope includes data query and update, schema creation and modification and data access control. Java is a general-purpose, concurrent, class-based, and object-oriented, and is specifically designed to have as few implementation dependencies as possible. Its language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Programming languages have been classified into several programming language generations. The distinguishing properties of the first generation programming languages are that:

10

15

20

25

30

35

40

Neagu Iulia Veronica

Unit 5 Programming languages

45

50

55

60

65

70

The code can be read and written by a programmer. To run on a computer it must be converted into a machine readable form, a process called assembly The language is specific to a particular target machine or family of machines Some assembler languages provide a macro-facility enabling the development of complex patterns of machine instructions Second generation programming languages, originally just called high level programming languages were created to simplify the burden of programming by making its expression more like the normal mode of expression for thoughts used by the programmers. They were introduced in the late 1950s, with FORTRAN reflecting the needs of scientific programmers, ALGOL reflecting an attempt to produce an European / American standard view, and COBOL providing a natural language for developers of commercial software. The third generation languages emphasized: Expression of an algorithm in a way that was independent of the characteristics of the machine on which the algorithm would run The rise of strong typing (used to describe those situations where programming languages specify one or more restrictions on how operations involving values having different data types can be intermixed) Block structures (blocks which can be nested to any depth) and automated management of storage with a stack Broad-spectrum applicability and greatly extended functionality Generational classification of these languages was abandoned after the third generation languages, with the natural successors to the third generation languages being termed object-oriented. C gave rise to C++ and later to C#, LISP to CLOS, ADA to ADA 95 and even COBOL to COBOL 2002, and new languages like Java have emerged in that generation as well. But significantly different languages and systems were already being called fourth and fifth generation programming languages by language communities with special interests. The manner in which these generations have been put forward tends to differ in character from those of earlier generations, and they represent software points-of-view leading away from the mainstream.

75

Neagu Iulia Veronica

Unit 5 Programming languages

I.

a) Give synonyms for the following words from the text:


Specifications (l. 2); traits (l. 3); chained (l.21); embedded (l. 27); query (l. 33); converted (l. 43); spectrum (l. 64); emerged (l. 68); mainstream (l. 74)

b) What do the following abbreviations stand for?


COBOL; FORTRAN; PHP; SQL; RDBMS; LISP; CLOS; PASCAL; BASIC; DYNAMO;

II. Explain the following mathematical concepts in English:


1. Hexadecimal figure 2. Binary mathematics 3. Floating point arithmetic 4. Double precision arithmetic 5. Boolean truth values

III. Match the following programming languages with their definition:


a) Answer the following questions: 1. What is software as compared to hardware? 2. What kind of software do all computer users need in order to use their machines? 3. What purposes do programming languages serve? 4. What is a low-level language? 5. What is the purpose of a compiler? b) Complete the following sentences (you may use more than one word per blank space): 1. New are released every time there is an improvement on the hardware side. 2. . Are languages which are close to human language. 3. such as Excel 4.0 or Multiplan are some of the most widely-used in the computer field. 4. The translation of a program into machine code is carried out either via a or an . 5. Before running a program, the user has to ensure that it is -free.

IV. Match the following programming languages with their definition:


1. ActionScript; 2. C#; 3. C++; 4. Delphi; 5. Erlang; 6. FoxPro2; 7. Java; 8. LabVIEW; 9. Lisp; 10. MATLAB; 11. PHP; 12. PEARL; 13. Unix shell; 14. Visual Basic; 15. XML a. a text-based procedurally-oriented programming language and DBMS, originally published by Fox software b. a general-purpose scripting language; it is embedded into the HTML source document and interpreted by a web server, which generates the web page document

Neagu Iulia Veronica

Unit 5 Programming languages

c. a multi-paradigm programming language encompassing imperative, functional, generic, object-oriented and component-oriented programming disciplines d. produced by Borland, it was formerly known as the Object Pascal Language; its most popular use is the development of desktop and enterprise database applications, but as a general purpose development tool it is capable of and used for most types of development projects e. a programming language that derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities; it is widely used from application software to web applications f. a computer programming language designed for multitasking and real-time programming; it supports both fixed-point and floating-point numeric values, character and character string data as well as bit values; it also provides facilities for structures and multi-dimensional arrays g. it is derived from BASIC and enables the rapid application development of graphical user interface applications, access to databases using Data Access Objects, Remote Data Objects or ActiveX controls and objects h. a set of rules for encoding documents in machine-readable form; its design goals emphasize simplicity, generality and usability over the Internet i. a scripting language developed by Adobe, used primarily for the development of websites and software targeting the Adobe Flash Player platform j. short for Laboratory Virtual Instrumentation Engineering Workbench; it is also referred to as G and used for data acquisition, instrument control and industrial automation k. a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems l. designed by Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications m. one of the earliest programming languages; it pioneered many ideas in computer science, including tree data structures, automatic storage management, dynamic typing and the self-hosting compiler; linked lists are one of this programming languages major data structures and its source code is itself made up of lists n. a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language; this language began as enhancements to C, first adding classes, then virtual functions, operator overloading, multiple inheritance, templates, and exception handling among other features o. it allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces and interfacing with programs written in other languages, including C, C++ and Fortran.

V. Fill in the blanks of the following text about Linux:


In 1992, a talented programmer named Linus Torvalds took a small educational version of UNIX called Minix rewriting and extending it. By mid 1993, Linux had completely dropped its Minix roots and became quite a 1) .. of UNIX. 2) it was adopted with great enthusiasm by other programmers on the Internet, it began 3) like wildfire. It soon became the fastest growing version of Unix, mainly because it was 4) .

Neagu Iulia Veronica

Unit 5 Programming languages

Linux ran primarily on x86 based PCs, and it actually ran pretty well even on a slow 386 with 4 Mb of RAM and a 40 Mb hard disk. Linus and his followers proudly described Linux as a 5) .. (a programmers system) because it relied heavily on freely 6) which had been written by other 7) . Its 8) was the X Window System, which was freely available from MIT. For its GUI it used a collection of freely available window managers and other GUI components, as well as the Athena and OpenLook styles, which were also freely available. Because of its 9) , some 10) even began to sell versions of Motif for Linux. Most of the other programs which people actually used (the shells, the compilers, the utility commands, etc.) came from the GNU Project a free software 11) started by Richard Stallman in the 1980s. Stallman was a talented programmer, but he was also a little 12) . He passionately believed that all software should be free and should come with 13) so that other programmers could extend it, and that computing professionals should only make money through 14) . The ultimate goal of the GNU Project was to create a completely free UNIX-like operating system called GNU.

VI. Translate the following two excerpts into English:


a) Java este un limbaj de programare de nivel nalt, dezvoltat de JavaSoft, companie n cadrul firmei Sun Microsystems. Dintre caracteristicile principale ale limbajului amintim: simplitate - Java este uor de nvat, caracteristicile complicate (suprancrcarea operatorilor, motenirea multipl, abloane) ntlnite n alte limbaje de programare sunt eliminate. robustee, elimina sursele frecvente de erori ce apar n programare prin eliminarea pointerilor, administrarea automat a memoriei i eliminarea fisurilor de memorie printr-o procedur de colectare a 'gunoiului' care ruleaz n fundal. Un program Java care a trecut de compilare are proprietatea ca la execuie s nu "cad sistemul". complet orientat pe obiecte - elimin complet stilul de programare procedural; se bazeaz pe ncapsulare, motenire, polimorfism uurin n ceea ce privete programarea n reea securitate, este cel mai sigur limbaj de programare disponibil n acest moment, asigurnd mecanisme stricte de securitate a programelor concretizate prin: verificarea dinamic a codului pentru detectarea secvenelor periculoase, impunerea unor reguli stricte pentru rularea programelor lansate pe calculatoare aflate la distan etc este neutru din punct de vedere arhitectural portabilitate, cu alte cuvinte Java este un limbaj independent de platforma de lucru, aceeai aplicaie rulnd, fr nicio modificare, pe sisteme diferite cum ar fi Windows, UNIX sau Macintosh, lucru care aduce economii substaniale firmelor care dezvolt aplicaii pentru Internet. Sloganul de baz este: "Write once, run anywhere" n funcie de modul de execuie al programelor, limbajele de programare se mpart n dou categorii:

Neagu Iulia Veronica

Unit 5 Programming languages

interpretate: instruciunile sunt citite linie cu linie de un program numit interpretor i traduse n instruciuni main; avantaj: simplitate; dezavantaj: vitez de execuie redus; compilate: codul surs al programelor este transformat de compilator ntr-un cod ce poate fi executat direct de procesor; avantaj: execuie rapid; dezavantaj: lipsa portabilitii, codul compilat ntr-un format de nivel sczut nu poate fi rulat dect pe platforma pe care a fost compilat. Programele Java sunt att interpretate ct i compilate. Codul de octei este diferit de codul main. Codul main este reprezentat de o succesiune de 0 si 1; codurile de octei sunt seturi de instruciuni care seamn cu codul scris n limbaj de asamblare. Codul main este executat direct de ctre procesor i poate fi folosit numai pe platforma pe care a fost creat; codul de octei este interpretat de mediul Java i de aceea poate fi rulat pe orice platform care folosete mediul de execuie Java. b) Nivelulunui limbaj este apreciat prin poziia pe care o ocup pe scara constituit de limbajul recunoscut de microprocesor (limbaj main) i limbajul natural al programatorului (limba romn, limba englez etc.). Un limbaj de nivel sczut este foarte apropiat de main, el manipuleaz cu elemente de nivel hardware, fizic, cum ar fi: registru, microprocesor, locaie de memorie, port de intrare/ieire etc. Un limbaj de nivel nalt sau foarte nalt manipuleaz cu concepte apropiate de limbajul natural, concepte de nivel logic, cum ar fi: colecie de date, nume de operaie (sort, writeln, open), variabile, constante (asemntoare ca neles cu cele din matematic). Cu ajutorul unui limbaj de nivel nalt programatorul se face mult mai uor neles de ctre calculator . Uneori o singur linie de program scris cu un astfel de limbaj poate echivala cu sute de linii de program scrise n limbaj main. Deci din punct de vedere al reducerii timpului de realizare al unui program i al siguranei n funcionare (absena erorilor de programare) este de preferat un limbaj de nivel ct mai ridicat (nalt sau foarte nalt). n schimb, pe msur ce limbajul are un nivel mai ridicat execuia programului conceput cu ajutorul su va fi mai lent, dect a unui program ce realizeaz aceleai operaii dar este scris n limbaj de asamblare. O alt diferen esenial ntre cele dou tipuri de limbaje o reprezint portabilitatea, adic posibilitatea transferrii programelor pe un alt tip de main dect cea pe care au fost construite. Din acest punct de vedere limbajul de asamblare este neportabil deoarece el este specific microprocesorului. Programele realizate pe un tip de main trebuie rescrise integral pentru noul tip de main, folosind un nou set de instruciuni care, de obicei, difer foarte mult. Lucrurile stau altfel cu programele concepute cu ajutorul unui limbaj de nivel nalt, deoarece acestea sunt detaate de main. ntre un astfel de program i calculator se interpune compilatorul (sau interpretorul) care rezolv corect transformarea fiierului-surs n fiier-executabil. Limbaje procedurale neprocedurale Cele dou tipuri de limbaje, procedurale i neprocedurale, se difereniaz prin nivelul de organizare (structurare) a unui program . Limbajele neprocedurale sunt concepute pentru a gndi un program la nivel de instruciune, pe cnd cele procedurale, oblig programatorul s conceap programe la nivel de bloc. ntr-un limbaj procedural 6

Neagu Iulia Veronica

Unit 5 Programming languages

(numit i limbaj structurat), programele sunt scrise instruciune cu instruciune, dar ele sunt organizate logic n blocuri (grupuri de instruciuni) ce realizeaz o aciune bine determinat. n general un bloc are un punct de intrare i un punct de ieire nu mai multe. Un limbaj procedural ofer posibilitatea utilizrii unui nivel ridicat de concepere a unui program i duce la realizarea de programe coerente i protejate la erori. Prin contrast, limbajele neprocedurale nu favorizeaz programatorul n a se desprinde de nivelul instruciune i duc deseori la programe greu de controlat mai ales n cazul programelor de dimensiuni mari. Limbajele neprocedurale sunt nc preferate de unii utilizatori datorit timpului foarte scurt ct decurge nvarea i utilizarea lor. Limbaje orientate Din punctul de vedere al aplicabilitii unui limbaj, limbajele pot fi orientate pe o anumit problem sau concepute pentru soluionarea oricrui tip de problem limbaje de uz general sau altfel spus, neorientate pe o problem. Limbajele orientate prezint un grad nalt de specificitate pe cnd un limbaj neorientat reprezint un cadru general ce permite introducerea de ctre utilizator a conceptelor i prelucrrilor dorite. Deci, diferena esenial dintre cele dou tipuri de limbaje o constituie nivelul conceptual definit. Cele specializate posed deja integral suportul necesar i permit programatorului s se concentreze la ansamblul problemei, pe cnd cele nespecializate las n sarcina programatorului manevrarea nivelelor inferioare ale problemei. Limbaje concurente Un limbaj concurent permite definirea de procese (prelucrri) paralele, execuia sa fiind ramificat la un anumit moment de timp. Prin contrast, limbajele neconcurente (majoritatea limbajelor) au o desfurare liniar, fiind activ un singur proces la un moment dat. Procesele concurente presupun n mod obligatoriu un sistem multi-tasking ce poate gestiona mai multe sarcini la un moment dat. Limbaje de nivel sczut Aceast categorie de limbaje are un reprezentant autoritar i anume: limbajul de asamblare. Diferenierile care se pot face pentru limbajele de nivel sczut sunt urmtoarele: a) dup tipul de main ; Regulile respectate de versiunile limbajului de asamblare sunt: - o nou versiune o include complet pe cea anterioar , - versiunea nou ofer funcii suplimentare i le realizeaz pe cele vechi mai rapid . b) dup mediul de programare oferit. Aspectul unui limbaj poate fi schimbat radical de mediul de programare oferit. Pentru limbajul de asamblare exist mai multe implementri disponibile, ncepnd cu pachete ce opereaz n mod linie i culminnd cu medii integrate n care toate operaiile se pot declana de la un acelai pupitru de comand. Nu sunt luate n considerare dect aceste medii integrate( denumite generic medii Turbo), dintre care se detaeaz Turbo Asamblorul firmei Borland TASM.

Neagu Iulia Veronica

Unit 5 Programming languages

GRAMMAR SPOTLIGHT Adverbs

Adverbs are those parts of speech that modify or add to the meaning of verbs, adjectives, other adverbs, prepositional phrases, complete sentences or even nouns modifying: A verb: Kerry sang that song beautifully. An adjective: The problem was extremely difficult. An adverb: Mary understood us very well. A prepositional phrase: Her watch was completely out of order. A complete sentence: Strangely enough, she left without saying a word. A noun: The girl over there is my sister. Forms of adverbs Individual words: here, soon, then, when Compound words: 1. made up of two different parts of speech: abroad, anywhere 2. made up of an adjective/noun + the suffix ly: badly, hourly a. adjectives ending in e, retain e and then ly is added: extreme extremely; nice nicely b. adjectives ending in le drop e and add y in the adverb: capable capably; gentle gently c. adjectives ending in l preceded by a vowel, retain l and add ly: final finally; usual usually d. adjectives ending in ll just add y: full fully; dull dully e. adjectives ending in y change y to I and then add ly: easyeasily; happy happily Sometimes, the ly adverbs have a different meaning from their corresponding adjectives. CLOSE quite, near; CLOSELY descriptive use e.g.: He came close to getting 100%. This girl resembles her mother closely. DEEP far down or into (it may be used either literally or figuratively); DEEPLY very greatly (used metaphorically of degree) e.g.: He went deep into the woods. She felt his betrayal deeply. FREE without payment; FREELY in a free manner or Willingly, readily e.g.: It cost me nothing. It was free. I feel that I can speak freely. (without hiding anything; openly) HARD with great effort/great force, with great attention; HARDLY almost no/not/none/never etc., probably not

Neagu Iulia Veronica

Unit 5 Programming languages

e.g.: You have worked very hard. We can hardly walk. HIGH at a great distance from groundlevel, sea-level etc.; HIGHLY very much, with approval e.g.: The plane was flying high in the sky. He speaks very highly of you. JUST exactly/precisely, very recently; JUSTLY in a fair or reasonable manner e.g.: Our friends have just arrived. She was quite justly blamed for the accident. LATE after the expected or usual time, far into the day or night; LATELY recently e.g.: He arrived late for the interview. Have you met them lately? RIGHT exactly, immediately, completely, correctly; RIGHTLY accurately e.g.: I waited for her right here. They rightly assumed that he was guilty. SHARP punctually, abruptly, quickly; SHARPLY in a sharp manner, distinctly e.g.: We left the club at 11 oclock sharp. Opinions are sharply divided on this matter. Types of adverbs Adverbs of manner Adverbs of place Adverbs of time Adverbs of degree Irregular comparison of adverbs well badly far far The position of adverbs When a sentence contains more than one kind of adverb, the usual order should be: Manner place time better worse further farther best worst furthest farthest

Neagu Iulia Veronica

Unit 5 Programming languages

EXERCISES I. Replace each adjective with an adverb: e.g.: boastful boastfully 1. The ballerina moved around very . (graceful) 2. David (easy) won the first race. 3. I dont know (exact) how much money he makes. 4. I (honest) dont know what John told his sister. 5. The singer of the band sang very (bad) during the concert. 6. My friend Tom always speaks very . (loud) 7. You speak English very . (good) 8. These days I am so busy at work that I (rare) have time to go out. 9. Sometimes I like to spend the day just lying in bed . (lazy) 10. The police officer made sure that she got home . (safe) II. Each sentence has an underlined word. Your task is to decide whether the word is an adverb or an adjective: 1. Be careful! The iron is very hot. 2. A microwave can cook food fast. 3. June sang very loudly. 4. This bacon is lovely. 5. Joe dresses very informally. 6. Shes a very strange woman. 7. Im free tomorrow. Shall we meet at 5? 8. Jane is very helpful if you have a problem with your computer. 9. Sam walks very shakily, because hes getting old. 10. I get up early every morning. 11. It is a fast car. 12. He is a better swimmer than me. 13. He reached deep into his pockets. 14. He swims better than me. 15. He works hard. 16. We found the people friendly. 17. He drove some of them mad. 18. This made everyone late. 19. We shall leave the room empty. 20. He turned the corner well. III. For each sentence, choose the best word or phrase to complete the gap from the choices below: 1. Thanks for the weekend. We had a wonderful time. 2. The weather at the beach on Saturday was gorgeous. 3. Try that restaurant. The food is marvelous.

10

Neagu Iulia Veronica

Unit 5 Programming languages

4. I was .. annoyed when he said that. 5. He told me a/an unbelievable story. 6. You probably feel quite cold today but actually, fifteen degrees is .. hot for England in October. 7. What they told the police was untrue. 8. Both sisters were brilliant students. 9. Thats a wonderful ring. It must have been expensive. 10. I need to sit by the fire. Im freezing! 11. That cheap umbrella I bought was useless. It broke the first time I used it. 12. Youre talking rubbish! Of course I dont believe you! 1. a) so 2. a) such 3. a) such 4. a) much 5. a) completely 6. a) simply 7. a) extremely 8. a) relatively 9. a) really 10. a) rather 11) a) very 12) a) rather b) such b) extremely b) very b) absolutely b) extremely b) pretty b) very b) totally b) absolutely b) wholly b) fully b) extreme c) very c) absolutely c) terribly c) totally c) nearly c) completely c) totally c) almost c) simply c) absolutely c) utterly c) quite d) absolutely d) awfully d) simply d) extremely d) very d) absolutely d)rather d) wholly d) totally d) very d) extremely d) absolute

11

You might also like