Programming Fundamentals Lecture #2 Overview of Computer Programming Junaid Hassan Lecturer CS & IT Department UOS MBDIN junaidte14@gmail.com
Programming/Coding Set of rules to instruct computers to perform certain tasks is called as programming. A language which is understandable by computers is called as programming language
Purpose of the course To understand different programming concepts and to familiarize students with the basic structured programming skills. Problem analysis, algorithm designing, program development and testing/debugging
Overview of Computer Programming Set of instructions/statements we write to command computers to perform actions & make decisions is called a computer program/software Programming language that we will use (in this course) is C/C++ C++ is the next version or superset of C C does not support classes & objects because C is a procedural programming language, whereas C++ is a combination of both procedural and object oriented programming capabilities
Overview of Computer Programming A computer is a device that can perform computations & make decisions billions of times faster than humans can. Computers process data under the control of sets of instructions called computer programs People who write these computer programs are called as computer programmers
Machine Languages, Assembly Languages & High Level Languages Some programming languages are directly understandable by computers but some languages require intermediate translation steps There are hundreds of computer languages in use today These computer programming languages can be divided into three general types: 1) Machine Languages 2) Assembly Languages 3) High Level Languages
Machine Languages A language which is directly understandable by computers is called as machine language. It’s also called as natural language of computers. Machine languages generally consits of strings of numbers (ultimately reduced to 1’s & 0’s) that instruct computers to perform their most elementary operations one at a time Machine language programming was too slow, tedious & error prone for most programmers
Assembly Languages Istead of using strings of numbers that computers could directly understand, programmers began using English- Like abbreviations to represent elementary operations These abbreviations formed the basis of assembly languages To convert assembly language code to machine language code, translator programs called assemblers were developed
Assembly Languages Although assembly language code is clearer to humans but it’s not understandable by computers until translated to machine language code In assembly language, programmers still need to use many instructions to accomplish even the simplest tasks That’s why we moved to next level i.e High level languages
High Level Languages To speed up the programming process, high level languages were developed in which single statements could be written to accomplish substantial tasks Translator programs used to convert high level language code to machine language code are called compilers. Advantage of high level language is that we can write instructions like every day English & with commonly used mathematical notations
Machine Languages, Assembly Languages, High Level Languages Requirement: Add overtime pay to base pay & store the result in gross pay Machine Language Code: +1300042774 +1400593419 +1200274027
Machine Languages, Assembly Languages, High Level Languages Requirement: Add overtime pay to base pay & store the result in gross pay Assembly Language Code: Load basepay Add overpay Store grosspay
Machine Languages, Assembly Languages, High Level Languages Requirement: Add overtime pay to base pay & store the result in gross pay High Level Language Code: grosspay = basepay + overpay ;
Machine Languages, Assembly Languages, High Level Languages From programmer’s point of view high level languages are preferable to machine & assembly languages C, C++, Microsoft’s .NET languages (e.g visual basic, visual c++ & visual c#) & java are among the most widely used high level programming languages
Real World Application Areas of C/C++ Operating systems Development of new languages e.g python, php Computation platforms e.g matlab Graphics, games, GUI based apps Web browsers Database softwares e.g mysql and many more.....