Topic | Name | Description |
---|---|---|
Course Syllabus | ||
1.1: History and Motivation | These articles give some insight into the early history of computers, and introduce the powerful ideas that enabled the computer architecture of our day and that will influence computer architecture of tomorrow. |
|
Read this article to supplement the previous articles. As you see here, the history of computers is split into "generations". This course will primarily focus on the third generation of computers, which began in the 1960s, and the microcomputer technology of today, which has meant that computers are now present in the homes of many people across the world. |
||
Lest you get the impression that computers are a new phenomena, this short article demonstrates that computers, in one form or another, have been around since at least 18,000BC. |
||
This article focuses on the evolution of programming languages over the years. How did programming languages change as the "generations" of computers advanced? |
||
1.2: Reflecting Human Thought via Computers | Aristotle lived in ancient Greece around 384-322 BC. He is credited with the invention of a field of philosophy called "formal logic". This is a way of thinking that only admits to something being absolutely true or absolutely false. For instance, an item is in one group or some other group but it can not be a member of more than one group at a time. Everything is black or white. There are no shades of gray. You may have heard this called "binary thinking". However, it is perfect for computers because computers are nothing more than black boxes filled with on/off switches that are either completely on or completely off. As such, there is nothing new about computers as we know them today. They simply allow us to mechanize complex constructs in formal logic, and to do so at very high speeds. Gottfried Leibniz (1700s) created a means of using binary values to perform arithmetic. Essentially, this is the translation of our usual Base 10 numeric values to Base 2 (binary) values, and the means to perform arithmetic operations on such values. George Boole (1815-1864) invented Boolean Algebra, a mathematical means of expressing and manipulating formal-logic variables using logical operators to get correct results in highly complex situations. So, briefly, you can see the philosophical and mathematical history that underlies modern computers. This history, and the mechanization of that history by computers, allows human thought to be reflected and carried out consistently, although not perfectly. (Computers can not even perform the operation 1/3 with absolute accuracy.) For this introductory course, it is enough to give some thought to formal logic and its basic ideas. Read these two chapters. |
|
Supplement what you just read by reading the first chapter of this book. As you read, you will see the careful human thought that is required to create the logical constructs required to get the computer to do anything worthwhile. Section 1.6 begins the process of creating a formal syntax, or language, from human statements. In this course, we use the formal language Java to translate human statements into something that can be translated into the 1's and 0's the computer works with, the settings of the computer's electronic switches. |
||
1.3: Why Computers and Computer Programming Matter | One definition of innovation is the process by which solutions are created for complex problems. Another perspective sees innovation as creating something entirely new that takes situations and people down a path not previously conceived. Read this section, which discusses innovation and several practical aspects of bringing new ideas to fruition, and demonstrates case studies of successful applications. |
|
1.4: Hardware/Software Model of a Computer | Review these notes. For maximum benefit, go through these notes interactively, thinking about and answering the questions at the bottom of each page. These notes are an experiment in applying the "programmed learning" method to web-based computer aided instruction. The subject is Java Programming for beginning programmers. The content is intended to start beginning programmers out on the track to professional-level programming and reinforce learning by providing abundant feedback. Java is a programming language that is used often in professional practice. |
|
Review these notes. As you work through them, think about and answer the questions at the bottom of each page. |
||
Watch this lecture on binary numbers, which are used to represent numbers in computer memory. In fact, all types of information, not just numbers, but characters as well, are stored in memory using binary bits (that is, digits) of 0 and 1. We still write numbers in our programs using decimal numbers, but the interpreter converts them to binary when it interprets them for execution as part of a machine language instruction (the interpreter interprets the Java statement to equivalent machine language statements). |
||
1.5: The Software Development Lifecycle | Read this brief article about the programming lifecycle. As you read, consider the following steps of the programming lifecycle: Planning and Analysis, Design, Implementation, Testing and Debugging, Deployment, Maintenance |
|
Three major approaches to software development, which are the means of carrying out the programming lifecycle, have been tried by practitioners. This article compares those three. The most used today are Unified and Agile. These processes help to guide software development projects. They are not software development in and of themselves. Always keep in mind that the goal is to deploy excellent software, not to follow processes. |
||
1.6: Overview of Java | This article explains the distinction between compliers and interpreters. It is important that you understand the difference. |
|
Java is both a compiled and interpreted language. What you write as Java code is compiled into machine-independent bytecode. The bytecodes are interpreted for the particular machine the bytecodes are running on. In this way, Java becomes machine independent. Such is not the case for languages like C/C++, where the language code is compiled into assembly code for a particular machine. A linker turns that code into an executable for that machine. |
||
This page shows how to download and install the latest version of the Java Development Kit (JDK). Read the instructions carefully to set the "classpath" mentioned in Step 3. Once JDK has been installed, you can write a simple Java program using an editor such as notepad and run it from a command prompt. Alternatively, Java programs can be written using an Integrated Development Environment (IDE) such as NetBeans, described below. |
||
These instructions describe how to download and install NetBeans, a commonly used IDE for Java programming. Using an IDE means that you have all of the tools you need in one place (your "development environment") instead of having to organize things manually. Use the instructions in Step 2 to write a simple Java program called "Hello.java" and then compile and run it. |
||
Work through these slides. As you read, think about and answer the questions at the bottom of each page. These will be your first experience with Java, so make sure you follow each step closely. |
||
Think of the word that should fill in the blank for each statement. Click on each one to see what the right answer should be. |
||
2.1: Fundamental Concepts of OO Programming | Object-oriented approaches to software development are an important expansion of procedural approaches. Java explicitly supports both approaches, but you should focus on the object-oriented approach. This article compares the two approaches and explains the fundamentals of each. |
|
Read this article about object-oriented programming. Every paradigm has its advantages and disadvantages. OO is the same. |
||
2.2: Using Java for OO Programming | This section explains fundamentals of object oriented programming. As you read, focus on the difference between classes and objects. |
|
This section expands the discussion from objects and classes to inheritance, polymorphism, and abstract classes. These facets of OO programming are a natural consequence of the basic concepts behind objects and classes. |
||
Encapsulation facilitates control over access to components of a class. Read this article to get a clear understanding. |
||
A major principle of OO programming is keeping the implementation of an object separate from manipulation. This article explains how that works. |
||
3.1: Compiling and Executing a Java Program | This chapter provides step-by-step instructions of writing a Java program using a text editor, and then compiling and running this program from command prompt. Several Integrated Development Environments (IDEs) are mentioned in this chapter. We have already installed NetBeans. That and Eclipse are the most popular in Java professional practice. |
|
Use this page to quickly review what you've learned so far. |
||
3.2: Working with Classes | This chapter discusses naming and coding conventions as well as reserved words in Java. When you go through this chapter, you'll get some hands-on experience with writing in Java. |
|
Use this page to quickly review what you've learned so far. |
||
3.3: Importing Libraries | Java classes and interfaces can be organized into packages to group related types and for name-space management. |
|
3.4: Primitive Data Types | This chapter discusses eight primitive data types in Java. |
|
Use this page to quickly review what you've learned so far. |
||
3.5: Basic Operations in Java | Read this introductory article. |
|
Read this chapter, which covers variables and arithmetic operations and order precedence in Java. |
||
Read this chapter, which discusses arithmetic operations in greater detail along with solving expressions with mixed data types. |
||
3.6: The String Class | Read this section, which introduces the concepts of strings using Python. |
|
The String class is used for text manipulation. As you read, you will learn different ways to create Strings, methods to manipulate Strings, the String concatenation operator '+', and about how Strings are immutable. |
||
This chapter accompanies the previous one. Read it for even more info on Strings. |
||
4.1: Relational and Logical Operators | This chapter introduces relational and logical operators. It also discusses the use of these operators to write Boolean expressions. |
|
This chapter goes into more depth about relational and logical operators. You will have to use these concepts to write complex programs that other people can read and follow. |
||
The relational operations on primitive data are ==, >=, <=, >, <, and !=. They compare two data values, when those values' type has an ordering. For example, integers are ordered by size or magnitude. The result of a relational operation is a boolean value: either True or False. The relational operators on objects like Strings are different, and they are expressed as methods. Pay special attention to the equality method, equals(). |
||
Objects that have an ordering are compared using the compareTo() method. |
||
Complete this review exercise. Think of the response to fill in the blank or to answer true/false, or write your response down. Then, click on the box to reveal the answer to each question. |
||
4.2: Truth Tables | Read this chapter, which discusses Boolean variables as used in decision tables. Truth tables are used to collect variables and their values relative to decisions that have to be made within control structures. |
|
Answer the questions in this review. After you have thought of your answer, only then click on the box in each question to reveal the correct answer. |
||
5.1: Introduction to Control Structures | This article gives a general introduction to control structures. |
|
5.2: The 'if' statement | Read this chapter, which reviews how computers make decisions using if statements. As you read this tutorial, you will understand that sometimes it is important to evaluate the value of an expression and perform a task if the value comes out to be true and another task if it is false. In particular, try the simulated program under the heading "Simulated Program" to see how a different response is presented to the user based on if a number is positive or negative. Pay special attention to the "More Than One Statement per Branch" header to learn how the 'else' statement is used when there is more than one choice. |
|
5.3: The 'switch' Statement | Read this chapter, which discusses the switch and '?' operators to write conditional statements. As you read this tutorial, you will learn that sometimes it is better to use a 'switch' statement when there are multiple choices to choose from. Under such conditions, an if/else structure can become very long, obscure, and difficult to comprehend. Once you have read the tutorial, you will understand the similarity of the logic used for the 'if/else' statement, '?', and 'switch' statements and how they can be used alternately. |
|
5.4: The 'while' and 'do-while' Loops | Read this chapter, which explains while loops. This is in contrast to how a do-while loop works, which we will discuss later. In a do-while loop, the body of the loop is executed at least one time, whereas in a while loop, the loop may never execute if the loop condition is false. |
|
Complete the review exercise. Think of the correct response to fill in the blank for each question, and then click on the blank to reveal the correct answer. |
||
The 'do-while' loop is a variation of the while loop. 'do-while' loops always execute at least once, whereas while loops may never execute. |
||
5.5: The 'for' Loop | The 'for' loop is more compact than the 'while' and 'do' loops and automatically updates the loop counter at the end of each iteration. Both 'for' and 'while' loops are designed for different situations. You'll learn more about when to use each later. |
|
This chapter discusses the 'for' loop in greater detail, as well as the scope of variables in the 'for' loop. |
||
5.6: Advanced Topics | This chapter discusses how control structures such as loops and if statements can be combined together to implement program logic. |
|
This article explains variable scope within different control structures such as a block, while loop, and branching statement such as the if statement. |
||
Complete this review exercise. Think of the correct response to fill in the blank, and then click on the blank to reveal the correct answer. |
||
6.1: Creating and Using Methods | We communicate with objects using methods. Methods are executable code within each object, for which an interface has been established. Sometimes the interface is only for the object itself. Other times it is an interface accessible by other objects. This chapter discusses that topic in detail. |
|
Threads may be seen as methods that execute at "the same time" as other methods. Normally, we think sequentially when writing a computer program. From this perspective, only one thing executes at a time. However, with today's multi-core processors, it is possible to literally have several things going on at the very same time while sharing the same memory. There are lots of ways that this is done in the real world, and this chapter goes over them in a way that you can apply to your own projects. |
||
6.2: Overloaded Methods | This chapter reviews method parameters and local variables, as well as method overloading and method signature. Method overloading means two or more methods have the same name but have different parameter lists: either a different number of parameters or different types of parameters. When a method is called, the corresponding method is invoked by matching the arguments in the call to the parameter lists of the methods. The name together with the number and types of a method's parameter list is called the signature of a method. The return type itself is not part of the signature of a method. |
|
Complete this review exercise. Think of the correct response to fill in the blank, and then click on the blank to reveal the correct answer. |
||
7.1: Introduction to Arrays | This chapter introduces arrays, a common multi-dimensional data structure used to store data of the same type. (Note that a class is a "data type" in this sense.) Arrays have some number of dimensions and a number of elements in each dimension. These are established when the array is created. The range of the array's index in each dimension goes from zero to the number of that dimension's elements minus one. A for loop is commonly used to initialize, manipulate, and access the values in an array. Here, we treat one-dimensional arrays, sometimes called vectors. |
|
This tutorial gives more examples of how to create, initialize, and access one-dimensional arrays. It also briefly illustrates the use of arrays to reference class objects. |
||
7.2: Two-Dimensional Arrays | This chapter expands our discussion on one-dimensional arrays to two-dimensional arrays. A two-dimensional array is a data structure that contains a collection of cells laid out in a two-dimensional grid, similar to a table with rows and columns although the values are still stored linearly in memory. Each cell in a two-dimensional array can be accessed through two indexes that specify the row number and column number respectively. Like s one dimensional array, the range of each index is from zero to the size of the row or column minus one. A nested for loop is commonly used to initialize, manipulate, and access the values in a two-dimensional array. |
|
We can expand the whole idea of arrays to multiple dimensions, beyond one or two dimensions. Read these sections to see how this is done. |
||
7.3: Common Array Algorithms | This chapter discusses how a for loop can be used to iterate over the elements of a one-dimensional array. In addition, it also discusses enhanced for loops. The chapter demonstrates the use of arrays to solve common problems such as finding sum, average, maximum, and minimum values of numbers stored in array. Pay attention to some of the common programming errors one can make while using arrays. |
|
Read this chapter about lists and the useful methods that are available for adding and inserting elements into a list. |
||
Study this program to get a sense of how to manipulate two-dimensional arrays. |
||
8.1: Input/Output in Java | Java provides a Scanner class to facilitate data input/output. In this section, you will learn about the Scanner class that is used to get input from the user. Java also defines various methods from the Scanner class can convert user input into appropriate data types before conducting any operation on the data. |
|
Complete this review exercise. Think of the best response to fill in the blanks for each question, and then click on the blank in each question to reveal the correct response. |
||
Read this article to learn how to format your output for specific purposes. |
||
Read this tutorial. |
||
8.2: Writing Data to a File | This chapter explains how input and output streams can be used for writing files, similar to how they are used for writing to the display. |
|
This chapter explains Java's FileWriter class and how you can use it to store data in files. |
||
8.3: Reading Data from a File | This chapter discusses Java's FileReader and BufferedReader classes in detail. FileReader and BufferedReader classes are used together when reading data from an external file. The use of the BufferedReader class allows data to be buffered as it is read from a file before manipulating it. The readLine() method of the BufferedReader class reads a line of text from a character-oriented input stream, and puts it into a new String object. |
|
8.4: File Input for Method Arguments | Section 4.6 describes and illustrates how to get the values of method arguments from a file. |
|
8.5: Handling Exceptions | It is not a matter of IF but WHEN things will go wrong in a computer program. Sometimes there are bugs, errors of one form or another. There also also unforeseen use cases. You can never assume a computer program is perfect. Exception-Handling helps us to catch erroneous events and devise means of correcting them. We discuss this topic here since exception-handling can take more code than should be put into the main line of execution. In such cases, a method in an exception-handling class should be called. Exception handling mechanisms allow a program to continue executing, instead of terminating it abruptly, even if an error occurs in the program. |
|
Study Guide | ||
Course Feedback Survey |