Pedagogy


Organization

Java For Artists is organized into six parts containing 25 chapters. Each part and the contents of its accompanying chapters is discussed below.

Part I: The Java Student Survival Guide

The four chapters in part I provide important background information meant to help the reader approach the material presented in the later sections of the book. Some of the material discussed in part I, especially in chapter 3, may be too advanced to be fully understood by the novice upon first reading.

Chapter 1: AN Approach To The Art Of Programming

Chapter 1 presents a general discussion of the practical aspects of Java programming. It starts by highlighting the difficulties students will encounter when first learning Java and discusses the emotions they will feel when they begin to experience the overwhelming complexity involved with learning the syntax of the Java language, the Java API, a suitable development environment, and how to solve a problem with a computer. The chapter also presents and discusses the three software development roles students play and the activities required by each role. It goes on to discuss a general approach to the art of programming which includes a treatment on the concept of the flow, which is a transcendental state programmers and artists attain when completely absorbed in their work. The chapter concludes with a discussion of how to manage Java project physical and conceptual complexity.

Chapter 2: Small Victories

Chapter 2 shows the reader how to create, compile, and run a simple Java project in several different development environments on Microsoft Windows, Apple’s OS X, and Linux operating systems. It shows the reader how to download, install, and configure the Java platform for Microsoft Windows and Linux including a discussion on how to set the PATH and CLASSPATH environment variables. The chapter concludes with a discussion on how to create executable jar files.

Chapter 3: Project Walkthrough A Complete Example

Chapter 3 presents the execution of a complete Java programming project from specification to final testing. The project approach strategy and development cycle originally presented in chapter 1 are applied in a practical setting. Each iteration of the project demonstrates the use of the development cycle to include planning, coding, testing, and integration. The chapter’s overarching theme is the answer to this question: “How do you, as a beginner, maintain a sense of forward momentum on a programming project when you don’t yet have a complete grasp of the Java language, API, or your development environment?”

Chapter 4: Computers, Programs, And Algorithms

Chapter 4 provides background information on how computers and programs work. It discusses the basics of computer hardware organization down to the processor level and the fundamentals of computer memory organization. It discusses the concept of a program and defines the steps of the processing cycle. The chapter concludes with a detailed discussion of the Java virtual machine (JVM) and its architecture.

Part II: Language Fundamentals

Part II contains chapters 5 through 11 and presents the core Java language features to include an overview of the Java API, language syntax, operators, control-flow statements, arrays, classes, compositional design and design by inheritance.

Chapter 5: Overview Of The Java API

Chapter 5 presents an overview of the Java platform application programming interface (API). The chapter shows readers how to consult the Java online documentation to find out information about a Java API class they want to use and how to navigate a class inheritance hierarchy to discover the class’s full functionality.

Chapter 6: Simple Java Programs—Using Primitive And Reference Data Types

Chapter 6 shows the reader how to write simple Java programs using primitive and reference data types. It starts by providing a definition of a Java program and discusses the difference between an application object vs. an applet object. The chapter then goes on to demonstrate how to create and compile a simple Java application. Next, the chapter discusses the concept of identifiers and identifier naming rules. It presents and discusses the Java reserved keywords, type categories, and language operators. It illustrates how to work with primitive and reference types, defines the terms variable, constant, statement, and expression, and demonstrates the accessibility between class and instance fields and the main() method. In summary, this chapter provides the fundamental footing all readers must have before attempting the remaining chapters in the book.

Chapter 7: Controlling The Flow Of Program Execution

Chapter 7 presents a complete treatment of Java’s control flow statements to include the if, if/else, switch, while, do/while, and for. The chapter shows how to achieve complex program flow control by combining various controlflow statements via chaining and nesting. The chapter also presents the purpose and use of the break and continue statements.

Chapter 8: Arrays

Chapter 8 offers a detailed discussion on the topic of Java arrays. The chapter begins by highlighting the special properties of Java array-type objects. The discussion then focuses on the functionality provided by single-dimensional arrays, followed, naturally, by multi-dimensional arrays. The material is reinforced with many illustrations showing readers how Java arrays are organized in memory. Tons of programming examples serve to reinforce the reader’s understanding of array concepts.

Chapter 9: Toward Problem Abstraction Creating New Data Types

Chapter 9 introduces the reader formally to the Java class construct. It starts with a discussion of problem abstraction and where the process of problem abstraction fits into the development cycle. The concept of the Unified Modeling Language (UML) class diagram is presented and is used from this point forward to communicate program designs. The Java class construct is thoroughly treated including class members, access modifiers, and static and nonstatic fields and methods. The class method is treated in detail as well and includes a discussion of method modifiers, return types, method names, parameter lists, and the method body. Numerous programming examples reinforce chapter material. The chapter concludes with a discussion of static initializers.

Chapter 10: Compositional Design

Chapter 10 shows readers how to create new class types from existing class types using compositional design. The chapter discusses the concepts of dependency vs. association and simple aggregation vs. composite aggregation. The chapter expands the reader’s knowledge of UML by showing how to express various types of aggregation via a UML class diagram. The chapter also introduces readers to the UML sequence diagram in conjunction with the chapter’s primary programming example. Other topics discussed in the chapter include the typesafe enumeration pattern and how to compile multiple Java source files with the javac command-line tool.

Chapter 11: Extending Class Behavior Through Inheritance

Chapter 11 shows readers how to create new Java classes using inheritance. The chapter starts by showing how to express inheritance relationships via a UML class diagram. It then moves on to discuss the three essential purposes of inheritance, the concepts of base and derived classes, and how to override base class methods in derived classes. Next, the chapter presents a discussion of abstract base classes, abstract methods, and interfaces. It highlights the differences between abstract base classes vs. interfaces and shows readers how to represent interfaces in a UML class diagram. The chapter also presents a discussion of how to control horizontal and vertical access, and how to achieve polymorphic behavior. The primary chapter programming example shows readers how to combine compositional design with inheritance to achieve powerful results.

Part III: Graphical User Interface Programming

Part III includes chapters 12 through 14 and gives readers a detailed treatment of graphical user interface (GUI) programming using AWT and Swing components.

Chapter 12: Java Swing API Overview

Chapter 12 presents the fundamental concepts of GUI programming including an overview of the fundamental components found in the Java Swing API. This chapter introduces readers to the screen coordinate system and explains the different types of windows. It discusses the differences between containers and components and explains the use and behavior of layout managers.

Chapter 13: Handling GUI Events

Chapter 13 moves beyond chapter 12 and shows readers how to create rich, interactive GUIs utilizing Java event handing techniques. It dives deeply into the different types of EventListener interfaces and describes the steps required to register an EventListener with a GUI object. This chapter also explains how to have events generated by GUI objects located in one class handled by an EventListener located in another class. This chapter also presents a detailed discussion of how to handle GUI events using inner and anonymous classes.

Chapter 14: An Advanced GUI Project

Chapter 14 builds on chapters 12 and 13 by walking readers through the creation of a significant Java GUI project. It shows readers how Swing paints components, how to use the Graphics class, how to load resources from a package-relative path, how to write custom renderers, and how to write a custom editor. This chapter also details how to create custom Events and EventListeners, how to create an offscreen image, how to paint with transparency, and how to extend Swing components to provide significant new functionality.

Part IV: Intermediate Concepts

Part IV contains four chapters that deal with exceptions, threads, collections, and file input and output. This material is considered intermediate because it is assumed at this point that readers are familiar with the core Java language features presented in part II. The material in this section should be well-understood by readers before they attempt part V—Network Programming.

Chapter 15: Exceptions

Chapter 15 dives deeply into the subject of exceptions. It begins by discussing the Throwable class hierarchy and explains the difference between errors, exceptions, runtime exceptions, and checked vs. unchecked exceptions. It then moves into a detailed discussion of exception handling using different combinations of the try-catch-finally blocks. The chapter then shows readers how to throw exceptions, create custom exceptions, and how to translate lowlevel exceptions into higher-level exception abstractions more appropriate for their program needs.

Chapter 16: Threads

Chapter 16 focuses on the subject of thread programming. It starts with the definition of a thread and describes the different ways to start and stop a thread. It then describes the difference between extending the Thread class and implementing the Runnable interface. This chapter also explains how to set thread priorities. It correlates the behavior of thread priority to popular operating systems and explains how thread race conditions can occur. It also clearly explains the mechanics of thread synchronization and shows readers how to manage multiple threads that share common resources. The chapter concludes by showing readers how to use the Java thread wait and notify mechanism to ensure cooperation between threads.

Chapter 17: Collections

Chapter 17 gives readers a solid overview of the Java collection framework. The chapter begins by explaining the rationale for a collections framework by developing a home-grown dynamic array class. It then presents an overview of the Java collections framework followed by a discussion of Java 1.4 collections. The chapter concludes with a discussion of Java 5 generics and shows readers how to use generic collection classes as well as how to write their own generic methods.

Chapter 18: File I/O

Chapter 18 offers a fairly complete treatment of file I/O programming using the classes from the java.io package. The chapter shows readers how to make sense out of what is considered to be the most confusing package in the Java platform API. It then goes on to demonstrate the use of every class in the java.io package that can be used for file I/O. Although the focus of the chapter is on file I/O, the information learned here can be directly applied when programming network I/O operations. The chapter concludes with a comprehensive programming example showing how the RandomAccessFile class can be used to create a legacy datafile adapter.

Part V: Network Programming

Part V consists of three chapters that cover a broad range of network programming concepts to include an introduction to networking and distributed applications, client-server applications, Remote Method Invocation (RMI) programming, Applets and JDBC.

Chapter 19: Introduction To Networking And Distributed Applications

Chapter 19 provides a broad introduction to the concepts associated with network programming and distributed applications. It begins by exploring the meaning of the term computer network and shows how the TCP/IP network protocols serve as the foundation protocols for internet programming. The chapter continues with a discussion of client-server computing, application distribution, multi-tiered applications, and physical vs. logical application tier distribution. It explains clearly how multiple JVMs must be deployed in order to execute physically-distributed Java applications. The chapter then goes on to explain the purpose and importance of the internet protocols TCP/IP. The chapter concludes with an RMI programming example on both the Java 1.4 and Java 5 platforms.

Chapter 20: Client-Server Applications

Chapter 20 focuses on client-server application programming and steps the reader through a comprehensive network programming example that utilizes both RMI and I/O streams. It explains and demonstrates the use of the ServerSocket, Socket, and Thread classes to write multi-threaded client-server applications. The chapter also explains how to use the DataInputStream and DataOutputStream classes to send data between socket-based client-server applications. Additional topics discussed in the chapter include the use of the Properties class to store and retrieve application properties, how to formulate proprietary network application protocols, how to use the Class.forName() method to dynamically load classes at application runtime, and how to use the singleton and factory design patterns in a program.

Chapter 21: Applets And JDBC

Chapter 21 provides a discussion of applets and Java Database Connectivity (JDBC) programming. It begins with a treatment of applets, their purpose and use, and their lifecycle stages. It discusses applet security restrictions and shows readers how to design with these security restrictions in mind. The applet discussion continues by showing readers how to pass information into an applet from an HTML page via applet parameters. The chapter then presents a discussion of JDBC and shows readers how to store data to and retrieve data from a relational database via the JDBC API. The chapter concludes with a comprehensive programming example showing readers how to write an applet that serves as a front-end to an RMI-based application that uses JDBC to manipulate data stored in a MySQL database.

Part VI: Object-Oriented Programming

Part VI contains four chapters and presents material related to the theoretical aspects of object-oriented design and programming. Topics include a deeper treatment of inheritance, composition, interfaces, polymorphic behavior, how to create well-behaved Java objects, three design principles, and a formal introduction to a few helpful design patterns.

Chapter 22: Inheritance, Composition, Interfaces, And Polymorphism

Chapter 22 dives deeper into the topics of inheritance, compositional design, the role of interfaces, and how to achieve polymorphic behavior. It begins by comparing the goals of inheritance vs. composition and suggests that the true goal of good design is to know when the design is good enough by recognizing and making rational software engineering tradeoffs. The chapter continues by giving expanded coverage of inheritance concepts and introduces readers to Meyer’s inheritance taxonomy and Coad’s inheritance criteria. Next, the chapter explores the role of interfaces and how they can be used to reduce or eliminate intermodule dependencies. It introduces the concept of modeling dominant, collateral, and dynamic roles and suggests when interfaces might be used vs. a class hierarchy. The chapter concludes with a discussion of applied polymorphic behavior and composition-based design as a force multiplier.

Chapter 23: Well-Behaved Objects

Chapter 23 shows readers how to create well-behaved Java objects by correctly overriding the methods provided by the java.lang.Object class. These methods include the toString(), equals(), hashCode(), and clone() methods. The chapter shows readers how to implement two different hash code algorithms and discusses the difference between a deep vs. a shallow copy. The chapter continues by showing readers how to implement both the java.lang.Comparable and the java.util.Comparator interfaces. It then concludes by demonstrating the use of well-behaved objects in a collection.

Chapter 24: Three Design Principles

Chapter 24 introduces readers to three important object-oriented design principles that can be immediately applied to improve the quality of their application architectures. The chapter begins with a discussion of the preferred characteristics of an object-oriented architecture. It then presents a discussion of the Liskov substitution principle and Bertrand Meyer’s design-by-contract, preconditions, postconditions, and class invariants. This is followed with a discussion of the open-closed principle and the dependency inversion principle.

Chapter 25: Helpful Design Patterns

Chapter 25 presents a formal introduction to the topic of software design patterns. It begins by describing the purpose and use of design patterns and their origin. The chapter then discusses and demonstrates the singleton, factory, model-view-controller, and command patterns. The comprehensive programming example presented at the end of the chapter demonstrates the use of all these patterns in one application.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net