Wednesday, October 30, 2019

Week 8: Second Sprint

By this point I have implemented all the endpoints to the currently required functionality, I have minimal levels of filtering implemented at this stage, I suspect that I'll iterate on this in the future.

Patrick has succeeded at consuming my endpoints for the front end so it's nice to see it all working together. I enjoyed the phase of writing the database query logic, this involved a fair bit of problem solving. For one of the endpoints I had made it inefficient by calling to the database more times than needed, Chris pointed out a smarter direction in which I would only need to call the database once, I learnt the lesson of paying attention to how often I am doing intensive operations like this. In small applications performance is often not an issue but in a business environment like this the software can be holding mass amounts of data, any small inefficiency can heavily affect the programs performance.

The sprint demo commenced as soon as we arrived on Tuesday, with little time to prepare I booted up the API into debug mode and prayed everything worked. Nothing broke which allowed me to gather feedback as to how it was configured and also some extra filtering functionality that I could add in anticipation of us getting to filtering on the front-end further down the line.

Following the demo I moved onto implementing the feedback before we were to do sprint planning the next day. Chris had also pointed out another task regarding the endpoints that I'll need to do, this was the implementation of User Permissions into the endpoints calls, this allowed the endpoints to only return data that the requesting user had permission to see. This would involve quite a bit of re-configuring and a lot of learning into how the structure of user authentication works.


Above is some example code from one of my endpoints, this is inside a service that my statistics interface is implementing, in this I am taking some filter parameters and constructing a database query that I am using to determine the ratio of jobs completed late vs on time. For each filter parameter added I then add additional 'where' clauses to the query to filter to the desired result.


Here at the end of the function I resolve the database query and do some simple math to resolve the ratio at which the selected jobs where completed on time. If it breaks then we need to log the error and return the null result for handling in the controller.

The back-end system follows the above structure for all endpoints, utilizing dependency injection in order to make our service code modular and reduce the dependency between back end operations. The interface sits between the service and the controller and acts to ensure that the service will fulfill the interfaces required public facing methods. 

I'm pleased to be gaining a heightened understanding of the code I'm working with, this will make it easier to add authentication and other features down the line. 



No comments:

Post a Comment