Monthly Schedule

(Introduction to Programming Languages, Period D)

M 5/2/011

No class.

 

T 5/3/011

HW due:

1. Read Chapters 7, 8, and 9 (pp. 63-86). Although this is a long reading assignment, please note that most of the material is review, since most of it describes language features you have already worked with in Java, Python, or both.

2. Reread §7.6 (pp. 67-68), paying special attention to what the author has to say about memorized knowledge versus algorithmic knowledge. Do you agree with what he has to say about the pointlessness of spending years in school learning to execute algorithms? Write a thoughtful, original paragraph. If you feel that the study of algorithms is pointless (for example, learning how to add fractions, or learning how to perform long division), what would you propose as an alternative?

3. Write Exercise 7.2 on p. 67. You cannot use the math.sqrt function for this exercise, nor can you use the ** operator, which performs exponentiation, since if you could, the square root of 7 would be easily found by typing either

     import math
     print math.sqrt(7)

or

     print 7**.5

4. Save the file mobylist.txt to your hard drive, and make sure it is in the same folder that you are using to save your Python programs.

5. Create a new Python source file (File / New command on the menu), and enter the following lines in it:

     myfi=open('mobylist.txt')
     print myfi

When you press F5 to run your program, the result should be a line similar to the gobbledygook shown in the middle of p. 81. Then issue the line

     print myfi.readline()

several times. If you count the line for aa (a type of lava) as line 1, then on what line does the word aardvark appear in the Moby word list?

6. Write Exercise 9.1 on p. 82, using mobylist.txt instead of words.txt. If you wish, you can use the snippet

     k=myfi.readline()

     if len(k)==0:

         print '--END OF FILE--'

         break

so that your loop exits cleanly when the end of file is reached. (Otherwise, your program may hang, requiring you to press CTRL+C to terminate it.)

 

W 5/4/011

HW due: Write Exercise 9.5. This is a medium-difficult exercise. If you cannot solve it, you will be expected to show at least some pseudocode and/or a flowchart to document the ideas that you explored. Steps must be clearly described. For example, you will earn no credit with a flowchart like this one:

 

Why not? Why does this flowchart not qualify for points? The reason is that it has not added any value. It would be like saying, “I have an idea for a great app to run on the web. It would be really cool, and everyone would want to join it. The steps are (1) I write the app, (2) everybody signs up, and (3) I become as rich as Mark Zuckerberg.” Unless you flesh out the idea a lot more than that, you don’t really have an idea that is worth anything, do you?

 

Th 5/5/011

Test (100 pts.) on all recent material. Test will be held in LJ-302, not our usual classroom.

Format of the test will be as follows:

60 pts. for vocabulary (similar to last week’s quiz) and facts from class discussion
40 pts. for 4 code snippets (10 pts. each)

At least one of the code snippets will be a translation from Java to Python, and at least one will be a translation from Python to Java. You can practice by reviewing your old HW and simply translating from one language to the other.

The remaining code snippets will be in Python. When writing your Python code, you must show indentation clearly. Minor syntax errors, as long as there are not an excessive number of them, will not count against you.

One code snippet will probably consist of either an obfuscated block of Python code or an awkwardly or inefficiently written block of Python code, and your task will be to rewrite the same functionality in a better way.

 

F 5/6/011

HW due: Redo yesterday’s test (the entire test, even the parts that you know you did correctly). You may consult Internet resources, your textbooks, and the Java and Python compilers. You may even consult other people, provided you document that interaction. A score of 100% correct is expected for the HW assignment. You may write directly on a printed copy of the test.

 

M 5/9/011

No class.

 

T 5/10/011

Class held in LJ-302 again today (last-minute switch).

No additional HW due. That’s right! You have a rare weekend with no IPL assignment. Yippee!

In class: Moore’s Law, logistic growth (“S” curve), exponential growth (“J” curve), exponential decay (“L” curve), ICs, LSI, VLSI, and much more. If you missed class, be sure to get notes from someone who attended.

 

W 5/11/011

HW due:

1. Skim this helpful blog on the subject of getting started with Objective-C. Do not install anything just yet.

2. Next, visit the GNUstep download page and download the following 3 packages in the order listed:
        GNUstep MSYS System, version 0.28.1
        GNUstep Core, version 0.28.0
        GNUstep Devel, version 1.3.0

3. Install those 3 packages, in the order listed, by running the .exe programs that you downloaded. Accept all the default settings (installation directory of C:\GNUstep, etc.), except that you should click the checkbox to choose the “Windows theme” at the end of the second installation, the GNUstep Core.

4. After installing those 3 packages, in the order listed, go back to the blog (step 1). Try to create and run the “hello world” program, main.m, using the instructions provided. This is a little bit tricky, but please give it a good try, since following instructions like this is part of what Real Computer Guys (RCGs?) have to do all the time. If you fail, don’t worry too much, since this is where we will start at the beginning of class Wednesday.

 

Th 5/12/011

HW due:

1. Follow the instructions in the technical blog (see yesterday’s calendar entry) and the instructions given in class yesterday in order to get your helloworld.exe program to run. Note that helloworld.exe is a Windows executable file that lives in the /mingw/emh_sw directory (or /mingw/chase_programs, or /mingw/tommy_programs, or whatever you called your playpen directory).

Helpful hint: Yesterday, we deduced that /mingw in the GNUstep shell is equivalent to C:\GNUstep in Windows, but not C:\GNUstep\GNUstep, which is something else.

2. Then, go back to the blog and follow the instructions to revise main.m and create the GNUmakefile (note that there is no extension).

Important notes:

If you use Notepad as your editor, you will need to remove the .txt from the file name.

Be sure to save GNUmakefile in the same directory in which you saved main.m.

3. From the shell, use the cd /mingw/chase_programs command (or whatever you called your playpen directory), and then issue the

make

command. You may have to do this more than once. If all goes well, an obj subdirectory will be created (in the shell, use the
cd obj command to get there). Then type

TestApp

to run your first Objective-C application. Good luck! Keep tinkering and trying if the first try fails (as it probably will)!

 

F 5/13/011

HW due:

1. Please finish yesterday’s assignment. Send e-mail to Mr. Hansen if you are still stuck.

2. Set aside at least 35 minutes to start reading the following documents from the Apple developer library:
        Object-Oriented Programming with Objective-C
        The Objective-C Programming Language

3. In your reading notes, focus on jotting down new terminology and questions you have for Mr. Hansen. This is difficult material (despite the claim that Objective-C is a “simple” language, asserted in the introductory paragraphs of both documents), and it is intended for professional developers who are contemplating writing apps for Apple’s platforms (e.g., iPhone, iPad).

 

M 5/16/011

No class.

 

T 5/17/011

No additional HW due.

In class: Guest speaker, Mr. Ron Packard of K12.com, will discuss the future of education in America.

 

W 5/18/011

Before school: JBAM competition.

HW due: Skim §01 and §02 of this online document; then read §03 and §04 with more care and attention. Reading notes are required, as always.

 

Th 5/19/011

Save the date! Field trip to the NSA’s National Cryptologic Museum, Fort Meade, MD. Bus will depart at 8:00 a.m. and will return shortly before 1:00 p.m. If you attend, you will be excused from periods A-E and the first half of F period. If you do not attend, there will be a worksheet for you to work on. (See 5/20 calendar entry below.)

School dress is required, but you may leave your blazer on the bus during the tour if you wish. Snacks are available from vending machines at the museum, and a few snacks will be provided by Mr. Hansen.

Schedule at the museum:

  0900-1020 Museum tour
  1020-1040 Snack break
  1045-1155 Lecture/workshop conducted by a mathematician from the NSA (“MAGIC” conference room)
  1200 Bus returns to STA

 

F 5/20/011

Before school: BIG TRIG competition.

HW due (only for those who did not attend the field trip): Answer ANY FOUR QUESTIONS from this scavenger hunt. Ignore the Form III/IV/V/VI markings.

In class: The Chasm Problem.

Chasm Problem (adapted from various sources): Tim, Fred, Twiggy, and Warren are members of a band. (In the original problem, the band was U2, and the members were Bono, the Edge, etc.) The objective is to cross a dangerous chasm at night on a rickety suspension bridge that will support no more than 2 people at a time. Because the bridge is so rickety, a flashlight is required at all times by people on the bridge. There is only one flashlight, and the flashlight may not be shared by more than 2 people. When 2 people travel together, their time to cross the chasm is determined by the slower person. Travel times are as follows:

Tim = 10 minutes
Fred = 5 minutes
Twiggy = 2 minutes
Warren = 1 minute

Objective of the Problem: Find a way to get all 4 band members to the opposite side of the chasm in 17 minutes or less. This can be done, but you have to be systematic in your problem solving. There are no “tricks” like juggling, splitting people in half, throwing the flashlight, etc. This is a straightforward problem that many if not most “muggles” cannot solve, because they are unwilling to invest the systematic effort in evaluating all the possible solution candidates.

 

M 5/23/011

No class.

 

T 5/24/011

HW due: First, read this handout on forward and backward chaining. Then, show how backward chaining and general problem solving strategies can explain the process of finding a solution to last Friday’s chasm problem. Your writeup should satisfy the following requirements:

1. Develop a notational system for showing clearly what occurs during a chasm crossing and for keeping track of the cumulative time spent. Do not assume that your notation is clear to other readers! Many of the notational systems students used on Friday were so cryptic that they would have been intelligible only to the student who made the markings. A compact notation is desirable, but clarity is also required. Some words of explanation are probably going to be necessary for your notation.

2. Complete sentences and a neat presentation are expected.

3. There is no credit for excessive verbosity, but be sure to write enough words to make the meaning clear.

4. Be sure to explain exactly why it is that Tim and Fred must make a trip together. (Hint: Think of proof by contradiction, which you learned in geometry class.)

5. Then, explain how to use backward chaining to leverage the “theorem” in #4 into a full solution to the problem.

6. Be sure to prove that your claimed solution actually works.

7. A correct solution that is lacking in clarity will not earn full credit.

 

 


Return to the IPL Zone

Return to Mr. Hansen’s home page

Return to Mathematics Department home page

Return to St. Albans home page

Last updated: 24 May 2011