SCO Introduction to programming. Course description Introduction to programming methodology and...

33
SCO Introduction to programming

Transcript of SCO Introduction to programming. Course description Introduction to programming methodology and...

SCO Introduction to programming

Course description

• Introduction to programming methodology and problem-solving strategies: the role of algorithms in the problem-solving process; implementation strategies for algorithms; debugging strategies; the concept and properties of algorithms. Simple data types. Constants and variable declaration. Arithmetic and logical operators. Use of arrays. Working with text files. Program development using a higher level programming language such as C. Use of control structures, functions and procedures. Programming techniques, top down methodology, design, code, debug, & program documentation.

Course Outline

week

Topic/SubTopic Remarks

1 Introduction to programming concepts: Programming languages, Algorithms, Pseudocodes, designing programs.

2 C fundamentals: Program structure in C, Data types, Keywords, Library files, Variables, Constants

3 Operators and Expressions: Arithmetic operations, Unary operators, Comparisons and Logical operators. Expressions and assignments

4 Data input and Output: getchar(), putchar(),Scanf() , printf(), gets(), and puts() functions, creating an interactive program in C

5 Compiling and running C programs: compiling and executing, debugging errors.

6 Control statements: sequential, Decisions, repetitive statements. Examples in C programming: C.A.T 1 on 15th oct 2010

7 Functions: defining functions, Accessing functions, function prototypes, passing arguments to a function, Recursion.

8 Program structure: Storage Classes, Automatic Variables, Variable Scope: Global, Local, and Static. Multifile programs, Library files.

9 Arrays: Defining an array, processing an array, passing an array to a function, Multidimensional Arrays, Array and strings, practical application of arrays.

10 Pointers: Fundamentals, Pointer declarations, Passing pointers to Functions, pointers and one-dimensional Arrays, Dynamic Memory Allocation, Operations on Pointers, pointers and Multidimensional arrays, Arrays of Pointers, passing functions to other functions.

11 Structures and Unions: Defining a structure, processing a structure, User-defined data types, Structures and pointers, passing structures to functions, Self-referential structures, unions.

12 Data Files: Opening and closing data files, creating and processing data files, unformatted data files.C.A.T 2 on 12 Nov 2010

13 Revision

References

• Course textbooks:1. Byron Gottfried (2005), Schaum’s outlines Programming with c 2nd

ed. Tata McGraw-Hill Edition.

• References:1. Francis Musembi Kwale(2009), Fundamentals of Programming Using

C, 1st ed. Egerton University Press2. Kerningam Brian (1998). The C Programming Language. Prentice –

Hall.3. Ravichandran, D. (1995). Programming in C. New Age International4. Any other relevant books and websites

Introduction

• Recall what is – Computer– Computer system

Biographical History of Computing

• 1800s– George Boole – devised Boolean algebra– Charles Babbage – created "analytical engine"– Augusta Ada Byron – first computer programmer– Herman Hollerith – founder of company that

would become IBM

1930s

• Alan Turing – deciphered German code in WWII; father of artificial intelligence

• John V. Atanasoff – inventor of first electronic digital special purpose computer

10

1940s

• Howard Aiken – built large scale digital computer, Mark I

• Grace M. Hopper – originated term "debugging"; pioneered development and use of COBOL

• John Mauchley and J. Presper Eckert – built first large scale general purpose computer, ENIAC

11

1940s continued

• John von Neumann – developed stored program concept

• Maurice V. Wilkes – built EDSAC, first computer to use stored program concept

• John Bardeen, Walter Brattain, and William Shockley – developed transistor that replaced vacuum tubes

12

1950s

• John Backus – created Fortran; early user of interpreters and compilers

• Reynold B. Johnson – invented the disk drive• Donald L. Shell – developed efficient sorting

algorithm

13

1960s

• John G. Kemeny and Thomas E. Kurtz – invented BASIC

• Corrado Bohm and Guiseppe Jacopini – proved that any program can be written with only 3 structures: sequence, decision, and loops

• Edsger W. Dijkstra – stimulated move to structured programming by declaring "GOTO" harmful

14

1960s continued

• Harlan B. Mills – advocated use of structured programming

• Donald E. Knuth – wrote definitive work on algorithms

• Ted Hoff, Stan Mazer, Robert Noyce, and Frederico Faggin – developed first microporcessor

15

1960s continued

• Douglas Engelbart – invented computer mouse

16

1970s

• Ted Codd - software architect; laid the groundwork for relational databases

• Paul Allen and Bill Gates - cofounders of Microsoft Corporation

• Stephen Wozniak and Stephen Jobs - cofounders of Apple Computer Inc.

• Dan Bricklin and Dan Fylstra - wrote VisiCalc, the first electronic spreadsheet program

17

1970s continued

• Dennis Ritchie - creator of the C programming language.

• Ken Thompson - created the Unix operating system• Alan Kay – developer of Smalltalk, a pure object-

oriented language• Don Chamberlain - created a database programming

language, later known as SQL,

18

1980s

• Phillip “Don” Estridge - at IBM directly responsible for the success of the personal computer.

• Mitchell D. Kapor - cofounder of Lotus Corporation• Tom Button - group product manager for

applications programmability at Microsoft;• headed the team that developed QuickBasic, QBasic,

and Visual Basic.

19

1980s continued

• Alan Cooper - considered the father of Visual Basic.• Tim Berners–Lee - father of the World Wide Web.• Charles Simonyi - the “father of Word.”• Bjarne Stroustrup - creator of the C++ programming

language. • Richard M. Stallman - founded Free Software

Foundation

20

1990s

• Marc Andreessen - inventor of the Web browser.

• James Gosling – creator of Java. • Linus Torvalds - developed the popular Linux

operating system.

21

1990s continued

• Brain Behlendorf, Rob McCool, and Roy Fielding - developers of the Apache HTTP server, an open-source Web server that can scale up quickly to handle high volumes of traffic.

2000s

• Check from the internet 21st century discoveries in computers , softwares and the pioneers.

23

Programming Languages:

• Definition• Classification:– Low level:• Machine Language • Assembly Language

– High level Language• Procedural• Nonprocedural• Object-oriented

24

Machine Language

• The fundamental language of the computer’s processor, also called Low Level Language.

• All programs are converted into machine language before they can be executed.

• Consists of combination of 0’s and 1’s that represent high and low electrical voltage.

• NB: Every language must be translated to M.L. before execution of any program.

Recall about

• Compiler: Separate program that generates programming list (consists of errors)

• Program that converts entire source program into machine language before executing it

• Interpreter: Program that translates and executes one program code statement at a time. Does not produce an object

26

Assembly Language

• A low level language that is similar to machine language.

• Uses symbolic operation code to represent the machine operation code.

27

High Level Language

• Computer (programming) languages that are easier to learn.

• Uses English like statements.• Examples are C ++, Visual Basic, Pascal,

Fortran and …....

• Procedural: Programming instructions to tell computer what to accomplish and how to do it

• Nonprocedural language -> Programmer specifies only what the program should accomplish; it does not explain how

High level language -

Object-oriented (OO) approach

• The structured programming does not explain how to keep the data and program together

• Eliminates redundant programming• No more spaghetti code• Programmer can package data and program (or

procedure) into a single unit, called an object (uses the OO approach)

• OOP is event-driven• Checks for and responds to set of events• C++ is a complete object-oriented language

OO Programming languages

• Hundreds of programming languages exist – They are different in flexibility, user interface, and functionality

• C++ : Classes and events• Java and Java applets: Small Java program that runs inside another program such as a

Web browser• Visual Programming Language

– Windows-based application that assists programmers in– developing event-driven Windows-based applications

• Fifth – generation language– Allows drop and drag of objects– Easy to use

• Examples:– Visual Basic– Visual Studio/Visual C++/Visual C# .NET

• Run over the Internet• Easier programming development• Suitable for large/small – scale applications

Web page program development tools

• Tools used to create web pages• Adding special effects and forms to a Web page

– Examples: Cookies, Shopping cards, Games, and many other multimedia effects

– Script: Interpreted program that runs on client– Applet: Also usually runs on client, but is compiled – runs faster than

script– Servlet: Applet that runs on server– ActiveX control: Small program that runs on client

• HTML– Hypertext Markup Language – set of special codes used to– create web page-– Not a programming language – Page formatting language– Uses tags an must be kept as an ASCII file

• Dynamic HTML:– Allows you to include more graphics and interactivity on Web– page (pointing to a text changes the shape)– Animations, Interactions, Scroll bar, pop-up windows

• XML: eXtensible Markup Language– Allows Web page developers to create tags that describe data– passed to a client so client, rather than server, can process– data – different platforms can display the same XML

• XHTML: eXtensible HTML Includes features of HTML and XML• WML Wireless Markup Language

– Allows Web page developers to design pages specifically for– micro-browsers– Uses the wireless application protocol (WAP)

• Web page authoring:– Dreamweaver MX, FrontPage, Flash

• Common Gateway Interface Program (CGI)– Used for sending and receiving information over the

web– Basic Idea:

• Resides in the server• When a search is requested the it is sent to the CGI program• The CGI contacts the database and requests the information• The CGI receives the information from the database and

shows it in HTML format and it is sent to the web browser