Object-Oriented Language and Theory: Lab 05: Memory Management and Class Organization
Object-Oriented Language and Theory: Lab 05: Memory Management and Class Organization
You need to use the project that you did with the previous labs including both AimsProject and other
projects.
1. Import/export a project
- Open Eclipse
- You can import/export a project from/to an archive file. For example, if you want to
import from a zip file, you can follow the following steps:
+ Open File -> Import.
+ Type zip to find Archive File if you have exported as a zip file before. You may choose
Existing Projects into Workspace if you want to open an existing project in your computer.
Ignore this step if the AimsProject is already opened in the workspace.
Figure 1-Refactoring
+ For creating a package, right click to the project (or go to menu File) and choose New ->
Package. Type the full path of package including parent packages, separated by a dot.
- Your structure of your labs should be at least as below. You can create sub-packages
for more efficently organizing your classes in both projects and all listing packages. All
hands-on labs and excercises of lab01 and lab02 should be put in the corresponding
package in the OtherProjects project.
For Global ICT
+ AimsProject
hust.soict.globalict.aims.disc.DigitalVideoDisc
hust.soict.globalict.aims.order.Order
hust.soict.globalict.aims.Aims
hust.soict.globalict.aims.utils.DateUtils
hust.soict.globalict.aims.utils.MyDate
hust.soict.globalict.test.utils.DateTest
hust.soict.globalict.test.disc.TestPassingParameter
+ OtherProjects
hust.soict.globalict.lab01
hust.soict.globalict.lab02
For HEDSPI
+ AimsProject
hust.soict.hedspi.aims.disc.DigitalVideoDisc
hust.soict.hedspi.aims.order.Order
hust.soict.hedspi.aims.Aims
hust.soict.hedspi.aims.utils.DateUtils
hust.soict.hedspi.aims.utils.MyDate
hust.soict.hedspi.test.utils.DateTest
hust.soict.hedspi.test.disc.TestPassingParameter
+ OtherProjects
hust.soict.hedspi.lab01
hust.soict.hedspi.lab02
2
Figure 2-Recommended Structure for Global ICT Figure 3-Recommended Structure for HEDSPI
3
More information on String concatenation, please refer https://redfin.engineering/java-string-
concatenation-which-way-is-best-8f590a7d22a8.
- Create a new class GarbageCreator. Create “garbage” as much as possible and observe
when you run a program (it should let the program stop working when too much “garbage”. Write
another class NoGarbage to solve the problem.
Some suggestions:
- Read a text file to a String without using StringBuffer to concatenate String (only use +
operator). Observe and capture your screen when you choose a very long file
- Improve the code using StringBuffer
5. Assignment Submission
You must put all your work, written by yourself, to a directory Lab05, and push it to your
master branch of the valid repository before the deadline announced in the class.
Each student is expected to turn in his or her own work and not give or receive unpermitted aid.
Otherwise, we would apply extreme methods for measurement to prevent cheating.