How they do it. How we do it.
The public television norm is to make broadcast episodes available on the WWW for access at any time, and this is a splendid idea. Unless, of course, it is done behind a paywall of some sort. That takes all the fun out of it. The entire program, whether a one-off or a series, should be viewable at will. For free. But, why leave it at that?
The WWW offers enormous potential that can take the scope and depth of a pub-tel series far, far beyond what is possible on ordinary television. The rigidly constrained time and scheduling of broadcasting mean that the series seen on air must follow a tightly defined format and thread. As a series, it requires a consistent “look & feel”. If the theme is teaching programming in Java, then the program cannot wander off into a three episode long investigation of various operating systems, with extended discussions of which works best where. It has fifty-six minutes; neither more nor less. It has thirteen episodes per trimester, thirty-nine per series.
Why accept such a confining set of boundaries?
Making episodes for the WWW breaks all of these barriers. It allows us to:
- make as many episodes as we wish, subject to funding and production efficiency
- let each episode run as long as it needs to
- discuss anything that relates usefully to learning to program small computers
- bring in industry experts, including those from series underwriters
- be more…entertaining than is customary on public television
- add deeper and broader content over time without being bound to broadcast schedules
- accommodate audience participation via questions and complaints (What? Complain about us? Outrageous!)
- use a less costly presenter, thus getting much more mileage from the available funding
- range farther afield in the selection of topics to explain
A television program must necessarily operate within the limits imposed by a discrete series. Not so on the WWW, where we can go on making episodes for as long as the funding lasts. Once the production process is under way, then adding incrementally to the episode inventory proves remarkably inexpensive and fast. The full television series runs thirty-nine one-hour episodes. The WWW version of the program can run riot, limited by only our own imagination and the underwriters’ generosity.
Provisionally, these platforms will be used in the series for development:
- Mac OS X
- Linux Mint
- TrueOS (FreeBSD)
Additionally, various real-time operating system platforms will be examined for hosting the applications built during the course. The selection of RTOS platforms will be driven by the availability of free or very-low-cost OSes for popular hardware alternatives, such as x86, amd64, ARM, and others.
Episode 1: Introduction to the Series
Explanation of the series’ objectives, with examples of everything that will be covered throughout the course. Discuss the “cookbook” approach, outlining how this will enhance the students’ ability to put to good use what is taught in each episode.
Demonstrate the installation of the SDK (JDK) for the current version of Java. Demonstrate minimal-tool compiling. Explain the JVM and discuss how its performance compares to that of conventional programs written in C or C++.
Show how a functional and realistic program can be created by starting with boilerplate sample program fragments that are then built up through modification and adaptation to achieve the desired results. Try to find an imaginative alternative to the ghastly “Hello, world” first example. (Preferably, for the very first program, create something simple that shows one or two of Java’s particular strengths.) Say something of the language’s history and its availability as free software. Offer a prediction of the role that it may play in future. Mention installation, including how to get detailed explanations of installation on the various operating systems.
Demonstrate how Java programs implement the “write once, run anywhere” principle. Discuss limitations in Java’s operating system agnosticism.
Explain how the broadcast course content is substantiated and expanded by additional material on the series web-site. This includes longer and more specialized videos, links to other resources, book-lists, examples and samples, opinion pieces, as well as an actively moderated user forum.
Episode 2: First Principles
Overall view of what Java is good for, including its strengths and weaknesses for applications of varying types. Explanation of how a Java program works, from the abstract down to a more nuts & bolts level.
Explanation that, with the possible exceptions of assembly language and (horrors!) machine code, all programming development models have limitations on what they can make happen. There’s no one language that excels at every possible task.
Explain why Edsger Dijkstra warned, “Resist the urge to code.” Emphasize the importance of program design and the value of black boxes. Demonstrate code reusability, even if only briefly. Demonstrate various types of applications that can usefully and reasonably be done in Java.
Episodes 3 - 5: Toolsets, Including Debugging
Explain the sequence of steps in creating a Java program. Explain what the compiler does, and how easy it is to convince it to do it. Explain the simple steps in compiling a program from the command line. Begin with the use of ordinary text editors, show the hilarious consequences of trying to use a word processor, then demonstrate editors specific to programming languages, and finally discuss the various IDEs available for Java. Explain the selection of the IDE which will be utilized in the series. Mention programming style, including where to put them infernal braces.
Discuss importance and value of commenting/documenting (do this throughout all episodes). Finding usable help on the Internet. Explain the value of looking for existing code as the first option and writing it yourself as the second. Explain the moral importance of acknowledging the usage of other people’s code.
Explain and demonstrate debugging. [N.B.: debugging, in one form or another, will be featured to some degree in almost all episodes.] Stress not only the importance of debugging but the critical importance of developing a comfortable familiarity with its use. How to manage solutions on disk, including renaming and relocating them. Yes, good old project management. Good housekeeping as the means of assuring finding desperately needed code fragments written a year earlier. Or yesterday.
How to use monitoring tools, such as VisualVM.
How to use and rely upon the Java API documentation. How to figure out what you need and where to find it. Explain the critical value and importance of good code examples in the documentation. Demonstrate the wonders and joys of code hinting. Caution against blind reliance upon information found on the Internet. Show how to use throw-away code for testing ideas, before incorporating them into the program.
Episode 6: Data Types and Expressions
Explain how Java deals with data types and typing. Show how different data types are used. Explain the value of strong typing, especially in managing the consequences of bad typing. Demonstrate simple bit twiddling. (Honest! This will be needed in later episodes.)
Explain how a LUT can sometimes make much more sense than trying to devise the equivalent calculation. Describe the grammar of Java expressions.
Episodes 7 - 8: Dates, Times, and Strings
Delve into the wonderful world of manipulating dates and times in a programmer-friendly manner and how these data types can be put to good use. Make some sense of the enormous date/time capability added to Java in version 8. Experiment with various types of timers. Begin discussion of strings and what can be done with and to them.
Possibly, construct a tokenizer and store it in a user-defined library. Possibly, construct a password routine with hashcode and store it in a user-defined library. Examine and explain formatting strings for different uses, such as building a CSV line consisting of several different data types for writing to a file. Devise a class with which to convert a decimal value to its full string representation.
Episode 9: Control Structures, Functions, and Modularity
Explain and demonstrate the if statement, the loop, and the switch statement. Explain and demonstrate practical, useful, simple functions. Explain, demonstrate, and emphasize the value of modularity. Show how to divide large programs into smaller and more manageable files. Maybe mention delegates. Definitely cover JNI/JNA for those special jobs that simply must have C or C++ code. (JNI and JNA are important examples of the topics touched on in the broadcast episodes and dealt with far more thoroughly in the extended web episodes.)
Decide if life without pointers is worth living. Indexing through singly- and doubly-linked lists. Explain the difference between passing data into a class method using parameters and passing data into its class via the set accessor. Discuss the economic and practical differences between a ruthless need for CPU efficiency (in which event you might as well learn assembly language and microcode) and the value of programmer convenience and efficiency.
Episodes 10 - 11: Arrays and Collections
Show how useful enumerations, arrays, and collections are and explain the variations in their application to actual situations. Introduce generics. Delve into singly- and doubly-linked lists. Examine stacks and queues.
Episode 12: Is Java O-O?
Discuss and demonstrate the differences between Java and other object-oriented languages. Also, explain how the existence and the use of different programming languages create islands of automation, which limit the utility of applications, e.g. database access dependence upon language-specific drivers. Discuss program design: how to separate that of which the user should be aware from that which should remain hidden, whether user-accessible or user-inaccessible.
Episode 13: Error Handling
How errors are handled in Java programs. Exceptions: where to catch them, when to ignore ’em. Where, when, and how to implement a useful try-catch-finally block. What to do when the program won’t do what it’s supposed to do. The vital importance of meaningful and informative and useful error messages. Finally, the value of turning off the computer and coming back to the problem the next morning.
Programming style. Maintaining usability as the driving criterion; e.g., ignoring silly fads, such as tiny UI buttons that are hard to find and harder to push. The incredibly important difference between user-friendly and user-hostile application design. The incredible importance of not embracing the old UNIX principle, “There are no defective programs. Only defective users.” Avoiding “gotchas”.
The software developer’s moral obligation to her users.
Episode 14: Testing
Explain the importance of thorough testing and how best to do it. Emphasize the relevance of Fisher’s Law. Explain the limitations of home-made programming; e.g., do not write software that provides the primary safety features of a ten-story freight elevator. The importance, in program design, of carefully distinguishing between errors that can be logged and those that require program termination.
Programs that fail gracefully rather than catastrophically. The importance and value of programs that don’t fail at all. Discuss the trade-off between getting the program done quickly and getting it done correctly. Mention the old crack, “If contractors built skyscrapers the way programmers build software, the first woodpecker to come along would destroy civilization.” The priceless value of finding one’s own Brenda – an employee or acquaintance with a special knack for wrecking applications, capable of finding almost any program flaw by ignoring instructions, misunderstanding screen prompts, and doing anything and everything wrong.
Episodes 15 - 16: Concurrency
How to use threads to do things concurrently, and how this does not necessarily mean true fine-grained parallelism or multi-processors. How to increase the probability that the application will utilize the SMP resources that may be available. Discuss right and wrong application of threading. Show how to make a program run as a service. Explain how some applications benefit from threading while others require a single-threaded event loop.
Episodes 17 - 21: The Java Library
Introduction to how Java uses the Java Class Library to make functionality available, with mention of the differences between the Java model and how it’s done in C#, C++, and other widely-used languages. Application of various library features, emphasizing those most useful to and usable in the kinds of programs that viewers will likely chose to write. Knowing which to use and which to ignore: the ample size of the cookie jar does not mean that the programmer should grab all the features and capabilities that she can.
What’s needed to accomplish the task at hand, and no more than that. Building and using one’s own library of classes. Working examples of using library assets. How to package everything up for deployment of the finished application. The means of protecting proprietary IP.
Episodes 22 - 26: File and Other I/O
Examining and manipulating directory structures, including creating and deleting directories and subdirectories. Examining and manipulating files, including creating and deleting all file types. Saving program state between invocations. Writing to and reading from all types of file, including emphasis upon dealing with access errors. Using temporary files; emulating the .NET isolated storage concept. Briefly, shared memory techniques: good idea, or bad?
A quick look at networking, including websockets, shuffling data packets around the LAN, and rudimentary TCP client-server applications. Performing UDP data exchange. Playing with a simple checksum algorithm. Discussion of when a program needs to generate network traffic, as contrasted with simply accessing a network logical drive.
Episodes 27 - 31: Databases
Introduction to why databases are useful, including the range of technologies they cover, from single flat files all the way up to forty-billion-record distributed systems running on server farms. Installing the PostgreSQL database server. Creating and managing simple SQL database applications. Writing a Java program to populate a sample database with records resembling something that might be found in a typical business application.
Translating program data types to database data types and back again. Deciding between views and stored procedures for repeated tasks. Writing and working with a Java program that utilizes a database in a rudimentary but nonetheless practicable residential/commercial/industrial building automation system. Guest lecturer(s), explaining MySQL and PostgreSQL. (Possibly SQLite, HSQLDB, Derby/JavaDB, or another one, instead; it will depend upon the willingness of DB vendors to participate.)
Episodes 32 - 37: Graphics and UIs
How to create a practicable, attractive, simple user interface for the typical real-world program. How to appreciate that not all programs need or benefit from a flashy graphics-rich user interface. Remember, boys and girls, the command line is your friend.
Consider the difference between easy-to-use, user-friendly UI design and the trendy but foolish fads that come and go. Did we mention those nasty little buttons that are so small that even finding them on the screen is a challenge? How to bind the UI elements to their corresponding data entities inside the program logic. An introductory look at event handlers. How to create and use screen graphics, including images, audio, animation, and other presumably useful effects. How to resist the temptation to use far too much of these gimmicks. How to save program and UI configuration data between invocations. How to create graphics primitives to use in printing.
Episodes 38 - 39: Printing
How to create a printed page and populate it with data from variables. How to connect the page to program logic and data. Pagination and other flow control factors. Responding to feedback from the selected printer, such as dealing with paper jams and paper-out conditions. Condi-tionally printing in color.
How to create a practicable, attractive, simple printed page layout for the typical real-world program. Print graphics using primitives. Writing classes particularly suited to modification for reuse.
Say goodbye to the audience and urge them to encourage their local public television stations to carry subsequent series of The Art of Programming.