Presentation is loading. Please wait.

Presentation is loading. Please wait.

PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.

Similar presentations


Presentation on theme: "PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do."— Presentation transcript:

1 PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do

2 Objectives Tr.Hadeel@hotmail.com 2  Introduction to computers.  Describe what programmers do and do not do  Explain how programmers define a problem, plan the solution, and then code, test, and document the program  List and describe the levels of programming languages: machine, assembly, high level, very high level, and natural  Describe the major programming languages that are in use today  Explain the concepts of object-oriented programming

3 Computer Tr.Hadeel@hotmail.com 3  A computer is a machine that can process data (input) into useful information (output).  Consist of software and hardware.  Hardware : Equipment associated with the system ( e.g., the keyboard, screen, mouse, hard disk, memory, DVDs and processing units)..  Software : programs that run on a computer to control hardware. e.g. Applications software: to perform a particular task. operating system : set of programs to Serves as intermediary between hardware and applications software Database management : store data, update it, manipulate it, retrieve it, report it in a variety of views, and print it in as many forms. Programing language :

4 Programming Tr.Hadeel@hotmail.com 4  Program – a set of detailed, step-by-step instructions that directs the computer to do what you want it to do  Programming language – a set of rules that provides a way of telling the computer what operations to perform

5 The Programming Process Tr.Hadeel@hotmail.com 5  Five main steps  Defining the problem Defining the problem  Planning the solution Planning the solution  Coding the program Coding the program  Testing the program Testing the program  Documenting the program Documenting the program

6 Defining the Problem Tr.Hadeel@hotmail.com 6  Develop a written agreement that specifies:  The input data  The desired output  The processing required to convert  Sometimes, the programmer receives a written specification from the systems analyst  Other times, the programmer meets with users directly Return

7 Planning the Solution Tr.Hadeel@hotmail.com 7  Algorithm – a detailed, step-by-step solution to the problem  Several tools help plan the algorithmplan the algorithm  Desk-check the solution  Carry out each step of the algorithm with pencil and paper Return

8 Planning Tools  Flowchart – a pictorial representation of the algorithm  Pseudocode – English-like language Specifies algorithm with more precision than you can in English, but less than a programming language 8 Tr.Hadeel@hotmail.com Return

9 Coding the Program Tr.Hadeel@hotmail.com 9  Translating the algorithm from the planning stage into a formal programming language  All languages have syntax rules  Similar to grammatical rules  The computer will reject a program with even a minor syntax error  Programs can be keyed into the computer by using a text editor Return

10 Testing the Program Tr.Hadeel@hotmail.com 10  Two phases of testing the program  Translation Translation Converting the program you wrote into the binary instructions the CPU understands  Debugging Identifying and correcting logic errors in the program Return

11 Translation  Compiler translates the program (source module) into a machine language version (object module)  If the compiler detects syntax errors, it will produce messages describing those errors  If no syntax errors exist, the object module will be linked to create a load module  Load module is executed by the computer 11 Tr.Hadeel@hotmail.com Return

12 Documenting the Program Tr.Hadeel@hotmail.com 12  Materials are generated at each part of the process  Common examples of documentation  Flowchart and/or pseudocode  Comments within the source code  Testing procedures  Layouts of input and output records  A narrative description of the program Return

13 Levels of Languages Tr.Hadeel@hotmail.com 13  Lower-level languages – more like the 0s and 1s the computer itself uses  Higher-level languages – more like the languages people use  Divided into five generations

14 Five Generations of Languages Tr.Hadeel@hotmail.com 14  Machine language Machine language  Assembly languages Assembly languages  High-level languages High-level languages  Very high-level languages Very high-level languages  Natural languages Natural languages

15 Machine Language Tr.Hadeel@hotmail.com 15  Programs and memory locations are written in strings of 0s and 1s  Problems with machine languages  Programs are difficult to write and debug  Each computer has its own machine language  Only option available to early programmers Return

16 Assembly Languages Tr.Hadeel@hotmail.com 16  Substitute mnemonic codes for 0s and 1s  For example, A for add, C for compare, etc.  Use names rather than binary addresses for memory locations  Require an assembler to translate the program into machine language  Still used for programming chips and writing utility programs Return

17 High-Level Languages Tr.Hadeel@hotmail.com 17  Transformed programming  Programmers could focus on solving problems rather than manipulating hardware  Programs could be written and debugged much more quickly  Requires a compiler to convert the statements into machine language  Each computer has its own version of a compiler for each language Return

18 Very High-Level Languages Tr.Hadeel@hotmail.com 18  Also called fourth-generation languages (4GLs)  The programmer specifies the desired results, and the language develops the solution  Programmers can be about 10 times more productive using a fourth-generation language than a third- generation language Return

19 Natural Languages  Resemble written or spoken English  Programs can be written in a natural syntax, rather than in the syntax rules of a programming language  The language translates the instructions into code the computer can execute 19 Tr.Hadeel@hotmail.com Return

20 Major Programming Languages Tr.Hadeel@hotmail.com 20  FORTRAN FORTRAN  COBOL COBOL  BASIC BASIC  RPG RPG  Visual Basic Visual Basic  C C  Java Java

21 FORTRAN  The first high-level language  Stands for FORmula TRANslator  Used primarily for engineering, mathematical, and scientific tasks 21 Tr.Hadeel@hotmail.com Return

22 COBOL  Stands for COmmon Business- Oriented Language  Used primarily for business requirements  Processes large data files  Produces well-formatted reports 22 Tr.Hadeel@hotmail.com Return

23 BASIC  Stands for Beginners’ All- Purpose Symbolic Instruction Code  Developed to teach programming to college students  Became very popular with the introduction of the microcomputer 23 Tr.Hadeel@hotmail.com Return

24 RPG  Stands for Report Program Generator  Designed to allow rapid creation of reports  Programmer simply describes the source data and desired report format 24 Tr.Hadeel@hotmail.com Return

25 Visual Basic  Allows programmer to create Windows-like user interfaces  Programmer drags a control (button, text box, etc.) onto the form  VB creates the code associated with that control  VB is event-driven  The user controls the program 25 Tr.Hadeel@hotmail.com Return

26 C  Originally designed to write systems software  Offers the ease of use of a high-level language with the efficiency of an assembly language  Very portable – can be used with virtually every combination of computer and operating system 26 Tr.Hadeel@hotmail.com Return

27 Java  A network-friendly programming language that permits a piece of software to run directly on many different platforms  Allows programmers to write one version of the program, rather than a separate version of each platform  Very useful for Internet development  Java applets can run in the user’s Web browser 27 Tr.Hadeel@hotmail.com Return

28 Object-Oriented Programming Tr.Hadeel@hotmail.com 28  Object – a self-contained unit that contains both data and its related functions  Key terms in object-oriented programming  Encapsulation – an object isolates both its data and its related instructions  Attributes – facts that describe the object Also called properties  Methods – instructions that tell the object to do something  Messages – an outside stimulus that results in the change of the state of an object

29 Using Objects  Programmers define classes of objects  The class contains all attributes that are unique to objects of that class  An object is an instance (occurrence) of a class  Objects are arranged hierarchically in classes and subclasses  Subclasses are derived from classes  Inheritance – a subclass possesses all attributes of the class from which it is derived  Additional attributes can be coded in the subclasses 29 Tr.Hadeel@hotmail.com

30 Activating the Object Tr.Hadeel@hotmail.com 30  A message is sent to the object, telling it to do something  The object’s methods tell it how to do it  Polymorphism – each object has its own way to process the message  For example, the class may have a Move method, but each subclass implements that method differently

31 Object-Oriented Languages Tr.Hadeel@hotmail.com 31  C++ C++  Java Java  C# C#  Visual Basic Visual Basic

32 C++ Tr.Hadeel@hotmail.com 32  An enhancement of the C language  Includes all features of C  Adds support for object-oriented programming  Can be used as simply an improvement of C, without the object-oriented features Return

33 Java Tr.Hadeel@hotmail.com 33  A pure object-oriented program  Used to create small programs called applets  Applets can be delivered over the Web and run on any platform Return

34 C# Tr.Hadeel@hotmail.com 34  Microsoft’s answer to Java  Has the same advantages over C++ that Java has  Designed to work within Microsoft’s.NET environment .NET is designed for building, deploying, and running Web-based applications Return

35 Visual Basic Tr.Hadeel@hotmail.com 35  Previous versions supported some object technology  The current version, VB.NET, is the first to support inheritance and polymorphism  These two traits are required for a true object-oriented language Return

36 Tr.Hadeel@hotmail.com 36 End


Download ppt "PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do."

Similar presentations


Ads by Google