COP-4338, Programming III Lectures
Note: Links will not be alive until a day or two before class.
- July 2: Opening remarks, the Object class, Reflection,
and the Proxy Pattern
- Object class PDF slides
- Reflection PDF slides
- Illustration of the correct way to override
equals, hashcode, toString,
- Illustration of using reflection to invoke main
- Using accessible fields to get private data
- Illustration of the proxy pattern.
Shows generation by hand, generation by using Java 1.3 dynamic proxies,
and an approximation of what
the dynamic proxy is actually producing for you behind the scenes
- July 4: No class
- July 9: Threads and Synchronization
- PDF slides
- Illustrates basics of getting threads to run:
- Illustrates threads corrupting data:
- Series of examples using an Account.
Some threads do deposits, some do withdraws on shared account.
- Two examples with multiple monitors
- Static methods have different monitors than instance methods:
- July 11: Networking
- July 11: Server-side Programming
- PDF slides
- JSDK 2.1 download for Windows (375K)
- This material is not in the text. Additional references:
- For all Java examples, save the HTML in main folder, place the
class files in your WEB-INF/servlets directory, and start the servletrunner.
The links will not run directly from my web page because
our web server is not running servlets.
- CGI program in C++ to print out what a form transmits.
prog1.html (uses POST), and
prog1b.html (uses GET).
- CGI script can be invoked from a Java program, so you cannot
assume the form has done verification:
- Findmax program using a servlet:
- Program to render PDF files (assumes get, so include
name of file, minus .pdf extension after a ? in the URL):
- Cookie example from slides:
- Session example from slides:
- July 16: Serialization
- July 16: Garbage Collection
- Java Developer Connection Article
shows that soft references don't stay around for a long time.
shows a factory class that hands out Foo objects
(from a pre-allocated pool),
but requires that the client release the objects back to the pool.
shows a factory class that hands out Foo objects,
but does not require that the client release the objects.
Instead it uses weak references to detect orphaned Foo objects,
and reclaims those orphans for the pool.
- July 18: Security
- July 18: Intro to RMI
- July 23: Exam #1 (90 minutes)
- July 25: C++ Basics, arrays, strings, files
- Simple C++, and compiling
- vector class.
- Parameter passing: call by constant reference.
- resizing and push_back
- string class.
- Basics of files.
- July 25: Pointers and Reference Variables
- new and delete
- Reference variables
- July 30: Classes
- Sample C++ code
- Classes: interfaces, member functions, visibility
- Separation of interface and implementation
- Default parameters
- Scope :: operator
- ifndef/endif and separate compilation
- Const and non-const methods
- Implicit type conversions
- Explicit constructors
- Initializer lists
- Static members
- Operator overloading
- The big three: destructor, operator= and copy constructor
- Constant and reference data member
- Example: The Rational class
- August 1: Templates
- August 6: STL
- Pointer variables and their relation to primitive arrays
- Primitive strings
- STL Basic ideas
- Lists vs Vectors
- The Pair pattern
- Sets and maps
- The concordance example
- String streams
- August 6: Inheritance
- Implementing a derived class
- Defaults for the Big Three in the derived class
- Protected members
- Static vs. dynamic binding
- virtual keyword
- The virtual destructor
- Various C++ differences from Java
- August 8: Programming in C
- August 13: Native Methods in C and C++
- PDF slides
- Hello World:
- Visual C++ setup
cl -GX /GR -IC:\jdk1.3\include -IC:\jdk1.3\include\win32 HelloNative.cpp -LD -FeHelloNative.dll
- Accessing fields of Date class:
- Accessing methods of Date class:
- Accessing strings in Date class:
- Using arrays:
- Using exceptions:
- Creating a Java VM from C++:
- August 15: Second Exam