nus-cs2030 / 2021-s2

2 stars 2 forks source link

private final and other project requirements? #111

Open fwenyin opened 3 years ago

fwenyin commented 3 years ago

Does everything have to be private final for the project, and are there other requirements/are we graded on principles like tell-dont-ask or is it just the graded on the accuracy of code tested on test cases (like lab)?

suyatinglaura commented 3 years ago

Yes, all attributes are required to be set as private final. Besides, I think we are prohibited to use instanceof to test the type of an object outside its own class.

gableejh commented 3 years ago

Yes, ideally you should abide by the principles which we have learnt so you should use private final to ensure that the objects are immutable

gwajoon commented 3 years ago

From what I know, CodeCrunch will check for certain principles like immutability (not declaring attributes as private final will get flagged off when you submit) and also for example if you use instanceof to check the events will also lead to an instant F. So do take note of that!

Keithlimhs commented 3 years ago

Yes, we should always abide by the OOP principles taught to us when designing our code, hence all attributes must be private final to adhere to immutability and encapsulation. The design of the code should also adhere to the tell-don't-ask principle

seancxy commented 3 years ago

Yeah, codecrunch will check if your attributes are declared private final. Requirements other than the tell-don't-ask are abstraction and encapsulation principles. You could also incorporate the use of Optionals to deal with null values if there are cases that results in null values

Xeph-o commented 3 years ago

Ensure that all variables are final, and that you do not use instanceof. Also, check for potential cyclic dependencies as you do the project.

sebin0817 commented 3 years ago

Hi yes that is one of the requirements for the project! attributes must be private final to make each class immutable. not sure if you solved it yet, but you can implement getter methods to access them from other classes. all the best!