Java 101: The next generation: It's time for a change
Find out how the Java Date and Time API addresses the need for a more robust date and time infrastructure in Java SE, then familiarize yourself with the java.time classes you're most likely to use, in this inaugural installment of "Java 101: The next generation."
Jeff Friesen, April 2013
Datastructures and algorithms, Part 2
Last month's column brought you into the computer science world of datastructures and algorithms by focusing on the array datastructure and associated algorithms. Developers view the array as a fundamental datastructure because it serves as the basis for more complex datastructures, such as stacks, queues, and trees. Developers also view the fundamental linked-list datastructure as a foundation for more complex datastructures.
Jeff Friesen, June 2003
Datastructures and algorithms, Part 1
Computer science emphasizes two important topics: datastructures and algorithms. Those topics are important because the choices you make for a program's datastructures and algorithms affect that program's memory usage (for datastructures) and CPU time (for algorithms that interact with those datastructures). When choosing a datastructure or algorithm, you sometimes discover an inverse relationship between memory usage and CPU time: the less memory a datastructure uses, the more CPU time associated algorithms need to process the datastructure's data items, which are primitive type values or objects, via references. Also, the more memory a datastructure uses, the less CPU time associated algorithms need to process the data items—and faster algorithms result. This inverse relationship appears in Figure 1.
Jeff Friesen, May 2003
Regular expressions simplify pattern-matching code
Text processing frequently requires code to match text against patterns. That capability makes possible text searches, email header validation, custom text creation from generic text (e.g., "Dear Mr. Smith" instead of "Dear Customer"), and so on. Java supports pattern matching via its character and assorted string classes. Because that low-level support commonly leads to complex pattern-matching code, Java also offers regular expressions to help you write simpler code.
Jeff Friesen, February 2003
Tools of the trade, Part 3
What task do you perform after creating your Java program with a development tool, such as JCreator, and thoroughly testing that program with a testing tool, such as Jtest? Answer: Prepare the program for installation on your customers' computers. How do you accomplish that task? Either create your own installation program, which might take as long to create as the program to be installed, or obtain a tool that creates that installation program for you. However, the J2SE (Java 2 Platform, Standard Edition) SDK doesn't provide such a tool. Although the SDK provides a jar tool that simplifies distribution by packaging a program's classfiles and other files into a jar file, that tool proves appropriate only for simple installations. For more complex installations, which might involve displaying a license agreement a customer must accept before installation proceeds, you must use an appropriate non-SDK installation tool, such as InstallAnywhere, which this article explores.
Jeff Friesen, January 2003
Tools of the trade, Part 2
Sun Microsystems' Java 2 SDK tools prove helpful for building small Java programs. However, they lack features for the rapid development and thorough testing that large Java programs need. Furthermore, no SDK tool simplifies the installation of a Java program's classfiles (and other files) on multiple platforms. Thus, a world of non-SDK Java tools have evolved, tools that facilitate the development, testing, and installation of Java programs. In this series, I explore some of those tools: the JCreator development tool (which I explored in Part 1), the InstallAnywhere installation tool (which I will explore in Part 3), and the Jtest testing tool (which I explore this month). Before exploring Jtest, I introduce testing in a Java context.
Jeff Friesen, December 2002
Tools of the trade, Part 1
Although I use Java 2 Platform, Standard Edition (J2SE) tools (such as javac) throughout Java 101, a world of Java tools exists beyond the SDK. I would do you a disservice if I did not explore some of those tools in this column. Therefore, this month's Java 101 article introduces a three-part series that explores one non-SDK Java tool from each of the following three categories:
Jeff Friesen, November 2002
Java's character and assorted string classes support text-processing
Text can represent a combination of digits, letters, punctuation, words, sentences, and more. Computer programs that process text need assistance (from their associated languages) to represent and manipulate text. Java provides such assistance through the Character, String, StringBuffer, and StringTokenizer classes. In this article, you'll create objects from these classes and examine their various methods. You'll also receive answers to three mysteries: why Java regards a string literal as a String object, why String objects are immutable (and how immutability relates to string internment), and what happens behind the scenes when the string concatenation operator concatenates two strings into a single string.
Jeff Friesen, October 2002
Packages organize classes and interfaces
Why reinvent the wheel? That cliche applies to software development where some developers frequently rewrite the same code for different programs. Two disadvantages with that approach are:
Jeff Friesen, September 2002
Java 101: Understanding Java threads, Part 4: Thread groups, volatility, and thread-local variables
The "Understanding Java threads" series concludes by uncovering some of the loose ends of threading: thread groups, volatility, thread-local variables, timers, and thread death.
Jeff Friesen, August 2002
Java 101: Understanding Java threads, Part 3: Thread scheduling and wait/notify
Jeff Friesen keeps the <em>Java 101</em> focus on Java threads this month, introducing the mechanisms that allow you to select and manage thread priority. Learn how thread scheduling, the wait/notify mechanism, and thread interruption should work in your Java programs.
Jeff Friesen, July 2002
Java 101: Understanding Java threads, Part 2: Thread synchronization
Multithreaded programming brings a new order of complexity to Java threads, and you'll need some new tools to manage it successfully. In this second article in the <em>Java 101</em> "Understanding Java threads" series, Jeff Friesen eases into the subject of thread synchronization. Learn how to use synchronization to serialize thread access to critical code sections in your programs.
Jeff Friesen, June 2002
Java 101: Understanding Java threads, Part 1: Introducing threads and runnables
Java application users have little patience with poor performance, and threading is one of the best tools we have for allocating application resources efficiently. Jeff Friesen spends the next four articles in the <em>Java 101</em> series introducing Java threads.
Jeff Friesen, May 2002
Exceptions to the programming rules, Part 2
Last month's Java 101 article introduced you to exceptions. You learned that an exception diverges from normal execution and observed how C, C++, and Java programs handle exceptions. This month, I delve into Java's throw-object/catch-object exception-handling technique by focusing on that technique's exceptions class hierarchy, statements and clauses, and various rules. After completing this article, you will be able to incorporate Java's throw-object/catch-object exception-handling technique into your programs.
Jeff Friesen, April 2002
Exceptions to the programming rules, Part 1
Apart from the simplest programs, programs usually fail. Causes range from coding mistakes to bad user input, to operating system flaws. Regardless of the failure's cause, as a software developer, you're charged with designing programs that can either recover (where the program continues to execute after fixing the failure) or properly shut down (where the program makes every effort to save the user's data before terminating). After all, why should users pay for faulty programs that fail to save data when those programs unexpectedly terminate?
Jeff Friesen, March 2002