University of Chicago, CS 102, Spring 2006, Notes 1

toc  |  next


Welcome!

Thanks for coming. The title of this course is

Introduction to Programming for the World Wide Web
(HTML, CGI and Java) II

It is somewhat unfortunate that CGI is in the title of this course, because we won't be doing any CGI per se. We will, however, be using techniques that are functionally equivalent to CGI. It turns out that the University of Chicago does not allow a course title to be changed unless the course number is also changed. So for beaurocratic reasons we are stuck with this exact course title, even though it doesn't quite fit.

But never mind -- let's talk about the content of this course in plain English.


Web applications are everywhere, and they're awesome.

There are web applications pertaining to every aspect of life on Earth. Whether you are a scholar, a doctor, a lawyer, an artist, an activist, a sports fan, a shopper, some guy who needs directions to the airport, or anything else, there is a web application for you. Some notable websites include the following:

But, of course, one web application stands head and shoulders above the rest. Putting aside any and all false modesty, that would be my tic-tac-toe game [note: doesn't work on most platforms].

Most of the sophisticated websites in the list above are database-driven websites. Essentially, they consist of a database and a bunch of computer programs that interact with that database, to extract information from it, change data in it, add data to it, and present the results of these transactions in some meaningful way to users.

Some web applications aren't built on databases, because there is no persistent information associated with them. Examples of such non-database-driven websites are my aforementioned tic-tac-toe game, and another gem of which I happen to be the author, this redoubtable kilometers to miles converter. Neither has any "persistent state." They do a quick, lightweight computation or set of computations and send you on your way. Mortgage calculators are of the same ilk.

Wikipedia, by contrast, has nothing but persistent state. The only reason you go there is to look things up in a database that amounts to a gigantic encyclopedia. Google, Amazon, IMDB, The New York Times, the OED, and countless others are similar: they provide interfaces to veritable treasure troves of persistent information.

What you will learn in this course is, step by small step, how you might go about building database-driven web applications. Your work will culminate in a final project. You must do your own final project: no teams. My universal suggestion for your final project is simply this: take the thing you are most interested in and build a database-driven website about it. Having said that, you will not be required to build a database-driven website for the final project. You may also build something more "purely computational." We will of course discuss the final project in greater detail in a few weeks.

In order to build such a site, you will need to know how to build a database and how to write computer programs. You will also need to know a bit of HTML: either you know it already, or you can pick it up easily. This is not an HTML course, and you will not be drilled on it; if you don't know it, you will need to take the lion's share of the initiative to learn it yourself.

Here are two maxims which I will state without proof. I leave it up to you to either reach agreement with them or not based on your future experience.

Maxim 1 Whatever your interest, profession or field of study, there is a non-existent database-driven website that would in some way profoundly improve the quality of your life.
Maxim 2 If your website isn't database-driven, it should be.

Of course it is a long journey to go from where we are now -- not necessarily knowing any programming -- to building fancy webapps, and we will of necessity proceed one small step after another. I will do my best to make it a bearable climb, but a climb it most certainly will be.

And so, on to the two principal topics in this course: databases and programming.


Databases are collections of information.

Databases have countless analogues in the non-digital world. When you hear database, think dictionary, encyclopedia, catalog, library, or something similar.

There is a whole theory and field of study around databases. It is by all means a deep and fascinating subject in its own right, and you could make a career out of studying it (many have). In this course, you will learn just enough about databases to be able to build and use simple ones. This will come in the second part of the course.


Programming is the practice of taking a thought process and formally encoding it so that a machine can carry it out.

We will spend the first part of the course learning about computer programming. If your website is going to be anything other than a piece of fixed, unchanging content, you will need to be able to write computer programs.

You write programs in a programming language, in the same way you write letters to your Mom in whatever language you write letters to your Mom in.

One programming language, among the thousands of programming languages currently in use, is Java.

Java is one of the world's most widely used programming languages. If you were to seek a job as a computer programmer tomorrow, you would most likely be expected to know how to write Java programs. Java is a good language for writing web applications: there are many Java tools that are built specifically for the web. But we will get nowhere talking about Java in principle -- it's way too abstract. We'll start talking specifics very shortly.

Programs model the world.

Computer programs take some phenomenon in the real world, model it, and simulate it.

For example, a program that adds numbers is modeling the phenomenon of throwing two known-sized heaps of things together, and counting the number of things in the resulting combo heap. This is to say, adding integers models situations like this: some guy has seven apples, and some gal has four apples, and they put their apples in a big pile consisting of, you got it, eleven apples. If the guy and gal carried out the same action with seven and four pencils instead of apples, the numerical aspect of the event would be unaffected. In fact the notion of addition of integers is simply an abstraction of all such events such that only the quantities of things are concerned and not the things themselves.

But that's perhaps a bit of mind-bender. Consider a student information system like cMore. The cMore application contains models of the students at the University of Chicago, and models of the various courses and instructors and professors at the school, and models of the way those things are related. And the models of course differ from the things themselves: there is a model Adam Shaw in there, with the qualities of Adam Shaw that are relevant to the system (my name, social security number, and so on), as well as there are little models of all of you. If fact, those little model students are attending a model class with model me teaching as we speak, although it's not a very interesting class, since the only things that happen there are the enrolling and the grade-getting. All the interesting stuff happens up here in the real course.

Different programming languages have different ways of modeling the world. Some programming languages are what are known as object-oriented programming languages. Java is an object-oriented programming language. Other families of programming languages include functional languages, declarative or logic languages, and imperative languages. What all programming languages have in common is that they all allow users to perform computations. A computation is, roughly, something like determining whether a number is prime or not. HTML is not a programming language since it doesn't allow you to do any computation: it only allows you to format documents.

toc  |  next