Successfully reported this slideshow.
Your SlideShare is downloading. ×

PCCF UNIT 2.pptx

Upcoming SlideShare
Loading in …3

Check these out next

1 of 63 Ad

More Related Content

Recently uploaded (20)


PCCF UNIT 2.pptx

  1. 1. COMPUTING AND PROGRAMMING FUNDAMENTAL 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. 1
  2. 2. PROGRAMMING  Program – Set of instruction  Programming - is the process of writing an algorithm into a sequence of computer instructions.  Programming  Structured  Unstructured 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. 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;  }  4 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;  }
  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. 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;  } 6 Output : Addition = 15 Subtraction = 5
  7. 7. 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. 7
  8. 8. 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. 8
  9. 9. (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 9
  10. 10. OBJECT ORIENTED PROGRAMMING  Object – entity  Oriented – interested in a particular kind of thing or object  In layman's terms, it is a programming pattern that rounds around an object or entity are called object-oriented programming.  The object-oriented programming is basically a computer programming design methodology that organizes/ models software design around data, or objects rather than functions and logic.  An object is referred to as a data field that has unique attributes and behavior.  Everything in OOP is grouped as self-sustainable objects. 10
  11. 11. POWER OF OOP Points to Remember  Everything is an object  Developer manipulates objects that uses message passing.  Every object is an instance of a class.  The class contains the attribute and behavior associated with an object. 11
  12. 12. 12
  13. 13. 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 13
  14. 14.  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). eg. kids  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 14
  15. 15. WHY OOPS 15
  16. 16. 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 16
  17. 17. 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. 17
  18. 18.  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. 18
  19. 19. 19
  20. 20. 20
  24. 24. 25
  25. 25. 26 Humans can’t directly communicate with computers
  26. 26. 27
  27. 27. 28
  28. 28. 29
  29. 29. 30
  31. 31. 30-11-2022 BCA204A13: COMPUTING AND PROGRAMMING FUNDAMENTALS 32 Check line by line
  33. 33. TYPES OF 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. 36
  34. 34. 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. 37
  35. 35. 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. 38
  36. 36. LEVEL  Low-Level Programming Languages  Machine language  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 39
  37. 37. 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. 40
  38. 38. 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. 41  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
  39. 39. 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. 42  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
  40. 40. 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. 43  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.
  41. 41. 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. 44
  42. 42. 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. 45
  43. 43. 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. 46
  44. 44. 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> 47
  45. 45. 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. 48
  46. 46. 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. 49
  47. 47. 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 50
  48. 48. 51
  49. 49. NUMBER SYSTEM  Number systems are the technique to represent numbers in the computer system architecture, every value that you are saving or getting into/from computer memory has a defined number system.  Decimal – base 10  Binary – base 2  Octal- base 7  Hexadecimal- base 16 52
  50. 50. 53
  51. 51. 54
  53. 53. 56
  54. 54. 57
  55. 55. 58
  56. 56. 59
  57. 57. 60
  58. 58. 61
  59. 59. 62
  60. 60. 63