chapter 7 introduction to high-level language programming

10
Chapter 7 Introduction to High-Level Language Programming

Post on 19-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 7 Introduction to High-Level Language Programming

Chapter 7

Introduction to High-Level Language Programming

Page 2: Chapter 7 Introduction to High-Level Language Programming

Graphical ProgrammingTextual output vs. graphicsText-oriented OS: MS-DOS, VMSGraphical User Interface: Mac OS, MS Windows, X-WindowRelated subjects: Visualization of 3-D surface (Figure

7.30) Computer graphics Computer Aided Design (CAD), CAM

Page 3: Chapter 7 Introduction to High-Level Language Programming

Graphic Primitives

Modern computer terminals use bit mapped display.The screen is made up of picture elements (pixels).Black-and-white, gray scale display, color displayThe memory that stores the actual screen image is called a frame buffer.Refresh rate

Page 4: Chapter 7 Introduction to High-Level Language Programming

Graphics Library

Contains routines for: Drawing simple

geometric shapes (lines, circles) Creating and selecting colors Displaying windows Pull-down menus buttons

(0,0)

(maxX, maxY)

Page 5: Chapter 7 Introduction to High-Level Language Programming

Ex: Small Graphics Library

1. clearscreen(I)2. moveto(x,y)3. getmaxx()4. getmaxy()5. setcolor(I)6. lineto(x,y)7. rectangle(x1,y1,x2,y2)8. circle(x,y,r)9. writedraw(value,x,y)10.getmouse(x,y)

Page 6: Chapter 7 Introduction to High-Level Language Programming

Examples

1. Move to center of screenX=getmaxx();Y=getmaxy();moveto(X/2,Y/2);

2. Draw a line from (20,20) to (100,100)clearscreen(0);setcolor(1);moveto(20,20);lineto(100,100);

Page 7: Chapter 7 Introduction to High-Level Language Programming

Creating a titled window

Clearscreen(0);Setcolor(1);Rectangle(50,50,350,80);Rectangle(50,80,350,300);Moveto(50,60);Lineto(150,60);Moveto(50,70);Lineto(150,70);Moveto(250,60);Lineto(350,60);Moveto(250,70);Lineto(350,70);Writedraw(“Title”,180,70);

Title

Page 8: Chapter 7 Introduction to High-Level Language Programming

The Big Picture

Software engineeringCoding (implementation) is a small part of the software life cycle.May occupy only 10-20% of the total time spent by programmers and designers.What are the other important steps?

Page 9: Chapter 7 Introduction to High-Level Language Programming

Software Development Cycle

1. Before implementation Feasibility study Problem specification Program design Algorithm selection or development, and analysis

2. Implementation Coding Debugging

3. After implementation Testing,verification and benchmarking Documentation Maintenance

Page 10: Chapter 7 Introduction to High-Level Language Programming

Scaling Up

Programs that students write in a first programming course may be a few hundred lines.Truly large software systems may contains millions of lines of code.Refer to Figure 7.35.