programming languages
Programming languages, styles, and concepts exams
for Ambrose Sterr, Spring 2007
by Jim Mahoney, Marlboro College
Rules of the road:
Pretty much like the first one. You have a week.
Online or text sources are OK as long as they're fully credited.
The point of the exercise is to convince me you understand the concepts,
not just to spit out a correct answer.
Assigned on Tues April 10.
Due midnight Tues April 17.
Good luck.
-----------------------------------------------------------------
1. Write two versions of the following program, in two different
computer languages of your choice. One version should be in
an object oriented style, and the other should be in a functional
style. For each, include documentation and tests appropriate
to that language.
The program should read in a "family tree" from a text file.
The input file should have a form that looks something like
name: Tom Jones
id: 12338
born: 12/10/2004
died: -
dad: Fred Smith (71882)
mom: Irene Smith (12334)
name: Fred Smith
...
Feel free to alter this file specification as you see fit;
the basic idea is to have a geneology tree structure of people.
Make up some data to stick in it with at least 10 individuals
and 3 generations.
The program should output a summary of the data (at least the
number of people, the oldest and the youngest) as well as either
a) answer simple queries ("Who is the father of Tom Jones?") or
b) create an image (.png file, say) of the entire family tree,
with lines from parents to offspring.
You do *not* have to try parse the english syntax of the queries;
either use a menu of choices or specifiy a few types of queries
and use simple pattern matching or key words; your choice.
The point here is as much to contrast the two programming styles
more than it is to create the ultimate family tree application.
I've left several of the design decisions up to you in order to let
you choose things that are simple for you to implement, not to
suggest that you need to spend days adding features to impress me.
Feel free to use any helpful library, package, or graphics
utility you wish, as long as you document where it came from.
2. These days computer languages come in a bewildering variety
of sizes, shapes, and colors. Some of the concepts used to describe
them include
* "low" level * "high" level
* "compiled" * "interpreted"
* "object oriented" * "functional"
* "imperitive" * "procedural"
* "serial" * "parallel"
* "open source" * "cross platform"
(Feel free to use wikipedia.org or other comparable source to
see the customary definition of any of these terms.)
Use these notions and whatever else you deem worthy
to compare and contrast at least the following lanuages :
Java, Perl, C, MIPS, JavaScript, PHP, Basic
(This isn't a random list, obviously - I've chosen the ones we've seen,
and/or I know that you've used, if only in passing.)
In your discussion, included what these languages are used for and why,
and which ones you particularly like or dislike, and why.
3. Re-write any one of the programs from the 1st two exams using
a different language and a different programming paradigm.
For full brownie points, use a language that you didn't
use in question 1.
Notes and pointers