Skip to content

POM, MovieRecommender#28

Open
betochf wants to merge 3 commits into
Nearsoft:mainfrom
betochf:main
Open

POM, MovieRecommender#28
betochf wants to merge 3 commits into
Nearsoft:mainfrom
betochf:main

Conversation

@betochf

@betochf betochf commented Apr 26, 2021

Copy link
Copy Markdown

No description provided.

betochf added 3 commits April 26, 2021 14:22
The file must be in the source project
So it can runs with JDK 8

public class MovieRecommender {
String path;
int repMovies,repUsers;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Declaration should go on single line

public class MovieRecommender {
String path;
int repMovies,repUsers;
int user,product,review;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same here, declaration should go on single lines

String path;
int repMovies,repUsers;
int user,product,review;
HashMap<String, Integer> userId = new HashMap<String, Integer>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Avoid using implementations, use an interface instead

}

public void convert() throws IOException {
this.user=0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Initialization should be part of constructor. Also, default values of int attributes is zero

this.review=0;
this.repMovies=0;
this.repUsers=0;
String idUser="",idProduct="", scoreReview="";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Declaration should be single line

this.review++;
}

if(idProduct != "" && idUser != "" && scoreReview != "") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use equals method to compare Objects


if(idProduct != "" && idUser != "" && scoreReview != "") {
csvWriter.append(userId.get(idUser).toString());
csvWriter.append(",");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Avoid using string literals, you can use a static String or an enum

public int getTotalUsers(){ return this.user; }

public List <String> getRecommendationsForUser(String id) throws IOException, TasteException {
DataModel model = new FileDataModel(new File("list.csv"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Avoid hardcoding file names

import java.util.regex.Pattern;

public class MovieRecommender {
String path;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Define right access modifier for class attributes

public int getTotalProducts(){ return this.product; }
public int getTotalUsers(){ return this.user; }

public List <String> getRecommendationsForUser(String id) throws IOException, TasteException {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Where is this function being called?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants