nus-cs2103-AY2122S2 / forum

13 stars 1 forks source link

Standard practice in SWE #240

Open ivorcmx opened 2 years ago

ivorcmx commented 2 years ago

Good day everyone and prof. Is there a standard practice between using primitive types as compared to Wrapper classes in SWE codes. For instance using int and Integer. Are the two interchangeable as long the code works or should I be following a standard practice? Thanks in advance!

putaojuice commented 2 years ago

I think one of the advantages of using Integer wrapper class is that you can check if it is null, whereas using int primitive data type does not allow you to do that. But it still depends on your implementation wise.

damithc commented 2 years ago

We don't have any requirement/recommendations from the module administration or grading POV. But this is a good topic for discussion/sharing for you guys.