Pros. - Maggotty High CAPE IT
Syllabus Focus: Unit 1 Module 3 Content 11Specific Objective 11: explain the concept of programming;Content: Development of computer programs; stages in programme development; programming paradigms; examples of programming languages.Programming languages come in many forms or 'paradigms'. Each form of language offers advantages over other types and each one of course has some limitations as well. Furthermore there are many languages available within each form. Sometimes the choice of a particular language is personal preference and familiarity or sometimes it is imposed by the company you are working for.You need to know the main classes of programming and why you would use one type over another.The main classes of programming languages arelow level languages, object-orientated languages declarative languages procedural functional languages.Low level language conceptsA low level language is one whose programming statements are geared towards a particular CPU family, such as the x86 family of processors. Low level languages are almost (but not quite) machine code.'Assembly language' is an example of a low level programming language.Chip makers such as Intel and ARM provide programmers with an Assembly Language with which to code their particular CPU.Some features of Low Level languages includeThey are CPU specific, making direct use of internal registers 'Mnemonics' are used as programming code such as MOV or ADD Labels are used as reference points to allow the code to jump from one part to another. Pros.Low level languages are excellent for close control of the CPU, for example many device drivers are coded in assembly language. They can be very efficient. Well-optimised code written in a low level language can be made to run very quickly compared to other programming paradigms. ConsThey are difficult to use as the programming commands can be quite obscure A good assembly language programmer needs to know a lot of detail about the internal structure of the CPU - e.g.its registers and memory management methods Low level languages produce the least portable source code. Assembly language looks like this:.MODEL SMALL;.STACK; .CODE;mov ah,1h; moves the value 1h to register ahmov cx,07h;moves the value 07h to register cxint 10h;Procedural conceptsWith procedural languages, you code specific instructions for the computer to carry out - it is all about the 'do-this, then-this, then-this' style of programming. This is one of the commonest programming paradigms in use.The main points to know about procedural programming languages are:Imperative LanguagesThey are sometimes called imperative languages. Imperative means 'to give orders, or instructions' and so procedural languages are all about telling the computer what to do, step by step. Sequential instructionsAll imperative languages lay out their instructions in sequence.3rd generation languagesProcedural languages are examples of 3rd generation languages. It is now many decades since the first computer language was created. Third generation languages make it easier for people to read and understand the code. This is done by using ideas such as naming variables and using functions or subroutines to partition the code into manageable chunks.Examples of Procedural languages areC, Pascal, FORTRAN, COBOLA typical clip of source code written in a procedural language:-y = 1224;for (x = 0; x < 100; x++) { z = y + x;}In this clip, a variable y is being set, then the code enters a loop. So the procedural language is precisely defining what the computer should be doing step by step.As a comparison, SQL database language is a 'non-procedural' language. A simple SQL query is shown below.CREATE TABLE PartsSELECT * From CustomerHere, the first instruction tells the database management software to create a table called Parts, then it makes a request for all records from the Customer table. The SQL programmer does not need to know the precise detail of how a table is made or the details behind pulling down all records from a table.?ProsExcellent for general purpose programming Many books and references available on well-tried and tested coding algorithms - no need to re-invent the wheel. Good level of control without having to know precise target CPU details - unlike low level languages Portable source code - use a different compiler to target a different CPU ConsAs there are so many procedural languages, a programmer tends to have to specialise in a particular language in order to get work. A COBOL specialist has a different clientele to a 'C' specialist. Need to be very precise and knowledgeable about programming instructions, and so a fully de-bugged working program takes more time to put together compared to fourth generation languages such as Simulink. Not as efficient as hand-crafted source code written in a low level language Poor at handling fuzzy conditions as found in Artificial Intelligence applications - unlike declarative languages such as PROLOG. Object oriented conceptAn object-oriented programming (OOP) language makes use of the idea of classes and objects.A program written in an object oriented language will be made up of a number of classes and objects. These classes and objects are manipulated through their internal methods.Before OOP languages came along, procedural languages, such as 'C', treated data and the programming instructions that act upon the data as separate things. This separation made it very easy to write faulty code such that one part of the software would over-write data at the wrong time.A small non-OOP clip:global variable X;function A() { X = 20; }function B() { X = 1000; }In the clip above, one part of the main software may call function A to set the global variable X, but then another part of the software could call function B at the wrong time and X gets unintentionally changed. De-bugging this kind of problem can be difficult as the conditions that made it happen can be very obscure.So the main idea of object oriented languages is to gather the data and all the methods (functions) that act upon that data into one entity called a 'class', so making data hiding, code re-use and maintenance much easier.ProOOP makes it easier to provide working code. A class can be fully tested and released for other coders in the team to use Classes can be treated as 'black boxes'. Other coders do not need to know how the class works internally. They just need to know how to manipulate it through its methods. There are many 'design patterns' available, developed over the years, that solve common programming tasks. A coder can pick up a design pattern for perhaps an user interface and begin coding straight away. Code re-use. Easy to move a class from one application and re-use it on another project Code portability. Just get the right compiler for the target CPU and the source code can be run on an entirely different hardware platform ConSteep learning curve, becoming proficient in an object-oriented language can take a long time as it is more complicated than a standard procedural language. Complex - it needs skill to craft efficient and flexible classes. Not as compact and efficient as writing code directly in a low level language Example of OOP languagesJAVA created by Sun Microsystems around 1995 and is now widely used on a number of hardware platforms from web servers, back-end business applications and even mobile phones. Code is run on a 'Java virtual machine'. C++ around since 1983, it has become one of the most popular OOP languages available. It has some low level language features as well as OOP high level features. It is widely used for games development, embedded software, device drivers as well as standard coding work. Declarative languageA declarative language is non-procedural and very high-level (4th generation). This means the programmer specifies what needs to be done rather than how to do it (a bit like Captain Pickard's 'Make it So' command to his crew in Star Trek). The software will seek an answer to the question (goal) by interrogating a database containing Facts and Rules. It does not matter what order the facts and rules are arranged within the database - unlike procedural languages - the computer will find the best path towards the answer. There will either be a matching answer - for example the question / goal might be 'who is David's wife?" or a 'False' is returned where there was no answer to be found.This type of language is geared more towards applications such as artificial intelligence and expert systems where inexact data has to be handled or general decisions have to be made.PROLOG is a declarative language that was developed for artificial intelligence. There are others such as 'D' also under development.ExampleConsider a Prolog database containing the following facts and rules:Fact: spouse (john, jane) Fact: spouse (david, mary) Fact: spouse(george, susan) Fact: female (jane) Fact: female (mary) Fact: female (susan) Fact: male (john) Fact: male (david) Fact: male (george) Rule: husband(A,B) IF spouse(A,B) AND male (A) Rule: wife (A,B) IF spouse(A,B) AND female(B) A query could then be written: wife(david,mary)? The formal name for this statement is 'goal' . And the work of finding the answer is called 'satisfying the goal'.Effectively this is asking if Mary is the wife of David. In order to provide an answer the following takes place:Prolog will first of all scan the Rules looking for a match. Rule 11 fits, where A and B can be any two names. wife (A,B)Then it applies the rule by looking to see if it can find a match to the spouse(A,B) condition and yes - Fact 2 fits. spouse(david,mary)Next it looks to see if the second condition female(B) has a match and yes Fact 5 is a match. Fact: female (mary)Both conditions have been met, so yes Mary is David's wife. Functional LanguagesThese types of languages are mostly concerned with providing answer to problems purely through applying calculations to input data. They do not change anything else other than the input data provided at that point in time. The technical term is that functional languages have no 'side effects' unlike procedural languages.These calculations are called 'functions'. Hence the description 'functional language'.These types of languages are used extensively in highly mathematical areas such as engineering and financial markets and even network engineering.Example 1: MathematicaMathematica is a powerful functional language to solve mathematical problems.The following Mathematica statement calculates the root of the equation ex = x2 + 3, starting at the point x = -2.In[2] := FindRoot(Exp[x] == x^2 + 3, (x, -2))Mathematica has a clear syntax with which to write mathematical statements. In this case it is making use of a built-in function called 'FindRoot' and passing the relevant arguments into it.Example 2: LISPShort for 'List Processing'. The first computers were used as pure calculation machines and so LISP was developed as an efficient way of coding calculations.LISP is one of the oldest computer languages (1958) and it is still in use today. It specializes in carrying out calculations and operations across data stored as linked lists. This is called 'list processing'.List processing means that the same calculation is carried out over a linked list. The list itself can be altered during program execution?LISP has been used for a long time in artificial intelligence applications for problems such as image processing.SummaryYou have now familiarised yourself with the main programming paradigms and their application to various types of applications.Programming Paradigms TypeCommentLow LevelExcellent for producing hardware drivers and other software requiring a close link to the CPU on which they run such as a linker / loader / translatorProceduralThe most common type of programming language, Excellent for general programming jobs. Languages include 'C', FORTRANObject OrientatedAnother very popular type of computer language. Excellent for producing re-usable code and for use in large software projects where data and the methods acting upon that data are kept together. Languages include C++, JavaDeclarativeDesigned for applications such as Artificial Intelligence and Pattern Recognition applications where deductions need to be made based on a set of rules. Languages include PrologFunctionalExcellent for programming the computer to act with its original purpose: calculating. Used for mathematical and simulation applications. Languages include LISP, Mathematica. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- lopsided little languages a whiny justification of
- answers to chapters 1 2 3 4 5 6 7 8 9 end of chapter
- welcome to the dictionary of programming languages a
- babel final report
- gsa advantage
- table of contents
- approved courses effective with ninth grade class of 2010
- cosc 1300 introduction to computers
- pros maggotty high cape it
- united states navy
Related searches
- eastern cape education department vac
- eastern cape education department vacancies
- eastern cape vacancies 2019
- eastern cape government vacancies
- eastern cape past papers
- mob cape syllabus 2019
- mob syllabus cape unit 1
- cape management of business syllabus
- pros and cons of teaching high school
- eastern cape government vacancies 2019
- outsourcing it pros and cons
- cape coral dmv