CMSC 405 CMSC 335

profileebote
DBWEEK1-8.docx

WEEK 1

Pick a scenario and 

· model it using at least a  class hierarchy with 5 classes: one parent, two children, and two grandchildren of one of the child classes.

· Provide at least one field and one method that compellingly differentiates each class from the others.

· Make sure to include the return type and the types of the arguments for any method being proposed.

· Do not include constructors, getters, setters, or any method with no argument in your description.

· Use fully spelled names for classes, methods, variables, using the camel convention when combining multiple words.

Examples of scenarios - lots of them spring to mind, but I don't want the list to be too long. In this way, you can compare your ideas with those of other students, and I encourage to consider what other students have posted, you are also encouraged to make suggestions of other's postings and make additional postings updating your own ideas in light of the suggestions by others.

1. An airplane

2. A train

3. An e-commerce company (e.g. Amazon)

4. A city government

5. An airline (aspects of an entire company)

6. A government organization (e.g. EPA, Defense)

a. NOTE: A general is not a kind of private, nor is a private a kind of general, for example.

b. Also, a general is not a kind of Defense Department

c. THUS:  not all hierarchies are class hierarchies!

Note: This problem is NOT asking for a full implementation of these classes - a UML diagram, or similar level of detail, is adequate.

I would emphasize the following kinds of relationships among classes:

is-a

parent/child relationship in a class hierarchy perhaps better to use the phrase "is a kind of", as in "a Private is a kind of Soldier" or "a SportsCar is a kind of Car"

is-some

a data structure in which all the elements have the same type.  This is the place where one should use  generic classes. This will not be the case in our project since we have a structure of Cave -> Party -> Creature -> Artifact and Treasure.

has-a

an attribute (field) of one class inside another

has-some

a 1-to-n relationship, in our case a Party will have may Creatures, and a Creature will have many Artifacts and will also have many Treasures

WEEK 2

Pick a pair of concrete classes in the JDK in a parent-child relationship and discuss a few overridden and overloaded methods. Read the threads posted before your own post to make sure you are using an example that has not been used already. Make sure to properly reference your sources.

Do not use Object as the parent class - it is too trivial to address the issues to be addressed here, and in any case, Object is the final parent of all classes in Java. Similarly, do not use the toString method and all other methods defined for the Object class as an example of overridden method.

WEEK 3

Pick an interface in the JDK, describe the method(s) that interface requires. Write a method that accepts an argument of your selected interface type, together with some test code.

Read the threads posted before your own post to make sure you are using an example that has not been used already.

WEEK 4

Using the readings and videos from this week as your guide, create your own simple GUI, do not use any UI generator. Provide the code, describe the functionality and demonstrate it compiles and runs as designed. Do not use absolute positioning.

Read the threads posted before your own post to make sure you are using an example that has not been used already. Do not reuse prior class work.

Do not forget that UI programming is still programming, and that you need to apply as much structured programming concepts as for any other programming exercise: keep variable scopes as local as possible, qualify all instance and class variables, do not duplicate code, use methods to factor commonalities, and apply good naming conventions. Make sure that your comments are needed and add useful information.

WEEK 5

For this week, please describe in your own words what multithreading is and how can multiple threads run simultaneously on a single-processor system? You don't need to provide code examples, just try to describe the principles in your own words.

WEEK 6

For this week,

· take one of the topics in the readings,

· find a reference outside our readings talking about that topic

· cite your reference

· tell us a little about how the two presentations relate to each other

· tell us what you have learned about that topic from your readings

Some suggested topics:

1. Spin locks

2. Atomic read/write operations vs the real world

3. Sequentially consistent memory

4. Memory barrier instructions

5. Test and set locks: getAndSet (), compareAndSet ()

6. Monitors, locks, conditions

7. Locked queue

8. Lost wake up events

9. Readers writers locks

10. Reentrant locks

11. Semaphores

12. Threads - creating and running them

13. Thread structure of the JVM and the Java GUI classes

14. Race conditions and deadlocks

15. Writing a concurrent program

a. condition variables

b. producer-consumer problem

c. finding objects

d. active, passive and control objects

WEEK 7

(a) Give an example where an executor pool is appropriate.

(b) Why are some of the methods in the Thread class deprecated? Give a short explanation.

WEEK 8

For this week, please respond to the following:

(a) Describe an application that can deadlock, or starve a thread.

(b) Describe a testing strategy that would detect such a problem efficiently.

(c) Tell us what you liked about this class.

(d) Tell us what you did not like about this class.