Week 1 -2: Introduction to programming and programming languages Chapter One By Lwomwa Joseph CSC 1107: Structured Programming.

Slides:



Advertisements
Similar presentations
Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
Advertisements

Software Development Languages and Environments. Programming languages High level languages are problem orientated contain many English words are easier.
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Computers Are Your Future
Programming Types of Testing.
Programming Creating programs that run on your PC
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
The Analytical Engine Module 6 Program Translation.
Computer Concepts 5th Edition Parsons/Oja Page 546 CHAPTER 11 Software Engineering Section A PARSONS/OJA Computer Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Computers: Tools for an Information Age
An Introduction to Programming with C++ Fifth Edition Chapter 1 An Introduction to Programming.
Chapter 1 Program Design
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
ALGORITHMS AND PROGRAMMING LANGUAGES Lecture 5: Algorithms and programming languages Networks and Communication Department 1.
1 CS101 Introduction to Computing Lecture 19 Programming Languages.
CS 331, Principles of Programming Languages Introduction.
© Paradigm Publishing Inc Chapter 12 Programming Concepts and Languages.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
1 Chapter-01 Introduction to Computers and C++ Programming.
Software Development Concepts ITEC Software Development Software Development refers to all that is involved between the conception of the desired.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Computers Are Your Future Tenth Edition Chapter 11: Programming Languages & Program Development Copyright © 2009 Pearson Education, Inc. Publishing as.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Introduction to Computer Programming itc-314
Languages and Environments Higher Computing Unit 2 – Software Development.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
COMPUTER PROGRAMS AND LANGUAGES Chapter 4. Developing a computer program Programs are a set (series) of instructions Programmers determine The instructions.
CS101 Introduction to Computing Lecture Programming Languages.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
CSC425 - Introduction To Computer Programming 1. 2 Generation Of Programming Languages A set of rules that telling a computer what to do. There are over.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Programming Domains 1.Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Programming and Languages Dept. of Computer and Information Science IUPUI.
Introduction to OOP CPS235: Introduction.
Course Instructor: Hira Farman Course : BY:HIRA FARMAN.
CONCEPTS OF PROGRAMMING LANGUAGES
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
CSC141 Introduction to Computer Programming Programming Language.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Computer Language
Lecture 1 Introduction Richard Gesick.
CSCI-235 Micro-Computer Applications
Introduction of Programming Languages
Introduction to programming languages, Algorithms & flowcharts
TRANSLATORS AND IDEs Key Revision Points.
Computer Programming.
CMP 131 Introduction to Computer Programming
Programming.
and Program Development
Principles of Programming Languages
ICT Programming Lesson 1:
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
An Introduction to Programming with C++ Fifth Edition
Presentation transcript:

Week 1 -2: Introduction to programming and programming languages Chapter One By Lwomwa Joseph CSC 1107: Structured Programming

Programming And Programming Languanges What is meant by Programming Programming is the art of writing computer programs. A program in this case is a set of instructions to be executed by the computer. Programming involves breaking down a task into small steps. In programming, we study the problem at hand, look for the solution to the problem and implement that solution using a particular programming language. What is a Programming Language A programming language is a language that a computer can understand and provides a programmer an environment to write and execute programs in it. A number of programming languages exist but the choice mainly depends on the nature of the problem at hand and the programmer’s ability to use the language. There has been a great revolution in programming languages right from the time when programming started. The

The first generation of programming languages involved the use of machine language, the second involved the use of assembly language, the third generation involved high-level programming languages like C, C++, Java e.t.c, the forth generation involved languages mainly used for database manipulation like Structured Query Language (SQL) and the fifth generation involved languages mainly used for artificial intelligence and neural networks like ProLog and LISP First Generation: Machine language Machine language consists of binary sequences of 0's and 1's which represent an instruction in the control logic of a specific CPU type, often expressed in hexadecimal (base 16) for clarity. It is different for each machine (i.e. machine dependant). All programs must be written in machine language (code) or translated into machine language before being executed by the machine.

For example. A program that adds over time pay to base pay and stores the result in gross pay could look like this one below. ……………………… Second Generation: Assembly language As you can see from the above example, machine language instructions would be cumbersome for humans. That is why the assembly language came into programming to make life easier.

Assembly languages use short abbreviations (mnemonics) corresponding to machine language are used for instructions (e.g. JSR DECOUT instead of ) Example corresponding to the above machine code could be ………………………………………… Load Basepay Add OverPay Store GrossPay …………………………………………..

Third Generation: High-level Languages (HLL) Writing programs in Assembly language was a bit easy but these required many instructions to accomplish even the simplest tasks. HLL codes are similar to everyday English language which makes it easier for programmers to understand. HLLs are machine independent and must be interpreted or compiled. HLLs use mathematical notations (translated via compilers) E.g GrossPay = basepay + overTimePay HLLs are meant to correspond (roughly) to the way humans describe solutions. They are more abstract than low level languages, and therefore are portable between machines Compilers in this case are programs that translate high level language instructions into machine code for later execution.

There is also what we call Interpreters. They are similar to compilers; they interweave the translation and execution activities. They translate a small part of the source and execute them one by one. Interpreters are mainly used to interpret the source code for scripting languages Often a single HLL instruction will be represented by several machine code instructions and HLLs are often tailored to specific kinds of problems. For example, 1. FORTRAN and Pascal are normally used for scientific calculation 2. COBOL – Common Business-Oriented Languages used for report generation, handling large amounts of business data 3. C, C++, Java, Visual Basic - general purpose problem solving languages. 4. SQL used for manipulating databases.

Fourth Generation languages (4GLs) More than the previous levels of languages, 4GLs are similar to human languages and are application-specific. Often used with database systems; for example, SQL (Structured Query Language) 4GLs can be easily written with the use of simple, sentence-like commands, such as SELECT NAME FROM RECORDS WHERE NAME=“JOHN”; Isn’t this pretty simple? Other examples of 4GLs include the UNIX shell, PostScript, Mathematica e.t.c. They may include special facilities for automatic report generation or interaction with the database.

Classifications of Programming languages Programming languages are classified based on what they are able to do. For example, we have classifications like Procedural languages, object-oriented languages and scripting languages e.t.c A. Procedural Programming Languages Procedural programming is a programming paradigm based upon the concept of the modularity and scope of program code (i.e., the data viewing range of an executable code statement). A main procedural program is composed of one or more modules (also called packages or units), either coded by the same programmer or pre-coded by someone else and provided in a code library. Each module is composed of one or more subprograms (which may consist of procedures, functions, subroutines or methods, depending on programming language). Examples include, C, FORTRAN,Ada, and ALGOL.

B. Object-Oriented Programming Languages An object-oriented programming language is one that allows or encourages, to some degree, object-oriented programming methods. These languages include 1. "pure" object-oriented languages such as Smalltalk, Eiffel and Ruby, which were designed specifically to facilitate - even enforce - object-oriented methods 2. languages such as Java and Python, which are primarily designed for object-oriented programming but have some procedural elements; and languages such as C++, Fortran 2003, and Perl, which are historically procedural languages that have been extended with some object-oriented features.

C. Scripting Programming Languages Scripting programming languages (commonly called scripting languages or script languages) are computer programming languages designed for "scripting" the operation of a computer. Early script languages were often called batch languages or job control languages. Many scripting languages emerged as tools for executing one-off tasks, particularly in system administration. One way of looking at scripts is as "glue" that puts several components together; thus they are widely used for creating graphical user interfaces. Scripting languages tend to be interpreted rather than compiled, which means that you don't need to compile them - they're compiled "on the fly" (i.e. when necessary, right before they're run). This can make it faster to program in them (since you always have the source code, and don't need to take the deliberate extra step of compiling) Examples include: PHP, Perl, JavaScript, Coldfusion, Awk, csh, bash e.t.c

Syntax, Semantics and Program Errors A programming language has both syntax and semantics 1. Syntax Syntax of a programming language means the rules that dictate how exactly the vocabulary elements of the language can be combined to form statements. Each programming language has its own unique syntax. For example, in English we know that a sentence must end with a question mark, a full stop or an exclamation mark. That is the rule that must be obeyed During compilation, all syntax rules are checked. If a program is not syntactically correct, the compiler will issue error messages. Such errors could be like attempt to add two integers but the addition operator in not put between them or forgetting to close a procedure/function.

2. Semantics The semantics of a statement in a programming language define what will happen when that statement is executed. In other words, semantics refer to the meaning of the statement. Programming languages are generally unambiguous, which means the semantics are well defined. This means there’s only one and only one interpretation of each statement. Natural languages e.g. French and English are full of ambiguities.

3. Program Errors You will encounter three types of errors as you develop programs 1. Compile time errors. These are errors identified by the compiler when it is compiling your program. They may include syntax errors and wrong data types. A program will not execute until when a compile time error is corrected. 2. Runtime errors. These occur during the execution of a program and cause a program to abort abnormally e.g. division by zero, infinite looping. 3. Logical errors. The program compiles and runs normally but it produces wrong results. A logical error may occur when:  A value is calculated incorrectly e.g instead of addition you subtract.  When a graphical button does not appear in the correct place.

Logical errors are the most difficult to debug because they manifest themselves in many ways when their root cause is different. Debugging is the process of finding and correcting errors/bugs in a program. The figure below shows the basic program development process.

BASIC PROGRAMMING DEVELOPMENT PROCESS

Programming Process followed by Object Oriented languages

Program Development and the Top-Down Design Approach Program development During the program development process, the following steps must be followed; Step1. Understand the problem Step2. Analyzing the problem we're given Step3. Dissect the problem into manageable pieces Step4. Developing a solution technique (algorithm) Step5. Documenting the program/technique Step6. Translating (implementing) the technique into code Step7. Compiling and running the program Step8. Testing the results with appropriate data The above steps must be followed carefully. After step 8, if there are logical errors (i.e. program running properly but results are not correct), you must go back to step 6.

Top-Down Design Approach Many problems are too large to immediately grasp and solve all the details; top-down design approach tries to address this issue. Take a problem, divide it into smaller logical sub-problems, and remember how they fit together For each sub-problem, divide it into still smaller sub-problems Continue sub-dividing until each little problem is small enough to be easily solved Solving a collection of small problems thus allows us to solve one much larger problem END