M/F 2:30-3:20 |
CS 1130: Transition to OO Programming Spring 2016 |
Main
About: Overview Announcements Staff Consultants Calendar Materials: Texts DrJava Terminology Lectures: In-Class Web-Based VideoNote Assessment: Grading Assignments Labs Resources: CMS Piazza (link) Piazza (about) Java API Style Guide Academic Integrity |
Module 1.1. Structural versus Algorithmic AspectsOverviewThere are two major aspects of a programming language:
You can make an analogy to a cookbook. Each recipe is a sequence of instructions to carry out in order to cook something. This is the algorithmic aspect. The recipes may be organized in chapters —appetizers, entrees, desserts, breads, etc. Each chapter may be further subdivided into sections. This is the organizational aspect. In a programming language, the algorithmic aspect has to do essentially with sequences of assignment statements, conditional statements, loops, and procedure/function calls. When programming languages were first invented —starting in the 1950s with Fortran and moving on to Algol, Lisp, and Cobol about 1960— the major organizational tool was the subroutine (known today as the function, procedure, or method), which corresponds to a recipe in a cookbook. To add more function to a program, one added more subroutines, each of which did its own thing. This rather flat structure did not and does not scale up very well! Software systems consisting of hundreds or even thousands of subroutines were hard to manage and maintain. Yet, the subroutine continued to be the main structuring mechanism in popular programming languages well into the 1980s. Various other organizational methods were developed. Many of these were organized around modules, which could contain collections of subroutines and other things. But the organizational method that has had the most success is object-orientation, or OO. The basics of OOHere's an analogy that will give the basic ideas of OO. A typical office has filing cabinets. Each drawer contains a bunch of manilla folders. The folders in one drawer have exactly same kind of information. They contain data (e.g. a person's name and address, the amount of money they owe). In addition, for OO, they contain instructions (called methods) for carrying out operations on the data —changing the data, checking the data, performing calculations. Because the instructions have been placed in each manilla folder, anyone in the office can do any job. In OO, each file drawer is called a class, and each manilla folder in the file drawer is called an object of the class. In addition:
Now you know some essential features of OO. This course CS1130 shows you how these features are realized in the programming language Java. History of OOOO has its roots in the language Simula 67, which was developed in the late 1960's. But what was attempted at the time was not fully understood, and its ideas did not catch on. This happens often in science and engineering. Here are other examples. Charles Babbage conceived of computers and designed and tried to build some in the mid 1850s. He didn't have electricity! But the first working computers weren't constructed until the 1940s. SmallTalk-71 was developed to try out "message-passing" ideas that were in Simula 67, and further explorations were done throughout the 1970s, all at the Xerox Palo Alto Research Center (PARC). In the early 1980's, SmallTalk-80 was shown to the world, and interest in OO grew, leading to OO being incorporated into other languages. The language C++, for example, is an OO-version of C. Today, OO appears in some guise in a number of languages, like Eiffel, C++, and, of course, Java, to name just a few. Don't expect OO to look exactly the same in all OO languages, but the basic ideas are the same. |