6.10

Assignment 3b

home work!

Programming Language BSL

Due Date Thursday Friday at 9:00pm (Week 3)

Purpose It is time to graduate from programming to program design.

Finger Exercises

Graded Exercises

Exercise 1 Design the world program simple-forum, our first step in implementing a simplified version of Piazza. Eventually, the program will communicate with a server, to send and receive posts made by the users on the server. For this week, we will ignore this server-communication ability; your posts will only be seen by your own program. There are two components to this assignment:

  • Handling user input: the user must be able to type in new posts

  • Drawing the current posts: the user should be able to see posts in Forum so far

1. User input: The program interacts with the user, who may edit one-line text messages:
  • Its key handler accepts keyboard characters of length 1—except for "\r" (the enter key) and "\b" (the backspace key)—and adds them to the end of the current message.

  • When the user presses the backspace key ("\b"), the program must erase the last 1String that was added (if any).

  • When the user presses enter ("\r"), the program completes the message that the user is building up, and begins building a new message starting from the empty string. Completing a message should simply add the post to the already-completed posts. (This is more like a todo list than an actual Piazza-like system, since you aren’t sending the posts to a central server yet.)

Feel free to equip your program with additional edit capabilities. If you change your design from the description above, be sure to document it so the graders know what you’ve changed!

2. User interface: Your program may display its state in any way you like; the only requirement is that whatever you draw should include the contents and authors of the posts that have been made. (Note: if your program runs for long enough, you may have to contend with more posts than can fit on screen at once. You do not need to implement a complicated solution like scrolling, but neither should you let your program “break”.)

Designing your data This choice of representation violates the model-view design principle described in the preface. No worries, you will be able to improve on this solution soon. (1) Clearly the program must track at least two different pieces of information: the text that the user edits and the posts that have been made. (2) The simplest editor representation is a string, but you may consider alternatives which allow for more complex editing. (3) Represent the previous posts with an image.

Grading We will grade the design of each handler separately. So turn in your program even if it remains incomplete and either or both pieces of functionality do not work completely..