-
Notifications
You must be signed in to change notification settings - Fork 233
[CS2113-W11-3] Travel Diary #52
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
base: master
Are you sure you want to change the base?
[CS2113-W11-3] Travel Diary #52
Conversation
okkhoy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code that is present here is quite good.
however,
1/ much of the codebase needs javadoc comments
2/ i didn't see too many exception handling scenarios, or assert statements (and any logging statements).
please pay attention to these as they are used for grading
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| public class Album { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-trivial methods need javadoc comments. (applied to all such classes in this codebase, please propagate the comment)
| import trip.TripManager; | ||
| import ui.Ui; | ||
|
|
||
| // TODO: need to find out how to close photo after bye |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove such "note-to-self" comments.
you can use these kind of review comments for the purpose
| //package command; | ||
| // | ||
| //import exception.TravelDiaryException; | ||
| //import trip.TripManager; | ||
| //import ui.Ui; | ||
| // | ||
| //public class SelectTripCommand extends Command { | ||
| // private int index; | ||
| // | ||
| // public SelectTripCommand(int index) { | ||
| // this.index = index; | ||
| // } | ||
| // | ||
| // @Override | ||
| // public void execute(TripManager tripManager, Ui ui, int fsmValue) throws TravelDiaryException { | ||
| // ui.showToUser("Alvida! Till we meet next time :)"); | ||
| // } | ||
| //} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't retain commented code - in this case, you may as well remove the file totally
| case "bye": | ||
| case "list": | ||
| case "close": | ||
| case "menu": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fallthrough comments necessary
src/main/java/parser/Parser.java
Outdated
| map.put("name", tagsMap.get("n#")); | ||
| map.put("description", tagsMap.get("d#")); | ||
| map.put("location", tagsMap.get("l#")); | ||
| if (map.get("name") == null || map.get("description") == null || map.get("location") == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some parts of the code (like this one) can use some blank lines to give well-readable vertical spacing
| if (part.startsWith(tag)) { | ||
| if (!seenTags.add(tag)) { | ||
| throw new TravelDiaryException("Duplicate tag provided for " + tag); | ||
| } | ||
| String value = part.substring(tag.length()).trim(); | ||
| if (value.isEmpty()) { | ||
| throw new TravelDiaryException("Empty value provided for tag " + tag); | ||
| } | ||
| return new AbstractMap.SimpleEntry<>(tag, value); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider extracting out some parts under a guard clause and eliminate arrow-head code
src/main/java/storage/Storage.java
Outdated
| try (BufferedWriter writer = new BufferedWriter(new FileWriter(dataFile))) { | ||
| for (Trip trip : trips) { | ||
| writer.write(formatTripLine(trip)); | ||
| writer.newLine(); | ||
|
|
||
| if (trip.album != null) { | ||
| writer.write("A | " + encodeString(trip.name)); | ||
| writer.newLine(); | ||
| System.out.println("Saving album for trip: " + trip.name); // Log album saving | ||
|
|
||
| if (trip.album.photos != null) { | ||
| for (Photo photo : trip.album.photos) { | ||
| writer.write(formatPhotoLine(photo)); | ||
| writer.newLine(); | ||
| System.out.println("Saving photo: " + photo.getPhotoName()); // Log each photo saving | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks a lot like arrowhead code
src/main/java/storage/Storage.java
Outdated
| decodeString(parts[1]), // file path | ||
| decodeString(parts[2]), // photo name | ||
| decodeString(parts[3]), // caption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use meaningful variable names rather than use comments to indicate what each part is?
| tripsDetails.append("\t").append(i + 1).append(") ") | ||
| .append(trips.get(i).toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would using a loop be good in this case, instead of a sequence of appends?
src/test/java/parser/ParserTest.java
Outdated
| // @Test | ||
| // public void AddPhotoParsingTest() { | ||
| // String simulatedInput = "add_photo f#./data/photos/sample1.jpg n#Osaka photo c#Friends l#Osaka street\n"; | ||
| // System.setIn(new ByteArrayInputStream(simulatedInput.getBytes())); | ||
| // | ||
| // Map<String, String> parsedCommand = assertDoesNotThrow(Parser::getCommandDetails); | ||
| // | ||
| // // Verify the parsed result | ||
| // assertEquals("add_photo", parsedCommand.get("command")); | ||
| // assertEquals("./data/photos/sample1.jpg", parsedCommand.get("filepath")); | ||
| // assertEquals("Osaka photo", parsedCommand.get("photoname")); | ||
| // assertEquals("Friends", parsedCommand.get("caption")); | ||
| // assertEquals("Osaka street", parsedCommand.get("location")); | ||
| // } | ||
| // | ||
| // @Test | ||
| // public void SelectParsingTest() { | ||
| // String simulatedInput = "select 1"; | ||
| // System.setIn(new ByteArrayInputStream(simulatedInput.getBytes())); | ||
| // | ||
| // Map<String, String> parsedCommand = assertDoesNotThrow(Parser::getCommandDetails); | ||
| // | ||
| // // Verify the parsed result | ||
| // assertEquals("select", parsedCommand.get("command")); | ||
| // assertEquals("1", parsedCommand.get("index")); | ||
| // } | ||
| // | ||
| // @Test | ||
| // public void DeleteParsingTest() { | ||
| // String simulatedInput = "delete 10"; | ||
| // System.setIn(new ByteArrayInputStream(simulatedInput.getBytes())); | ||
| // | ||
| // Map<String, String> parsedCommand = assertDoesNotThrow(Parser::getCommandDetails); | ||
| // | ||
| // // Verify the parsed result | ||
| // assertEquals("delete", parsedCommand.get("command")); | ||
| // assertEquals("10", parsedCommand.get("index")); | ||
| // } | ||
| // | ||
| // @Test | ||
| // public void ListParsingTest() { | ||
| // String simulatedInput = "list"; | ||
| // System.setIn(new ByteArrayInputStream(simulatedInput.getBytes())); | ||
| // | ||
| // Map<String, String> parsedCommand = assertDoesNotThrow(Parser::getCommandDetails); | ||
| // | ||
| // // Verify the parsed result | ||
| // assertEquals("list", parsedCommand.get("command")); | ||
| // } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented out code should be removed.
Metadata extractor
…+ fix ui trip list
RESOLVED conflict for DG # Conflicts: # build.gradle
Add Location class
Ashley dg draft2
Remove trip location and added period tracker
Roycecodes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall nice DG
Found some UML diagram flaws
docs/DeveloperGuide.md
Outdated
| ##### Saving Data | ||
| The saving process converts in-memory objects into a text representation and writes them to a file. The `saveTasks` method handles this process. | ||
|
|
||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work clear diagram shown
I think it would be nice to have activtion boxes
:)
docs/DeveloperGuide.md
Outdated
| ##### Saving Data | ||
| The saving process converts in-memory objects into a text representation and writes them to a file. The `saveTasks` method handles this process. | ||
|
|
||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work
think if you add colons to class name it will be good
docs/DeveloperGuide.md
Outdated
| ##### Saving Data | ||
| The saving process converts in-memory objects into a text representation and writes them to a file. The `saveTasks` method handles this process. | ||
|
|
||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think it will be nice to include constructor boxes as well
docs/DeveloperGuide.md
Outdated
| These specialized exceptions provide detailed information about what went wrong and where, making debugging easier. | ||
|
|
||
| ### PhotoPrinter | ||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there shouldnt be a C logo next to class name
nice diagram btw
docs/DeveloperGuide.md
Outdated
| These specialized exceptions provide detailed information about what went wrong and where, making debugging easier. | ||
|
|
||
| ### PhotoPrinter | ||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it is the standard to have + - to indicate public/private instead of boxes and squares
nice work.
update aboutus
Add colon to sequence diagram
Uml format bryan
Add coments
make changes to ppp - remove community involvement
Guide update
Uml format bryan
Finished PPP
UML update
Final PPP.
Travel Diary is a desktop app for managing trips and travel memories, for use via a Command Line Interface (CLI). Travel Diary helps you log and organize trips, photos, and experiences more efficiently than traditional travel journaling apps.