CSC 533: Organization of Programming Languages
Fall 2003

Test 2 Review


TEST 1 MATERIAL Abstraction control structures counter- vs. logic-controlled loops, branching subprograms subprogram linkage parameter passing: by-value, by-result, by-value-result, by-reference, by-name overloading functions/operators, templates implementation: activation records, run-time stack, dynamic & static links data abstraction abstract data types: require encapsulation of data & operations + info hiding ADTS in Modula-2 vs. C++ vs. Java object-based programming: program is a collection of interacting objects natural approach to design, modular (allows for reuse) object-oriented programming: OBP + inheritance + dynamic binding can build new classes on top of existing classes IS_A relationship allows for generic functions (requires dynamic binding) Java design goals: simple, object-oriented, network savvy, robust, secure, portable, arch. neutral, interpreted, high-performance, multi-threaded, dynamic features emphasize ease of programming more than efficiency based on C++ syntax, but removed many confusing/redundant features name resolution at link time, automatic memory reclamation, libraries, ... Java execution hybrid execution model: compile into byte code, execute with interpreter (JVM) primitive types: stack-dynamic, passed by-value reference types: heap-dynamic, passed by-value but behaves like by-reference implicitly inherit from Object type, wrapper classes exist Java vs. JavaScript JavaScript designed as scripting language for Web browsers retained syntactic similarity to C++/Java different design goals led to different features scripting language --> interpreted by browser, code embedded in HTML applications are quick & dirty --> implicit, dynamic variables applications are small --> useful objects provided, creation is crude user security is important --> can't access client files, but code is open Object-Oriented Programming OOP in C++: hybrid language, combines procedural code with objects specify inheritance with " : ParentClass" in class definition scope resolution operator can specify member functions from parent class virtual member function specifies dynamic binding (implemented using pointer) multiple inheritance (using ::), abstract member functions OOP in Java: pure OO language specify inheritance with "extends ParentClass" in class definition can specify methods from parent class by specifying super all methods are dynamically bound by default (can override with static) generic types via inheritance (e.g., vector of Objects) no multiple inheritance (but multiple interfaces OK), abstract methods