Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[T6A1][F11-B3]Hsieh Hsin Han #513

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[T6A1][F11-B3]Hsieh Hsin Han #513

wants to merge 2 commits into from

Conversation

Tony-Hsieh
Copy link

No description provided.

import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.exception.IllegalValueException;

public abstract class Storage {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class and its methods should have a header comments. If not, developers who needs to inherit from this class will not know how exactly they should override the methods and other developers who write client code for this class will not know how to use it either.

* Signals that some error has occured while trying to convert and read/write data between the application
* and the storage file.
*/
public static class StorageOperationException extends Exception {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation problem here?. Our coding standard requires you to use 4 spaces instead of tabs. You can configure Eclipse to convert tabs to spaces automatically.

public abstract String getPath();

/**
* Signals that some error has occured while trying to convert and read/write data between the application
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper Javadoc should like

/**
* Signals that...
* ....
*/

/**
* @throws InvalidStorageFilePathException if the given file path is invalid
*/
public StorageStub(String filePath) throws InvalidStorageFilePathException {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this code here? A return null is enough? Stubs don't usually do any work.

* @throws StorageOperationException if there were errors reading and/or converting data from file.
*/
@Override
public AddressBook load() throws StorageOperationException {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.
Why do you need this code here? A return null is enough? Stubs don't usually do any work.

@@ -31,7 +31,7 @@ public Gui(Logic logic, String version) {

public void start(Stage stage, Stoppable mainApp) throws IOException {
mainWindow = createMainWindow(stage, mainApp);
mainWindow.displayWelcomeMessage(version, logic.getStorageFilePath());
mainWindow.displayWelcomeMessage(version, logic.getStoragePath());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! You also remember to change this one.

addressBook = new AddressBook();
saveFile.save(addressBook);
logic = new Logic(saveFile, addressBook);
saveStub.save(addressBook);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this code here since stub actually should do nothing in this case?

@@ -90,7 +91,7 @@ private void assertCommandBehavior(String inputCommand,
//Confirm the state of data is as expected
assertEquals(expectedAddressBook, addressBook);
assertEquals(lastShownList, logic.getLastShownList());
assertEquals(addressBook, saveFile.load());
assertEquals(addressBook, saveStub.load());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are doing DI. You no longer need to test the storage when you test the logic.

@xpdavid
Copy link

xpdavid commented Mar 3, 2017

@Tony-Hsieh Some comments added. Please close the PR after reading comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants