O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×


Carregando em…3

Confira estes a seguir

1 de 57 Anúncio

Mais Conteúdo rRelacionado

Mais recentes (20)



  1. 1. COMPUTING AND PROGRAMMING FUNDAMENTAL Unit 2: Programming Paradigms Unstructured Programming, Structured Programming, Object Oriented Programming, Characteristics of a Good Program. Types of Programming Languages; Machine Language, Assembly Language; Procedural Language, Natural Programming Language, Visual Programming Language, Graphical Programming Language, Scripting Language, Hypertext Markup Language, Extensible Markup Language. Program Translation: Program Translation Hierarchy; Compiler, Interpreter, Linker, Loader; Features of a good Programming Language.
  2. 2. PROGRAMMING  Program – Set of instruction  Programming - is the process of writing an algorithm into a sequence of computer instructions.  Programming  Structured  Unstructured Dr.Thenmozhi K, KJC 2
  3. 3. STRUCTURED  Structured Programming  Structured Programming is a type of programming that generally converts large or complex programs into more manageable and small pieces of code.  These small pieces of codes are usually known as functions or modules or sub-programs of large complex programs.  It is known as modular programming and minimizes the chances of function affecting another. Dr.Thenmozhi K, KJC 3
  4. 4. C program to demonstrate the // structured programming  #include <stdio.h>   // Function for addition  int sum(int a, int b)  {  return a + b;  }   // Function for Subtraction  int sub(int a, int b)  {  return a - b;  }  OUTPUT : Addition = 15 Subtraction = 5  // Driver Code  int main()  {  // Variable initialization  int a = 10, b = 5;   int add, minus;   // Function Call  add = sum(a, b);  minus = sub(a, b);   printf("Addition = %dn", add);  printf("Subtraction = %dn", minus);  return 0;  } Dr.Thenmozhi K, KJC 4
  5. 5. UNSTRUCTURED PROGRAMMING:  Unstructured Programming is a type of programming that generally executes in sequential order i.e., these programs just not jumped from any line of code and each line gets executed sequentially.  It is also known as non-structured programming that is capable of creating turning-complete algorithms. Dr.Thenmozhi K, KJC 5
  6. 6. // C program to demonstrate the // unstructured programming   #include <stdio.h>   // Driver Code  int main()  {  // Variable initialization  int a = 10, b = 5;  int add, minus;   // Operations performed  add = a + b;  minus = a - b;   printf("Addition = %dn", add);  printf("Subtraction = %dn", minus);  return 0;  } Output : Addition = 15 Subtraction = 5 Dr.Thenmozhi K, KJC 6
  7. 7. (OR) Structured vs Unstructured Programming Structured Programming is a programming paradigm which divides the code into modules or function. Unstructured Programming is the paradigm in which the code is considered as one single block. Readability Structured Programming based programs are easy to read. Unstructured Programming based programs are hard to read. Purpose Structured Programming is to make the code more efficient and easier to understand. Unstructured programming is just to program to solve the problem. It does not create a logical structure. Complexity Structured Programming is easier because of modules. Unstructured programming is harder when comparing with the structured programming. Application Structured programming can be used for small and medium scale projects. Unstructured programming is not applicable for medium and complex projects. Modification It is easy to do changes in Structured Programming. It is hard to do modifications in Unstructured Programming. Data Types Structured programming uses many data types. Unstructured programming has a limited number of data types. Code Duplication Structured programming avoids code duplication. Unstructured programming can have code duplication. Testing and Debug Dr.Thenmozhi K, KJC 7
  8. 8. STRUCTURED UNSTRUCTURED It is basically a subset of procedural programs. It is basically a procedural program. In this, programmers are allowed to code a program simply by dividing the program into modules or smaller units. In this, programmers are not allowed code divide programs into small units. Instead, the program should be written as a single continuous block without any breakage. The entire program must be coded in one continuous block. It is more user-friendly and easy to understand as compared to unstructured programming. It is less user-friendly and little hard to understand as compared to structured programming. It is easier to learn and follow. It is difficult to learn and follow Its advantages include reduce complexity, facilitate debugging, increase programmer productivity programs, etc. Its advantages include it speed Structured programs use a greater number of data types as compared to unstructured programs. Unstructured programs use a limited number of data types as compared to structured programs. It does not use GOTO to control the flow of execution. Instead, it uses loops. It uses GOTO to control the flow of execution. It produces readable code. It hardly produces readable code. It does not provide full freedom to programmers to program as they want. It provides full freedom to programmers to program as they want. Dr.Thenmozhi K, KJC 8
  9. 9. STRUCTURED UNSTRUCTURED Easy to modify and to debug Very difficult to modify and to debug Languages : C, C+, C++, C#, Java, PERL, Ruby, PHP, ALGOL, Pascal, PL/I and Ada early versions of BASIC (such as MSX BASIC and GW-BASIC), JOSS, FOCAL, MUMPS, TELCOMP, COBOL, machine-level code, early assembler systems (without procedural metaoperators), assembler debuggers and some scripting languages such as MS-DOS batch file language. Dr.Thenmozhi K, KJC 9
  10. 10. Dr.Thenmozhi K, KJC 10
  11. 11. OOPS CONCEPTS 1. Object - entity  It has attributes, behavious, & properties  Instance of class  It occupies space in the memory.  Ex . Pen , table, person ( Physical & logical) 2. Class – collection of object  is a blueprint or template of an object.  Set of attributes also called state which is represented by variables and properties Behavior is represented by methods  It is a user-defined data type. Inside a class, we define variables, constants, member functions, and other functionality.  it binds data and functions together in a single unit.  It does not consume memory at run time.  Note that classes are not considered as a data structure.  It is a logical entity. It is the best example of data binding.  Note that a class can exist without an object but vice-versa is not possible. 3. Inheritance 4. Polymorphism 5. Abstraction 6. Encapsulation Dr.Thenmozhi K, KJC 11
  12. 12.  Abstraction - hide the background detail & shows the essential detail from user  Ex. Phone call, email  Encapsulation – wrapping of data and coding Ex. Capsule  Inheritance – code reusability – inherit the properties of an existing class (parent class) into a newly created class (child class).  Polymorphism  Poly – many , Morphs - Forms  More than one form  It allows us to create methods with the same name but different method signatures. Ex. Person Dr.Thenmozhi K, KJC 12
  13. 13. WHY OOPS Dr.Thenmozhi K, KJC 13
  14. 14. OOP(Object Oriented Programming) POP(Procedural Oriented Programming) Object oriented. Structure oriented. Program is divided into objects. Program is divided into functions. Bottom-up approach. Top-down approach. Inheritance property is used. Inheritance is not allowed. It uses access specifier. It doesn’t use access specifier. Encapsulation is used to hide the data. No data hiding. Example of OOP are : C++, JAVA, VB.NET, C#.NET. Example of POP are : C Dr.Thenmozhi K, KJC 14
  15. 15. CHARACTERISTICS OF A GOOD COMPUTER PROGRAM  A good programming language must be simple and easy to learn and use. Characteristics:  Portability: application to run on different platforms (operating systems)  Readability: More user-friendly approach. The program should be written in such a way that it makes other programmers or users to follow the logic of the program without much effort.  Efficiency: Every program requires certain processing time and memory to process the instructions and data. As the processing power and memory are the most precious resources of a computer, a program should be laid out in such a manner that it utilizes the least amount of memory and processing time.  Structural: To develop a program, the task must be broken down into a number of subtasks.  Flexibility: A program should be flexible enough to handle most of the changes without having to rewrite the entire program. Most of the programs are developed for a certain period and they require modifications from time to time.  For example, in case of payroll management, as the time progresses, some employees may leave the company while some others may join. Hence, the payroll application should be flexible enough to incorporate all the changes without having to reconstruct the entire application. Dr.Thenmozhi K, KJC 15
  16. 16.  Generality: Apart from flexibility, the program should also be general. Generality means that if a program is developed for a particular task, then it should also be used for all similar tasks of the same domain. For example, if a program is developed for a particular organization, then it should suit all the other similar organizations.  Documentation: Documentation is one of the most important components of an application development. Even if a program is developed following the best programming practices, it will be rendered useless if the end user is not able to fully utilize the functionality of the application. A well-documented application is also useful for other programmers because even in the absence of the author, they can understand it.  Compactness :- In a good programming language, programmers should be able to express intended operations concisely. A verbose language is generally not liked by programmers, because they need to write too much.  Locality :- A good programming language should be such that while writing a programmer concentrate almost solely on the part of the program around the statement currently being worked with. Dr.Thenmozhi K, KJC 16
  17. 17. Dr.Thenmozhi K, KJC 17
  18. 18. Dr.Thenmozhi K, KJC 18
  19. 19. Dr.Thenmozhi K, KJC 19
  20. 20. Dr.Thenmozhi K, KJC 20
  21. 21. Dr.Thenmozhi K, KJC 21
  22. 22. Dr.Thenmozhi K, KJC 22
  23. 23. Dr.Thenmozhi K, KJC 23
  24. 24. Humans can’t directly communicate with computers Dr.Thenmozhi K, KJC 24
  25. 25. Dr.Thenmozhi K, KJC 25
  26. 26. Dr.Thenmozhi K, KJC 26
  27. 27. Dr.Thenmozhi K, KJC 27
  28. 28. Dr.Thenmozhi K, KJC 28
  29. 29. Dr.Thenmozhi K, KJC 29
  30. 30. Dr.Thenmozhi K, KJC 30
  31. 31. Dr.Thenmozhi K, KJC Check line by line 31
  32. 32. Dr.Thenmozhi K, KJC 32
  33. 33. Dr.Thenmozhi K, KJC 33
  34. 34. Dr.Thenmozhi K, KJC 34
  35. 35. Compiler A compiler is a computer program that reads a program written in a high-level language such as FORTRAN, PL/I, COBOL, etc. It can translate it into the same program in a low-level language including machine language. The compiler also finds out the various errors encountered during the compilation of a program. The compiler converts high-level language into low-level language using various phases. A character stream inputted by the customer goes through multiple stages of compilation which at last will provide target language. Advantages of Compiler There are various advantages of the compiler which are as follows − •A compiler translates a program in a single run. •It consumes less time. •CPU utilization is more. •Both syntactic and semantic errors can be checked concurrently. •It is easily supported by many high-level languages like C, C++, JAVA, etc.
  36. 36.  Interpreter  An interpreter is a program that executes the programming code directly instead of just translating it into another format.  It translates and executes programming language statements one by one. An interpreter takes less time to interpret a source program as distinguished by a compiler.  Advantages of Interpreter  There are various advantages of the interpreter which are as follows −  An interpreter translates the program line by line.  The interpreter is smaller in size.  It is flexible.  Error localization is easier.  The interpreter facilitates the implementation of computer programming language constructs.
  37. 37. LINKER • The main function of the linker is to generate executable files. • The linker takes the input as the object code which would be generated by a compiler/assembler. • The process of linking can be understood as a method to combine different snippets of code in order to obtain executable code. • There are two types of linkers available: Linkage Editor and Dynamic Linker. • Linker also helps combine all the object modules. • Linker is responsible to arrange the objects in the program’s address space.
  38. 38. LOADER • The main function of a loader is to load executable files to the main memory. • It takes the executable files (generated by linker) as its input. • It can be understood as a process of loading the executable codes into main memory where it is execute further. • There are 3 types of loaders: Absolute loading, Relocatable loading and Dynamic run-time loading. • It helps allocate the addresses to executable codes or files. • It is also responsible to adjust the references that are used within the program.
  39. 39. PROGRAMMING LANGUAGES  All computer programming language cannot do everything. There are limitations, and actually, different languages are used for different tasks.  Two categories :  Web language  Used for creating and editing pages on the web. Can do anything from putting plain text on a webpage, to accessing and retrieving data from a database. Varies in terms of power and complexity.  Software languages Used for creating executable programs. We can create anything from simple console programs that print some text to the screen or to the entire operating systems. Varies greatly in terms of power and complexity. Dr.Thenmozhi K, KJC 41
  40. 40. WEB LANGUAGE  HTML Hyper Text Markup Language. The core language of the world wide web that is used to define the structure and layout of web pages by using various tags and attributes.  XML Extensible Markup Language. A language developed by the W3C which works like HTML, but unlike HTML, allows for custom tags that are defined by programmers. XML allows for the transmission of data between applications and organizations through the use of its custom tags.  Javascript A language developed by Netscape used to provide dynamic and interactive content on webpages. With Javascript it is possible to communicate with HTML, create animations, create calculators, validate forms, and more.  VBScript Visual Basic Scripting Edition. A language developed by Microsoft that works only in Microsoft's Internet Explorer web browser and web browsers based on the Internet Explorer engine such as FlashPeak's Slim Browser. VBScript Can be used to print dates, make calculations, interact with the user, and more.  PHP Hypertext Preprocessor. A powerful language used for many tasks such as data encryption, database access, and form validation. PHP was originally created in 1994 By Rasmus Lerdorf.  Java A powerful and flexible language created by Sun MicroSystems that can be used to create applets (a program that is executed from within another program) that run inside webpages as well as software applications. Dr.Thenmozhi K, KJC 42
  41. 41. SOFTWARE LANGUAGES  C An advanced programming language used for software application development. Originally developed by Dennis Ritchie at Bell Labs in the 1970's and designed to be a systems programming language but since then has proven itself to be able to be used for various software applications such as business programs, engineering programs, and even games. The UNIX operating system is written in C.  C++ Descendant of the C language. The difference between the two languages is that C++ is object-oriented. C++ was developed by Bjarne Stroustrup at Bell Labs and is a very popular language for graphical applications.  Visual Basic A language developed by Microsoft based on the BASIC language . Visual Basic is used for creating Windows applications. The VBScript language (also developed by Microsoft) is based on Visual Basic.  Java A powerful and flexible language created by Sun MicroSystems that can be used to create applets (a program that is executed from within another program) that runs inside webpages as well as software applications. Dr.Thenmozhi K, KJC 43
  42. 42. TYPES OF LANGUAGES  Low-Level Programming Languages  Machine language  Medium-Level Programming Languages  Assembly language  High-Level Programming Languages  Procedural oriented language  Natural programming language  Visual programming language  Graphical programming language  Scripting language  Hypertext markup language  Extensible markup language  Object-Oriented Programming Language  Functional Programming Language  Problem-Oriented Programming Language  Artificial Intelligence Programming Language Dr.Thenmozhi K, KJC 44
  43. 43. 45 Dr.Thenmozhi K, KJC
  44. 44. 1. MACHINE LANGUAGE  Machine Language is also known as the First Generation Programming Language (1GL).  In simple words, a Computer is a cluster of millions and millions of switches, which can be either turned ON or OFF at a very high rate.  These two states (ON and OFF) can also be defined as 1 and 0 which is called Binary Code.  A computer just understands the language of 0s and 1s (Binary Code).  Since Machine Language doesn’t need a Compiler, Interpreter, or any type of program to convert its code. So, it is the fastest Programming Language.  However, working with Machine Language is not an easy task. As you need a good understanding of the architecture of the CPU and its working.  Here is a simple example of Machine Language or Binary Code – 00000001 00010000 00000100 01000000.  1GL  Low level language  First closest language to computer  Two states – on, off  Binary code – 0’s & 1’s  No need compiler, interpreter for conversion – faster  Understand the CPU working  Ex. Binary code -01011010 Dr.Thenmozhi K, KJC 46
  45. 45. 2. ASSEMBLY LANGUAGE  Assembly Language is also known as Second Generation Programming Language (2GL).  It is another Low-Level Programming Language and the second closest language to the Computer.  Assembly Language is slower as compared to the Machine Language. However, it is very fast when compared to High-Level Programming Languages (like – C, C++, Java).  Unlike Machine Language, the Assembly Language need a program (called Assembler) to convert its Assembly Code to Machine Code.  Programming in Assembly Language is comparatively much easier as compared to working with Machine Language.  2GL  Low level language  Second closest language to computer  Slower than machine lang.  Faster than high level lang.  Need Assembler for conversion  Working with assembly easy than machine  Ex. MOV, SUB Dr.Thenmozhi K, KJC 47
  46. 46. 3. PROCEDURAL-ORIENTED PROGRAMMING LANGUAGE  Procedural-Oriented Programming is also known as Third Generation Programming Language (3GL).  It is one of the primitive and important paradigms in the Programming Industry.  In Procedural-Oriented Programming, instead of focusing on data, we majorly focus on the procedure of the program.  The main goal of Procedural-Oriented Programming is to solve a problem.  So, data is the second priority in Procedural-Oriented Programming, as a result, this Programming Paradigm is comparatively less secure.  In Procedural Oriented Programming, we create a number of statements in order to solve any problem. It uses a Top-Down approach in order to solve any problem.  However, it is very important to maintain the order of every step or statement. Therefore, we make use of functions in Procedural-Oriented Programming.  Procedural-Oriented Programming is a much unrealistic approach to solve a problem as compared to other Programming Paradigm.  Examples of Procedural-Oriented Programming Language: Basic, Fortran, C, Pascal, and COBOL.  3GL  high level language  Focus procedure instead of data  Goal – solve the problem  Less secure  Use Top down approach – solve any problem  Step by step procedure follow  Need compiler for conversion  Working with assembly easy than machine  Ex. Basic, Fortran, C, Pascal, and COBOL. Dr.Thenmozhi K, KJC 48
  47. 47. NATURAL PROGRAMMING LANGUAGE  Ordinary human language like English  Programming language that use human language to give people a more natural connection with computers.  It is designed to make the computer solve a given problem without the programmer.  It is the part of the field of study known as AI. Dr.Thenmozhi K, KJC 49
  48. 48. VISUAL PROGRAMMING LANGUAGE (3G)  Visual programming language (VPL) is a programming language that uses graphical elements and figures to develop a program rather than textually.  Visual programming language is also known as executable graphics language.  The graphics or icons included within a visual program serve as input, activities, connections and/or output of the program.  UML are popular examples of visual programming languages. Dr.Thenmozhi K, KJC 50
  49. 49. SCRIPTING LANGUAGE  Scripting Language is the Programing Language which is used for performing automation or repetitive task with the help of scripts.  Unlike, other Programming Languages, Scripting Languages are Run-Time Programming Languages.  Web Automation or Web Scripting is one of the applications of Scripting Language.  You can also automate your daily task on a computer, with the help of Shell Script or Bash Script, which is another most popular example of Scripting Language.  Examples of Scripting Programming Language: Bash, JavaScript, Shell, Python, and Perl. Dr.Thenmozhi K, KJC 51
  50. 50. HYPERTEXT MARKUP LANGUAGE  Used to add functionality to a Web page, such as different menu styles or graphic displays or to serve dynamic advertisements.  These types of languages are client-side scripting languages, affecting the data that the end user sees in a browser window.  Other scripting languages are server-side scripting languages that manipulate the data, usually in a database, on the server.  Scripting languages came about largely because of the development of the Internet as a communications tool. JavaScript, ASP, JSP, PHP, Perl, Tcl and Python are examples of scripting languages.  Definition of HTML  HTML (Hypertext Markup Language) is the set of markup symbols or codes inserted in a file intended for display on a World Wide Web browser page.  The markup tells the Web browser how to display a Web page's words and images for the user.  Each individual markup code is referred to as an element (but many people also refer to it as a tag). Some elements come in pairs that indicate when some display effect is to begin and when it is to end.  Example1:  <html> <head> <title>Title of the document</title> </head> <body> The content of the document...... </body> </html> Dr.Thenmozhi K, KJC 52
  51. 51. EXTENSIBLE MARKUP LANGUAGE  Definition of XML  Extensible Markup Language (XML) is used to describe data. The XML standard is a flexible way to create information formats and electronically share structured data via the public Internet, as well as via corporate networks.  Difference between HTML and XML  1. HTML was designed to display data with focus on how data looks while XML was designed to be a software and hardware independent tool used to transport and store data, with focus on what data is. 2. HTML is a markup language itself while XML provides a framework for defining markup languages. 3. HTML is a presentation language while XML is neither a programming language nor a presentation language. 4. HTML is case insensitive while XML is case sensitive. 5. HTML is used for designing a web-page to be rendered on the client side while XML is used basically to transport data between the application and the database. 6. HTML has its own predefined tags while what makes XML flexible is that custom tags can be defined and the tags are invented by the author of the XML document. 7. HTML is not strict if the user does not use the closing tags but XML makes it mandatory for the user the close each tag that has been used. 8. HTML does not preserve white space while XML does. Dr.Thenmozhi K, KJC 53
  52. 52. HTML XML HTML stands for Hyper Text Markup Language. XML stands for extensible Markup Language. HTML is static. XML is dynamic. HTML is a markup language. XML provides framework to define markup languages. HTML can ignore small errors. XML does not allow errors. HTML is not Case sensitive. XML is Case sensitive. HTML tags are predefined tags. XML tags are user defined tags. There are limited number of tags in HTML. XML tags are extensible. HTML does not preserve white spaces. White space can be preserved in XML. HTML tags are used for displaying the data. XML tags are used for describing the data not for displaying. In HTML, closing tags are not necessary. In XML, closing tags are necessary. HTML is used to display the data. XML is used to store data. HTML does not carry data it just display it. XML carries the data to and from database. Dr.Thenmozhi K, KJC 54
  53. 53. THE DIFFERENT GENERATIONS OF LANGUAGES  First generation languages (abbreviated as 1GL) Represents the very early, primitive computer languages that consisted entirely of 1's and 0's - the actual language that the computer understands (machine language).  Second generation languages (2GL) Represents a step up from the first generation languages. Allow for the use of symbolic names instead of just numbers. Second generation languages are known as assembly languages. Code written in an assembly language is converted into machine language (1GL).  Third generation languages (3GL) With the languages introduced by the third generation of computer programming, words and commands (instead of just symbols and numbers) were being used. These languages therefore, had syntax that was much easier to understand. Third generation languages are known as "high level languages" and include C, C++, Java, and JavaScript, among others.  Fourth generation languages (4GL) The syntax used in 4GL is very close to human language, an improvement from the previous generation of languages. 4GL languages are typically used to access databases and include SQL and ColdFusion, among others.  Fifth generation languages (5GL) Fifth generation languages are currently being used for neural networks. A nueral network is a form of artificial intelligence that attempts to imitate how the human mind works. Dr.Thenmozhi K, KJC 55
  54. 54. FEATURES OF GOOD PROGRAMMING LANGUAGE  A programming language must be simple, easy to learn and use, have good readability, and be human recognizable.  Abstraction is a must-have Characteristics for a programming language in which the ability to define the complex structure and then its degree of usability comes.  A portable programming language is always preferred.  Programming language’s efficiency must be high so that it can be easily converted into a machine code and executed consumes little space in memory.  A programming language should be well structured and documented so that it is suitable for application development.  Necessary tools for the development, debugging, testing, maintenance of a program must be provided by a programming language.  A programming language should provide a single environment known as Integrated Development Environment(IDE).  A programming language must be consistent in terms of syntax Dr.Thenmozhi K, KJC 56
  55. 55. THANK YOU.. Dr.Thenmozhi K 9840559146 thenmozhi@kristujayanti.com Dr.Thenmozhi K, KJC 57