There's no programming at all on this assignment. It's a combination of web research (for two problems), creative thought, pondering, and a little writing.
For each problem you are to answer via a plain ASCII text file. Use an editor like Sublime, Vim, Emacs, Notepad++, etc. DO NOT submit Word documents, PDFs, Rich Text files, HTML documents, etc. As a .txt
files should look perfectly fine when displayed with cat
on lectura, and the file
command should show them as "ASCII text
" or maybe "ASCII English text
", or something similar.
The javarepl.txt
and quickrepl.txt
problems rely on exposure to a "REPL", which we'll encounter in the form of ghci
in our second class meeting.
Important: You'll be using a Bash script on lectura to turn in your work. I recommend you give the submission process a try well before the deadline, in case you have trouble with it. See turning in your work.
morefacts.txt
When covering slide 26 in the intro set I said a sentence or two about various languages of historical or current significance. For this problem I'd like you to find three languages that are not mentioned on that slide and tell me a sentence or two about each.
I'll compile all the answers and post them on Piazza. Follow this format for your answers:
cat
to display my morefacts.txt
and then wc -l
to demonstrate it's only three lines:
% cat morefacts.txt Ada 1980: The DoD's attempt to have one language for military embedded systems, instead of 450. -- William Mitchell Java 1995: The most rapidly adopted language of all time. In Spring 1997 I gave one lecture in 372 about Java as a rising language; by Fall 1998 it was being taught in 127A. -- William Mitchell Scala 2003: Proof that Germans should stick to beer and BMWs. -- anonymous % wc -l morefacts.txt 3 morefacts.txt
Feel free to use Google, Wikipedia, etc., for research on this question but needless to say, no posts anywhere soliciting ideas.
Above I say, "the year it appeared" but that's often subject to debate. Feel free to believe Wikipedia or go with other sources.
Just to be clear, you may use anonymous attribution to keep your classmates from knowing you wrote a particular entry but what you submit must be original, not something you found on the net.
jp.txt
Slide 37 in the intro set raises the idea of the philosophy of a language. In a nutshell, I think of the philosophy of a language as what the language treats as important, or not. For this problem I'd like you to identify three elements of the philosophy of Java.
For this problem it's fine to brainstorm with classmates and friends, Google for "what is the philosophy of java", etc., but what you submit must be stated in your own words.
A piece of "low-hanging fruit" in Java's philosophy that I'm hereby prohibiting you to use is support for object-oriented programming. If it were not prohibited, here's what you might have said about that element:
Java supports the object-oriented paradigm by providing classes and inheritance. The "abstract" keyword allows classes and methods to be marked as abstract. The "static" keyword, although poorly named, supports the concept of class variables and methods.
whysomany.txt
As we discussed in our first class meeting, thousands of programming languages have been created and hundreds are currently used. Why do people keep creating programming languages? Cite three things that you believe motivate the creation of new programming languages.
For this problem it's fine to brainstorm with classmates and friends, Google freely, etc., but what you submit must be stated in your own words.
negative.txt
Java's String.charAt()
method allows strings to be indexed from the left end of the string but not the right end of the string—s.charAt(0)
is the first character, but we need to write something like s.charAt(s.length()-1)
to get the last character. In contrast, many languages interpret negative string indices as being right-relative: -1
is the last character, -2
is next to last, etc.
For this problem you are to imagine you're designing a new language and you are currently considering whether to support negative indexing for strings. Present an argument that's either in favor of negative indexing, or against it.
javarepl.txt
www.javarepl.com
is a web-based REPL for Java.
Spend a few minutes experimenting with it and write a few sentences about it.
You might talk about what you liked, what you expected to work but didn't, what you'd like to change, etc.
Alternatively, if you've got Java 9 installed you may experiment with jshell
and comment about it
instead of javarepl.com
.
quickrepl.txt
After working with languages that have a REPL available,
you may find yourself really wanting a REPL when you go to learn a language that doesn't have one.
One approach to a REPL is to integrate it with a language's implementation, but that typically requires a good understanding of that implementation.
Another approach is a completely standalone REPL, such as provided by javarepl.com
, but that can require a lot of code—wc
shows about 8,000 lines in Java source files for that system.
For this problem your challenge is to come up with a quick approach to write a simple REPL for a language. Your quick REPL needn't be nearly as good as ghci
but it should be able do the sorts of things you do when learning a language, such as evaluating expressions and showing types. Think about an approach that provides a lot of functionality for relatively little effort—something you could implement in a day, and not be late for dinner.
I'm not asking you to write any code for this problem; just describe how you might quickly produce a simple REPL for a language of your choice.
Python, Ruby and other languages have an "eval(s)
" function that executes the code contained in a string s
. Do not rely on such a capability in your quick REPL.
Note: This is a hard problem that requires some creativity and cleverness, so I'm making it worth zero points, but I'm curious to see who'll do it anyway! For this problem you are free to work in any groups of any size, but for me to possibly be impressed with your answer you'll have to specifically state that you came up with whatever you did all by yourself/yourselves—no Googling.
If you work in a group, all members may submit identical copies of quickrepl.txt
, but it should include list of group members.
observations.txt
Submit a plain text file named observations.txt
with...
(a) (1 point extra credit) An estimate of how many hours it took you to complete this assignment. Put that estimate on a line by itself, like this:
Hours: 3.5
Feedback and comments about the assignment are welcome, too. Was it too long, too hard, too detailed? Speak up! I appreciate all feedback, favorable or not.
(b) (1-3 points extra credit) Cite an interesting course-related observation (or observations) that you made while working on the assignment. The observation should have at least a little bit of depth. Think of me saying "Good!" as one point, "Excellent!" as two points, and "Wow!" as three points. I'm looking for quality, not quantity.
morefacts.txt jp.txt whysomany.txt negative.txt javarepl.txt quickrepl.txt (zero points—it's optional!) observations.txt (for extra credit)
Note that all characters in the file names are lowercase.
Do not include your name, NetID, etc. in your .txt
files—I like reading answers without knowing who wrote them.
The bash script /cs/www/classes/cs372/spring18/a2/turnin
(on lectura) should be used to turn in your work. It creates a time-stamped tar file that contains the expected files and then uses the system-wide turnin
program to actually turn in that tar file.
I recommend that you create a symbolic link named a2
that references the /cs/www/classes/cs372/spring18/a2
directory. Here's a command that creates such a link:
ln -s /cs/www/classes/cs372/spring18/a2 .(Yes, that final argument, a dot to specify that the symbolic link be made in the current directory, can be omitted.) If you haven't worked with symbolic links, slides 134+ in my 352 UNIX slides talk about them.
Assuming you've made that symbolic link, you should see something like the following when you run a2/turnin
:
% a2/turnin Warning: quickrepl.txt not found ======== contents of a2.20180107.143419.tz ======== -rw-r--r-- whm/whm 521 2018-01-07 14:00 morefacts.txt -rw-r--r-- whm/whm 692 2018-01-07 14:00 jp.txt -rw-r--r-- whm/whm 535 2018-01-07 14:00 whysomany.txt -rw-r--r-- whm/whm 880 2018-01-07 14:00 negative.txt -rw-rw-r-- whm/whm 188 2018-01-07 14:00 javarepl.txt -rw-r--r-- whm/whm 353 2018-01-07 14:00 observations.txt ======== running turnin ======== Turning in: a2.20180107.143419.tz -- ok All done.Note that the first line of output,
"Warning: quickrepl.txt not found"
, indicates that a deliverable was not found. We'll imagine that because that quickrepl.txt
is a zero-point problem the student elected to not do it.
The contents of the tar file, named a2.20180107.143419.tz
, are shown after that warning. Finally, the system-wide turnin
program is run and its output is shown.
You can run a2/turnin
as often as you want. We'll grade your final non-late submission. We can add a -ls
option to a2/turnin
to show what's been turned in:
% a2/turnin -ls
.:
total 4
-rw-rw---- 1 whm whm 1878 Jan 18 14:34 a2.20180107.143419.tz
If a submission is late, it will be ignored unless you mail to 372s18
and cite circumstances that you believe warrant an extension.
Remember that late assignments are not accepted, and that there are no late days; but if circumstances beyond your control interfere with your work on this assignment, there may be grounds for an extension. See the syllabus for details.