2 Criteria Covered in this presentation P1:describe the application and limits of procedural, object oriented and event driven programming paradigmsP2:describe the factors influencing the choice of programming languageP3:explain sequence, selection and iteration as used in computer programmingP4:outline the benefits of having a variety of data types available to the programmer
3 Programming Paradigms A programming paradigm is a fundamental style of computer programmingProceduralEvent drivenObject oriented
4 Procedural ParadigmThe focus of procedural programming is to break down a programming task into a collection of variables, data structures, and subroutinesProcedural languages are the most traditional types of language, and usually the first type that is learnt.They include Fortran, Pascal, Basic and C.Specifies the steps the program must take to reach the desired state.Inclusion of reusable subprograms (procedures, functions) to avoid repetition of coding.Procedural languages are very good for small-scale projects.
5 Limitations of Procedural Paradigm To limit the program flow in 1-dimensional (or linear way). Most of software developers would have been brain-washed to think this way.The most serious limitation is the tendency for large procedural-based programs to turn into "spaghetti-code".Spaghetti code is code that has been modified so many times that the logical flow becomes so complicated. Accordingly, any new programmer coming onto the project needs a two month prep-course in order to even begin to understand the software innards
6 Event Driven ParadigmThe flow of the program is determined by events, such as or user actions (mouse clicks, key presses) or messages from other programsIs widely used in graphical user interfacesIs clearly divided down to two sections:the first is event selection (or event detection)the second is event handling.Limitations Sometimes leading programmers to create error prone, difficult to extend and excessively complex application code
7 Object Oriented Paradigm Object-orientated languages provide an excellent model for programming and designing computer softwareThey include C , Smalltalk and Java.An object-oriented program may be viewed as a collection of interacting objectsObjects are consisting of datafields and methods
8 Limitations of OOPNot all programs can be modeled accurately by the objects model. If you just want to read in some data, do something simple to it and write it back out, you have no need to define classes and objects.Another disadvantage is that one programmer's concept of what constitutes an abstract object might not match the vision of another programmer. The objects often require extensive documentation.
9 Types of programming languages There are so many types of programming languagesIn this presentation, only two are mentioned:Visual Programming languagesScript languagesMark up languages
11 Factors influencing the choice of programming languages Organizational policy : where a default programming language is used as standardSuitability : how functional and user friendly is it in terms of features and tools? Is it easy to learn?Availability of trained staff: user expertise and their level of understanding or training in a particular languageReliability of the language: is it a reliable language? e.g. does it provide adequate exception handling?Expandability : is it capable of expanding with the organization or task requirement?
12 Factors influencing the choice of programming languages 6. Development and maintenance costs :Some languages become obsolete or unsupportedCost is influenced by a variety of factors including:Training of programmersCost/Time of writing the actual programCompiler cost (time and development environment cost)Execution cost (deployment environment cost)Bugs and reliability issuesMaintenance
14 Data TypesData types define the format or context of the data. For example, a data type could be classed as:TextCan include any alphanumeric characters, for example abc123.Text benefits from the flexibility of combining both characters and numbers together, a good example being in an address field.IntegerA whole number such as 1, 2, 3 or 4.Benefits of using an Integer are that less storage space is required, a counter can be used, mathematical operations can be performed and comparisons can be made.Floating pointA ‘ real number ’ that has a decimal point.The benefits of using a floating point are that percentages, areas, measurements and computations can be stored.
15 Data Types Byte Date Boolean used for storing binary data in a computer system.Datewill represent data in a specific date formatIt is beneficial to users as it will prompt them to enter the date in a set format, for example --/--/----, 22/02/1972.Booleana logic value that will return a ‘ true ’ or ‘ false ’ value.Boolean data types are very small, requiring one bit, 0 or 1, representing true or false.
16 Benefits of having different data types Efficiency of storage: efficient memory allocation for variables Imposes less bugs to programs: allows you to catch common coding problems during compilation and during development before delivering the code to productionAllows the runtime to understand how to implement the operators: Operators perform differently for different types(+ adding numbers or connecting strings)Allows code and subroutine parameters to be more expressivePrograms become more secure: because a data's type specification limits what the data can be used forThey also provide conveniences in developing and maintaining the code.