---
# System prepended metadata

title: Homework 2 (Movie Review Sentiment Analyzer)

---

# Homework 2 (Movie Review Sentiment Analyzer)

## Grading

**Maximum of -40 points in total.**

----

### Basic Java knowledge
- constants (by use case) not being constants in the code -2
- throws in method signature for unchecked exceptions -4
- no access modifiers -8
   - fields are not private
   - helper methods are not private
- When creating a custom exception class, always override as minimum the Exception(String message) and Exception(String message, Throwable cause) parent constructors. -2
- It is not a good practise to leave empty catch blocks. -4
- String literals should be checked for equality using equals. -4
- Use System.lineSeparator() instead of "\n", to make sure your code is platform-independent. -4
- Try-with-resources construct not used for closing I/O streams. -5
- Try-with-resources incorrectly used, e.g. wrapping a resource passed as argument. This will close an I/O stream created somewhere else and potentially still used. -3


### Clean code
- code duplication -4
- methods are too long (>30-35) -3
- argument validation checks are redundant (part of code duplication, but it's worth mentioning) -4
- method does more than one thing -2
- commented code -2
- using a specific class instead of an interface, when declaring a collection -4
- no curly brackets -4
- unnecessary if/else statements instead of direct return for a boolean check -4
- not adding messages when throwing exceptions -2
- avoid wildcard imports -2
- "Magic numbers": hard-coded numbers, string literals, etc., should be extracted and replaced by suitably named constants -4

### Efficiency
- Stopwords are not stored in memory but rather read every time they are needed  from the file -10
- Stopwords are stored in a worse-than-constant access data structure -5
- The dataset and/or stopwords files are not read with a buffered reader or equivalently fast way -5
- Sentiment is not calculated with linear complexity: e.g. for each word, the entire file is being read to determine its sentiment (which would be O(N^2)). -10
- The dataset file is loaded in a data structure corresponding 1:1 with the file structure and sentiment calculation has O(N^2) complexity, instead of linear. -7
- Overly complex algorithm for calculating top-N words (e.g. multiple conversions from collection to stream back to collection, unnecessarily high algorithmic complexity) -5

### Compilation failed
- Changed method signatures: -30
- Changed package names: -10
- other compilation issues (deduction points depending on violation severity)

### Unit Testing
- JUnit tests without assertions (fake code coverage) -3
- Prep logic not extracted in @BeforeAll/@BeforeEach (code duplication) -3
- Assertions without message: always provide clear human-readable explanation as assert message -3
- assertEquals for float or double without delta argument -3
- assertEquals used for comparing collections (bug): use assertIterableEquals() for ordered collections or custom code coparing for equality unordered/arbitrary collections -3
- Multiple test cases placed in the same unit test method (e.g. more than one logical assert in a test method) -4
- Unit tests use the entire stop words / dataset files and  those are loaded on every single test execution. Either do it once, e.g. in a @BeforeAll method, or, better, don't use static files for testing at all. -4
- Using the @TestMethodOrder annotation and setting a particular order of execution for the unit test methods. -4
    

## People

**Notes:**
> :exclamation: = needs to be recompiled and submitted again

**Деси**
- [x] y_zelova@outlook.com (17.01 18:00)
- [x] dany_jo@abv.bg (18.01 11:00)
- [x] imyordanov@uni-sofia.bg (17.01 16:30)
- [x] joannablago@gmail.com (20.01 17:30)
- [x] dtuechki@gmail.com (18.01 10:00)
- [x] kosevyordan@gmail.com (20.01 18:00)
- [ ] kristiyan.semerdjiev@gmail.com (19.01 14:30)

**Митака**
- [ ] geridd796@gmail.com
- [ ] todorkerm@gmail.com
- [ ] xxglentxx@gmail.com
- [ ] ilkootvarna@gmail.com
- [ ] kalintoto@gmail.com
- [ ] ili.2@abv.bg
- [ ] koki1231234@gmail.com

**Крис**
- [ ] alex.uzunov2002@gmail.com
- [ ] tswetti37@gmail.com
- [ ] mggrozdeva@gmail.com
- [ ] pe.stoyanow@gmail.com
- [ ] hakan.hasan.00@gmail.com
- [ ] todorwww@gmail.com
- [ ] danail.ivn.dimitrov@gmail.com

**Лъчко**
- [x] minkovm@uni-sofia.bg
- [x] sdvelev@gmail.com
- [x] plamena.ilieva117@gmail.com
- [x] violinatoseva@gmail.com
- [x] bojidaruse@gmail.com
- [x] iliyanrg@uni-sofia.bg
- [x] fkfilchev@gmail.com

**Иван А**
- [x] rayas@uni-sofia.bg
- [x] arispapanis@abv.bg
- [x] danieldamianov02@gmail.com
- [x] stoyanmalinin2002@gmail.com
- [x] viktorboev01@gmail.com
- [x] cvetanivanov2002@gmail.com
- [x] viktor.mr@mail.bg

**Моника**

/

**Светльо**

/

**Иван П**
- [ ] niki.kostandiev@abv.bg (20.01 11:00)
- [ ] amiraemin66@gmail.com
- [x] anikov@uni-sofia.bg (19.01 18:30)
- [ ] teodor.karakashev@gmail.com
- [x] ntodorov301@gmail.com (19.01 08:30)
- [x] martinmarinov150402@gmail.com (17.01 13:00)
- [ ] ralica.a.simova@gmail.com

**Иван И**
- [ ] nikola.manolov20@gmail.com
- [ ] rosenandreevkolev1@gmail.com
- [ ] davidbaruchreal@gmail.com
- [ ] g.sarambeliev@gmail.com
- [ ] ivo3948@gmail.com
- [ ] rally0307@gmail.com
- [ ] dimana.vqtrova@gmail.com
- [ ] kreizis@abv.bg

**Ицо**

/

**Стойо**
- [x] tsvetilin.tsvetilov@gmail.com (20.01 17:00)
- [x] tedi.sv.kostadinov@gmail.com (19.01 11:00)
- [x] vanyaalekseev94@gmail.com (20.01 16:00)
- [x] mishob.2002@gmail.com (19.01 16:00)
- [x] dimitargh@uni-sofia.bg (18.01 16:00)
- [x] vasilangelov2000@gmail.com (14.01 17:00)
- [x] mitrevtodor@gmail.com (16.01 11:00)
- [x] :exclamation: emilian.spassov@gmail.com (19.01 17:00)
