---
# System prepended metadata

title: Web code review

---

# Web code review
- **Duplicated codes**
    - eg. Add Customer has a majority of codes duplicated in Update Customer
    - Whenever we change a text box input and add more, this will lead to updating 2 code base that are almost identical.
    - All features that has Update and Add pages are duplicated 
- **Some Business logic codes are not separated from views** (Separation of concerns)
    - *Presentation / Views* - Displaying data, interaction with the end user, presenting output
    - *Business logic*
        - Determine how data is calculated, changed, and transmitted to end users.
        - Can be reused by multiple views
        - eg. Calculate tax in Quotes / Proposal 
- Lots of console logging, eg. logging unique database ID
- Hard coded values, eg. colors, default coordinates, file paths, etc.
- Lack of error handling
- Unused codes - Comment Junks (codes that are ignored by the application but still part of the code base)
- Misused Meteor js which will lead to performance issues
- There are no user role checks to which a user is restricted to update a specific database collection.
- No documented api
- No testing for atleast business core logic
___
- Untestable components (Unit test)
- No page handling if not found
- Forms are serialized which is expensive, instead of using react js two way binding to pass directly the data for input processing
- Hitting the database twice when fetching a collection and result count
- 


## API (Meteor Js 2.6)
- Not using `check` when passing arguments to publications https://docs.meteor.com/api/check.html, check is a meteor package for checking types.
- Not using `Match.test` similar purpose for `check` but used to identify an argument object structure
- No logging which meteor provides a good package https://docs.meteor.com/packages/logging.html this will be helpful when debugging, instead of using console.log if something went wrong
- Console logging in API side can expose sensitive information
- Publish within a publish