120 likes | 133 Views
This overview of Windows programming covers the concepts, paradigms, and tools used in developing computer programs that run within Windows environments. It includes information on programming languages, language translators, object-oriented programming, as well as the benefits of Windows and the popular Borland C++ Builder development tool.
E N D
Chapter 0 Overview Windows Programming, C.-S. Shieh, KUAS EC, 2005
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. Windows Programming, C.-S. Shieh, KUAS EC, 2005
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. Windows Programming, C.-S. Shieh, KUAS EC, 2005
Computer Programming (cont) • Language translators • Assembler • Compiler • Interpreter • Virtual machines Windows Programming, C.-S. Shieh, KUAS EC, 2005
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++ • … Windows Programming, C.-S. Shieh, KUAS EC, 2005
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()); } Windows Programming, C.-S. Shieh, KUAS EC, 2005
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()); } Windows Programming, C.-S. Shieh, KUAS EC, 2005
Windows Programming • Why Windows? • PCs make computers more affordable. • Graphic User Interface (GUI) of Windows make computers more user-friendly. Windows Programming, C.-S. Shieh, KUAS EC, 2005
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++ Windows Programming, C.-S. Shieh, KUAS EC, 2005
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. Windows Programming, C.-S. Shieh, KUAS EC, 2005
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 Windows Programming, C.-S. Shieh, KUAS EC, 2005
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. Windows Programming, C.-S. Shieh, KUAS EC, 2005