12
Windows Programming, C.-S. Shieh, KUAS EC, 2005 1 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Embed Size (px)

Citation preview

Page 1: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 1

Chapter 0

Overview

Page 2: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 2

Computer Programming

• What is programming?– Computers are quick, reliable, and flexible. – The flexibility of computers is a result of the

idea "stored-program control". – We instruct computer to perform tasks via

programming - the writing of computer control programs.

– Windows programming is the writing of computer programs running within Windows environments.

Page 3: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 3

Computer Programming (cont)

• Programming paradigms– Hardwired control, in contrast to flexible stored-

program control – Machine code – Assembly language – High-level language – Macro of packages, extensions to designed

functionality to fit customer's need – Script of operating systems, such as batch files, shell

script, ... – Script of virtual machines, such as Netscape

Navigator and Microsoft Internet Explorer are virtual machine for JavaScript.

Page 4: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 4

Computer Programming (cont)

• Language translators– Assembler – Compiler – Interpreter – Virtual machines

Page 5: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 5

Computer Programming (cont)

• High-level programming languages– Procedural

• FOrmula TRANslator (FORTRAN) • Beginner's All-purpose Symbolic Instruction Code (BASIC) • COmmon Business Oriented Language (COBOL) • Pascal • C

– Functional • PROgramming in LOGic (PROLOG)

– Object-oriented • Object Pascal • C++

– …

Page 6: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 6

Object-Oriented Programming

• Encapsulation of data and related operators

class rectangular {public: int width; int height; int area() { return width*height; } };

int main(){rectangular x;x.width=5; x.height=6;printf("%d",x.area());}

Page 7: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 7

Object-Oriented Programming (cont)

• Inheritance

class rectangular {public: int width; int height; int area() { return width*height; } };

class block: public rectangular {public: int depth; int volume() { return width*height*depth; } };

int main(int argc, char **argv){block x;x.width=5; x.height=6; x.depth=2;printf("%d",x.volume());}

Page 8: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 8

Windows Programming

• Why Windows?– PCs make computers more affordable. – Graphic User Interface (GUI) of Windows

make computers more user-friendly.

Page 9: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 9

Windows Programming (cont)

• Paradigms for Windows programming– Windows Application Programming Interface ( ~ machine code)

• A huge collection of C functions for drawing graphic user interfaces and tracking Windows messages.

– Application Framework ( ~ assembly language) • Hierarchical class library and hidden message-handling mechanism

to reduce the burden of programmers. • Microsoft's Microsoft Foundation Class (MFC) • Borland's Object Windows Library (OWL)

– Rapid Application Development (RAD) / Visual Programming ( ~ high-level language)

• Visual components greatly simply the GUI deign. • Adopt the concept of software IC. • Microsoft's Visual BASIC in BASIC • Borland's Delphi in Object Pascal • Borland's C++ Builder in C++

Page 10: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 10

Windows Programming (cont)

• Program execution from programmer's viewpoint– DOS programs are procedural with console

I/O: Program starts execution with main(), functions (procedures) are called in turn at the will of programmers.

– Windows programs are event-driven with GUI: Graphic user interface is presented, and then functions are called in response to user's action.

Page 11: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 11

Windows Programming (cont)

• Program design from programmer's viewpoint– DOS programming

• declare required variables • implement procedural algorithms

– Windows programming • graphic user interface design • choose visual components • set up their prosperities • implement event handlers

Page 12: Windows Programming, C.-S. Shieh, KUAS EC, 20051 Chapter 0 Overview

Windows Programming, C.-S. Shieh, KUAS EC, 2005 12

Borland C++ Builder

• Borland Software Corporation at http://www.borland.com• GUI design is greatly simplified with visual drag-and-drop

of components. • An excellent implementation of the idea of software IC. • Each software component has

– Properties: can be set at design time or modified by code at run time to change its behavior or appearance.

– Methods: callable functions for performing certain functions – Responsive events: where we implement our algorithms

• Intensive on-line will help you to get acquainted with those components.

• Wide variety of third-party components are available from third party, even free on the Internet.