Skip to content

Conversation

@betochf
Copy link

@betochf betochf commented Apr 26, 2021

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;

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;

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>();

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;

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="";

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 != "") {

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(",");

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"));

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;

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 {

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