3. Object-Oriented Programming
This section under construction.
Overview.
In object-oriented programming, we write Java code to create new data types, specifying the values and operations to manipulate those values. The idea originates from modeling (in software) real-world entities such as electrons, people, buildings, or solar systems and extends readily to modeling abstract entities such as bits, numbers, programs or operating systems.- 3.1 Data Types describes how to use existing reference data types, for text processing image processing.
- 3.2 Creating Data Types describes how to create user-defined data types using Java's class mechanism.
- 3.3 Designing Data Types considers important techniques for designing data types, emphasizing APIs, encapsulation, immutability, and design-by-contract.
- 3.4 Case Study: N-Body Simulation presents a case study that simulates the motion of N particles, subject to Newton's laws of gravity.
Java programs in this chapter.
REF PROGRAM DESCRIPTION 3.1.1 AlbersSquares.java Albers square 3.1.2 Luminance.java convert color to grayscale 3.1.3 Fade.java fade in from one image to another 3.1.3 Grayscale.java convert color image to grayscale 3.1.3 Scale.java resize an image 3.1.3 Potential.java potential field visualization 3.1.3 GeneFind.java find genes within DNA 3.1.3 Split.java break up a file by fields 3.2.1 Charge.java charged particle data type 3.2.1 Complex.java complex number data type 3.2.1 Mandelbrot.java plot the Mandelbrot set 3.2.1 Turtle.java turtle graphics 3.3.1 Counter.java counter data type 3.3.1 Vector.java vector data type 3.3.1 CompareAll.java similarity search 3.4.1 Ball.java bouncing ball data type 3.4.1 BouncingBalls.java bouncing balls client 3.4.1 Body.java celestial body data type 3.4.1 Universe.java universe data type for N-body simulation
Click on the program name to access the Java code; click on the reference number for a brief description; read the textbook for a full discussion.
Exercises.
Include a link.Old stuff.
- 3.5 Inheritance introduces a technique to define the relationships among objects known as inheritance. We cover interfaces and subtyping.
- 3.6 Purple America presents a case study to visualization geographical and election data for US presidential elections.
