Aims to explore alternative approach for OOD implementation.
jest and eslint does not seem to support very modern javascript syntax like private class fields etc
Solution of problem
Tested out the appraoch for Comments, will implement on rest once decided upon design
Encapsulates Router, Model and Controller into one entity which simplifies the codebase, provides an easily usable interface through the last descendent class
Model, Controller and Router as Abstract classes, their public members can be accessed through instantiation of last descendant class Comment which is singleton
Wrapped middlewares in an Abstract class with public static members
solved issues with eslint and jest
Class UML Diagram
Here is a very basic UML Diagram which explains the design a bit, the last descendent class Comment is the only instantiable class and follows the singleton patters, only one object of it can be made and that is accessed in the app and test files
Yet to be implemented / Wishlist
Implement this for all
make interfaces for general Model, Router and Controller which will be implemented by Models, Routers and Controllers specific to classes like User, Event, Comment etc
Look for better ways to relate Model, Router, Controller and Comment. Multiple Inheritance, Friend Class etc are not supported in javascript.
Seperate App and the sockets part, simplify app.js and create a new file index.js providing the functionality of bin/www and will instantiate App and Socket classes
Look for ways to make the database instantiable only inside the App Class
Wrap utils in a class
Create a UML class diagram for the entire app, this would make understanding the codebase easy for new contributors
Tests
Functionality of the code is alright, All test cases for Comments pass successfully
Please share feedback and suggestions.
Type of Change
[ ] Bug fix
[x] New Feature
[ ] Development of UI/UX prototypes
[ ] Small refactor
[ ] Change in Documentation
Checklist
[x] My code follows the same style as the codebase
[ ] My Code change requires a change in documentation
[ ] I have updated the Readme accordingly
[x] I made PR against development branch
[x] I have run the test cases locally and it's passing.
Problem
Solution of problem
Class UML Diagram
Yet to be implemented / Wishlist
Tests
Please share feedback and suggestions.
Type of Change
Checklist