Skip to content

adacic/SEG2105-Lab2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lloseng

This repository contains a copy of code available to students using the book Object-Oriented Software Engineering: Practical Software Development using UML and Java, 2nd Edition, 2004 McGraw Hill. by Timothy C. Lethbridge and Robert Laganière.

Lab 2 (to introduce Assignment 1)

Assignment Submission before September 28, 9:30am using BrightSpace

During the lab 2, you will start working on your assignment 1. The TA will explain how to setup your environment, how to measure the execution time of a Java program and HOW TO DEBUG! You can clone this repository using the following command:

git clone https://github.com/SEG2105-uottawa/SEG2105-Lab2.git

Group work and partners: In this lab, and all other labs that involve programming, you will work in groups of two. If you have not previously arranged to work with someone in your lab section, then you will have to find someone immediately. You can also work individually. No groups of 3 will be permitted.

Format

Your private repository should be named [prefix]-[student-number-1]_[student-number-2], for example

lab02-1484511_90210901210

When finished, submit a text file named after your student numbers (xxxxx_yyyyy.txt). For example,

lab02-1484511_90210901210.txt

Within the file please include:

  • Your names and students numbers
  • A link to your GitHub repository.
  • A link to the your last commit.

Your GitHub repository should contain all solutions to the Assignment 1, no solution submissions via BrightSpace will be evaluated.  Only the information above should be submitted to BrightSpace.

Logistics

Seating

In the early labs, each group will use one computer, although you will need an extra computer when you are doing later labs involving client-server work.

Saving work and accounts

Your TA will give you any needed help regarding setting up your account. Before you leave the lab each day, make sure you have saved, committed and pushed your work.

Using Eclipse

You will be using Eclipse in this lab. Instructions on how to get started in the lab. An updated version of the instructions will be presented at the beginning of the lab.

Exercises

Work on the following exercises from the textbook. You must hand in only one copy of answers per group. Make sure the names and student numbers of both partners are clearly indicated. You must work on these questions during the lab and then finish off the work on your own time.

Analysis of various design alternatives

  1. Before coming to the lab, you are asked to read and understand Section 2.9 of the textbook, starting on page 57. If you have not done this, take five minutes now to do it.

  2. This Lab/Assignment will focus on PointCP from this repository, so all instructions will be relative to that directory.

cd pointcp

Before making any changes, compile the code and make sure it runs.

javac PointCP.java PointCPTest.java

To run the program

java PointCPTest

You can, of course, run the programs using the Eclipse IDE (or your preferred IDE).

PointCP

All modifications should be done within the /pointcp directory. By modifying the original version, implement the following designs.

  • design 2 (edit code in /design2 directory)
  • design 3 (edit code in /design3 directory)
  • design 6 (edit code in /design6 directory)
  1. Modify the PointCPTest class to allow you to test the designs you have developed. Do a thorough series of tests to ensure your classes and interface work properly.

  2. Overwrite the OUTPUT.md to clearly provide a printout of the output generated by your tests for each design. Clearly indiciate which design the output is from.

Answer the following exercises in the provided EXX.md files using GitHub Markdown.

  • Overwrite E26 (table of what you think will be the advantages and disadvantages of designs 2, 3 and 6)
  • Overwrite E28 (performance analysis, comparing all three designs you have implemented instead of Design 1 with Design 5 as the book says)
  • Overwrite E29 (similar as E28)
  • Overwrite E30 (similar as E28)

To do this evaluation (of E26, E28-E30), for each design create random instances and then call each method many thousands of times, and then find the elapsed time in milliseconds for the fixed number of iterations. Make sure that your program runs each time for about 10 seconds, so you get a good measure of performance. Test each method separately. Run each version several times to ensure that your results are consistent and use the median result as your definitive result, plus give the maximum and minimum.

Design How cartesian coordinates are computed How polar coordinates are computed
Design 2: Store polar coordinates only Computed on demand, but not stored Simply returned
Design 3: Store cartesian coordinates only Simply returned Computed on demand, but not stored
Design 6: Interface with designs 2 and 3 as classes implementing it. Depends on the concrete class used Depends on the concrete class used
  1. Overwrite the TESTING.md file and clearly describe
  • how you did the tests,
  • sample outputs from running the tests
  • the table and
  • a discussion of the results.

ARRAYS

  1. Compare the performance of LinkedList, ArrayList and ordinary arrays. You should do a series of experiments where you do each of the following tests with the three types of collection, timing the execution of each run.

You should run each case several times on the same computer to obtain stable average timings.

a. Construct very large collections by putting random floats into each collection one at a time. The random floats should range in value from zero to 9.0. You should make each collection large enough so that the run takes at least 10 seconds to add the floats in the case of an ArrayList. You will have to do some initial experiments to find out what is a good size. You would use the same size of collection for ArrayList, LinkedList and the array. The ArrayList and LinkedList can be created by successively adding items and allowing them to grow, while the array has to be created at its full size and then populated with its contents. You could also try to experiment with the case where you do create the ArrayList and LinkedList initially with their full size.

b. Construct very large collections as in (a). Then use iterators to sum the elements. Subtract the construction time to get a measure of how much time the iteration takes. Use a for loop for the array, and an Iterator for the LinkedList and ArrayList.

Overwrite the ARRAY.md to present your data in suitable tables and draw conclusions from an analysis of the data. From your conclusions, develop recommendations to designers.

If you have questions related to the assignment? Please use the Piazza forums!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 86.0%
  • HTML 14.0%