Download presentation
Presentation is loading. Please wait.
1
VB in Context Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh Pittsburgh, Pa 15260 Email: spring@imap.pitt.edu Web: http://www.sis.pitt.edu/~spring Voice: (412) 624-9429 Fax: (412) 624-2788
2
The Value of History 19502050 2000 1970 Unix 1980 Ethernet 1998 Wireless 1993 WWW 1994 Java 1 1985 C++ 1970 C/Basic 1999 Java 2 1994 Visual Basic 2002 VB.NET 1999 XML
3
Design Methodology and Language Capability Computer architecture constrains language design and language design constrains system design Some languages are better suited to different design methodologies Languages have evolved, in response to SAD needs –Data abstraction –Structure abstraction –Modularization –Componentization
4
Language Design Goals Language design goals originate with the software development process goals –Software must be reliable It must be “writable” (e.g. match to the problem) It must be readable (e.g. ability to follow logic) It must be able to deal with exceptions (e.g. trapping) –Software must be maintainable (e.g. constants) –Software must execute efficiently (e.g. automatic optimization)
5
Abstraction A programming language is an abstraction of the underlying processor and computer. A program is an abstraction of some problem The history of programming languages may be viewed as an effort to ever greater abstraction –Abstraction of data types –Abstraction of process structures –Abstraction of arbitrary data types –Abstraction of modules
6
Data Abstraction A byte is a byte is a byte –The problem of streams -- sockets –Big and little endian –Floating point variation – exponent and mantissa Structures and Unions –Type declaration –Variable declaration –Variable definition
7
Control Abstraction Basic computer control is provided with two simple mechanisms –Sequencing –Branching These mechanisms, in various forms are abstracted as: –Sequencing –Selection (single, double, and multiple) –Repetition (do/while, while, and for) Blocks of code are further abstracted as modules or subprograms
8
Selected Programming Concepts Variable scope and lifetime Weak and strong typing Early and Late Binding Recursion Multithreading Exception handling
9
Variables: Scope and Lifetime The scope of a variable is the range of program instructions over which a variable is known and over which it can be manipulated –Global static –Local static –Program dynamic The lifetime of a variable is the period of time over which its storage space is provided: –Static –Stack –Dynamic
10
Weak and strong typing Typing is the specification of the class of the allowable values of a variable. In C, typing is very weak and the contents of any particular memory location may generally be interpreted differentially –Booleans and ints –Addition of characters Weak typing generally allows implicit conversions Strong typing requires explicit cast or method based conversions
11
Early and Late Binding Binding refers to when the attributes (required for execution) of some object (variable or module) are set. Early binding generally means that these attributes are set at the time of compilation Late binding means that the attributes are set at time of execution
12
Recursion Recursion is a programming language feature that allows a module to invoke itself It is required that the algorithm have a recursion termination condition private static long factoral(long a) { if (a==1) {return 1;} else {return a*factoral(a-1);} }//factoral
13
Multiprocessing and Multithreading Modern OS allow for multiple processes and multiple threads within a process Processes –Share files and selected other objects –Do not share memory –Forking is the invocation mechanism Threads –Share memory and must be memory synchronized –Threads are very common in Java
14
Exception handling Exception handling has to do with the provision in a language for dealing with possible function failures –In C, return values of the functions are the mechanism used to handle exceptions –In Java, catch/try blocks and “exception throwing” are the mechanism General, system failures are handled by signals and signal handlers
15
WIMPS – A Programming Model WIMP interfaces are developed in a “sandbox” The sandbox is an event collector and dispatcher Objects within the sandbox are event generators –Objects form a hierarchy of containers and components –Objects are capable of generating different events Mouse action events Exposure events Change events Action events Code fragments are written to handle events and then registered
16
Common Elements of A User Interface Tookit Command Tools –Menus –Dialog boxes Selection Tools –Command buttons –Radio buttons –Check boxes –Text fields –Palettes and choosers Navigation Tools –Scroll bars –Hands –Murals/Maps Status Tools –Status bars –Cursors
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.