Why Study Arrays Before ArrayList

Which should we study first: arrays or Array Lists? This is a huge issue at this point.

The array structure will be found in early languages as a structure for storing a lot of data in an organized way that makes it easy to access and process that data. However, an array is just a structure. The accessing and processing of data in an array requires code that is independent of the array itself. Such code must be written anew each time that an array is used in a program.

An Array List is a class in Java which combines the array structure with standardized methods that are used to access and process the data in the array ... more correctly now referred to as the "Array List". This bundling of a structure with methods is the OOP way of doing things. Being OOP, objects of "Array List" are created and implemented by reusing the methods of the Array List class.

Experience has persuaded this teacher (Gerry Donaldson) that an Array List cannot be fully and adequately understood without understanding how to process arrays independently of an Array List class.

The Horstmann text that this course uses moves very quickly, far too quickly, into Array Lists. I draw upon the experience of using this material (chapter 8) with students. It is my observation that students typically experience frustration early on because they start using the Array List class before they achieve a high comfort level with using the array structure by itself, independent of an Array List class.

The array structure is arguably the single most important data structure in programming. It can be useful if not essential to efficiently implementing many (maybe most) algorithms. A student who can effectively implement algorithms using arrays has the skills to solve most if not all programming problems solvable with a programming language. Arrays are really that important.

This high importance of arrays to problem solving combined with knowing that arrays are useful to implementing most algorithms suggests to me that they ought to be studied in considerably more depth before using an Array List class than indicated by many OOP first texts, including Horstmann's BIG JAVA. Ideally, therefore, in my opinion, students ought to get well practiced in applying the array structure to the implementation of a variety of algorithms before learning the Array List.

It is for two reasons then that we shall firstly study arrays by themselves and then, secondly, study the integration of the array structure together with methods for accessing and processing the arrays as implemented in Java's Array List class.

  1. We must alleviate the frustration that students historically suffered by being asked to use Java's Array List class before they achieved a high comfort level with manipulating arrays independently.

  2. Arrays may be the single most important structure for implementing algorithms in programming. There is a high correlation between the ability to inspect and manipulate data in an array structure and performance in effectively and efficiently applying algorithms to problem solving in a programming language.

The Kjell Tutorials present the basics of learning about arrays and how to implement them without an Array List class in one of the most effective learning formats that I have ever used with students. The format used by the Kjell Tutorials is simple, straight forward, and extremely effective, perhaps because it is so very simple to follow. It is quite simply a "page turner". On one screen we find some theory and perhaps an example presented. At the bottom of the screen a question is asked. The answer to that question is at the top of the next screen, followed another small chunk of theory and yet another question at the bottom of that screen. Each "chapter" consists of about 20 such screens followed by a set of 1-6 exercises, the solutions of which closely resemble small variations from code presented in the chapter. I have not yet found a student who cannot learn by using this extraordinarily simple approach.

Students will now proceed to do the Kjell chapters on arrays.


URL:   http://www.comscigate.com/    Last Revised:  February 4, 2006