UNC-CH COMP 590-059

Class Assignments






Assignment FE: Final Exam

Due Sat. Dec 4

Work on your own... no group work on this.

Consider these 5 languages: Go, Rust, Haskell, Clojure, Scala.

Pick one and write a report (not one page, not 30 pages) discussing the following issues about your language. These are issues and topics we have looked at with the other languages we have studied:

  1. History: Who created your language? When? Any fun stories around its creation?

  2. Purpose: What is the intended purpose for creating the language? What issues or problems did the creator(s) hope to address or improve?

  3. Programming style: How is the language described? Imperative? Functional? OO? Declarative? Concurrent? Some combination?

  4. Objects: Does it have an object and/or class model? If so, describe it. How does it work? What is it similar to, and how is it different or unique (if it is)?

  5. Typing: How is the language typed? Does it do type inference? Explain a bit about the programmers experience when coding and managing types.

  6. Scoping: How is visibility of names handled in the language? Is scoping static or dynamic? What are the major lexical divisions in a program (blocks, functions, modules, classes, namespaces, etc.)

  7. Functional: Is there a functional emphasis? If so explain. Is evaluation lazy or eager? Explain anything unusual about the funtional nature of the language.

  8. Concurrency: If the language is made to allow concurrent programs, explain the concurrency model. Will it handle a few large processes? Will it handle thousands of small processes? Shared state?

  9. Example code: Show an couple examples or programs in your selected language. Make them non-trivial but pages of code are not needed. You do not have to write these yourself (but you may wish to).

  10. Anything else? Anything else interesting or different about the language? Explain.

Write your report as a PPT slide deck and submit to Sakai. Work on your own (no group work). In a class like this (seminar style) we would have presentations... if the size was also seminar size. But just the PPT will do with 85 people.



Assignment 11: Futures and Promises

Due Thursday Dec 2

Watch the class recordings for Futures and Promises (there are 2 of them) and then answer this question:

I want you each to view the presentation recording(s) and study them. Then write a single document (.doc, .txt, .pdf) and upload it in Sakai.
If you work as a group, remember to put all your names in the document.



Assignment 10: Linda Class Recording

Due Tuesday Nov 30

Watch the class recording for Linda and Tuplespace, and then answer this question:

I want you each to view the presentation recording and study it. Then write a single document (.doc, .txt, .pdf) and upload it in Sakai.
If you work as a group, remember to put all your names in the document.



Assignment 9: Erlang concurrency

Due Tuesday Nov 23

You wrote a Dining Philosophers solution in Java threads. I gave you an Erlang version of Dining Philosophers to study, so I want you to write in Erlang something similar, but for a different problem.

Choose either the Sleeping Barber problem, or the Cigarette Smokers problem, and write an Erlang program that provides a deadlock-free, starvation-free, race-free solution (and that also allows concurrency).

You are free to work in groups of up to 3 people on this assignment.

zip up your Erland source for the modules you write, and submit to Sakai. Make sure your zipfile contains a README file showing the names of all the group members.




Assignment 8: Some Erlang Programs

Due Tues Nov 9

Consult this web page: https://erlang.org/course/exercises.html

Write Erlang code for these problems shown there (pay attention to the module names requested):
  1. problem "Simple sequential programs"

  2. problem "Simple recursive programs"

  3. problem "Interaction between processes, Concurrency"

You may work in groups of up to 3

When done submit in Sakai as we have done other programs. zip file or *.erl source files is fine, and a readme with group members names.




Assignment 7: Install and Practice Erlang

Due by next class

Nothing to turn in to Sakai.

  1. download and install Erlang

  2. read the "getting started" document;

  3. Try the Erlang examples in the PPT presentation.

  4. Read one of the Erlang documents and practice what you find there.



Assignment 6: Dining Philosophers

Due Tues 10/19

  1. Write a Java threads program to implement a solution to the Dining Philosophers problem.

  2. Test it for concurrency issues, and write an explanation (text document) explaining how your approach works… can it deadlock? Does it show race conditions? Explain any strange or interesting behavior you notice

  3. You may work in groups of up to 3

  4. Write your own code… do not look up a web solution and copy it… learning comes from thinking it through

  5. When done submit in Sakai as we have done other programs


Assignment 5: Using ML to express ADT Axioms

Due Tuesday 9/28

You will be writing ML code (as we did in class) to implement ADT axioms for several ADTs. Use the method we looked at in class for encoding them in ML. For some of these, I give you axioms and you simply encode them into ML. For some I ask you to write the axioms as well as encode them into ML.

You may work in a group of up to 3 students.

  1. QUEUE ( https://www.cs.unc.edu/~stotts/COMP590-059-f21/FUNC/adtML/FIFO.html )
    Write and test ML encodings for these axioms.

  2. MAP ( https://www.cs.unc.edu/~stotts/COMP590-059-f21/FUNC/adtML/map.html )
    Write and test ML encodings for these axioms.

  3. SET of Int
    For this one, write axioms, and then write ML for them.

    the operations in SET of Int are: new, add, rem, mem, card
    new makes an empty SET
    add put an Int element into a set
    rem takes an Int element out of the set
    mem (member) tells if an Int element is in the set or not
    card (cardinality) gives the number of items in the set
    Remember the semantics of normal sets. When you add an item to a set and the item is already in the set, you do not change the set membership. The item is still in the set after the add... there is no notion of adding a second instance of the item.

  4. MSET of Int
    For this one, write axioms, and then write ML for them.

    MSET is a multiset (or Bag). It is like a SET except now we can add an item more that one time. If we add an item twice, then the count for i is 2... it is in the MSET twice. the rem operation takes a single instance of an item from the set.

    The operations for MSET are: new, add, rem, card, mem (like SET) but the semantics vary.
    new makes an empty MSET
    add as noted put an item into the MSET and you can add an item repeatedly
    rem takes one instance of an item out of the MSET
    card tells how many items are in the MSET (counting each instance of an item)
    mem (member) is not boolean in MSET... it returns an Int and tells how many times an item is in the MSET (0 means it is not in the MSET)

    Example:
    S: 2, 6, 6, 6, 9, 9, 12
    add 9 to S: 2, 6, 6, 6, 9, 9, 9, 12
    rem 6 from S: 2, 6, 6, 9, 9, 9, 12
    card of S: 7
    mem 6 in S: 2
    mem 12 in S: 1
    mem 10 in S: 0

In Sakai, Upload a zip file containing your ml source files. Also include in that a text file with the names of the group members, if you worked in a group.






Assignment 4: Get SMLNJ working on a PC

  1. Follow the instructions in the Examples and get SMLNJ working on your laptop (or other machine)
  2. Try some simple programs
  3. Nothing to submit for this, but next Assignment will be SMLNJ program to submit





Assignment 3: Write an AspectJ Program

Due Tues 9/14/2021 at 11:59pm

  1. Take a Java program you have someplace (several classes)... find one, write one, use one from some class you did before... whatever... and add some aspects to do these things:
      -- some sort of logging or "debugging" announcement printing
    
      -- some sort of interruption of method calls ... intercepting and perhaps altering
         the parameters and control flow inside
    
      -- whatever else you think is cool to try
    
    your choices, but make them non-trivial

  2. You may work alone, or in groups of up to 3. In group work, the group produces a solution and one group member submits it with a note saying who it is for
  3. Submit in Sakai.





Assignment 2: Get AspectJ working on a PC

  1. Follow the “AJC Install on Windows” instructions and get AspectJ working on your laptop (or other machine)
  2. Try some simple programs
  3. You may work alone, or in groups of up to 3. In group work, the group produces a solution and one group member submits it with a note saying who it is for
  4. Nothing to submit for this, but next Assignment will be an AspectJ program to submit





Assignment 1: OO Pillars and Models

Prepare a single document (like Word) that contains your answers to these 3 questions.
Then submit it in Sakai for Assignment 1 as a single PDF file.

  1. Write Java programs (small is fine) to exemplify each OO pillar

  2. Pick a language from this list and compare its object model to Java (like I did with Javascript); how is each pillar expressed?



  3. Research OO and find objections to it as a programming technology… what are its failings and shortcomings?