Important guidelines that one has to follow. Following guidelines are in no particular order.
Git Branch Management:
Main:
When fixing production bug
When creating a new feature because there is a possibility that other features of stage and review-dev might not go live with this feature
Stage:
When fixing a stage bug
Review-Dev:
When fixing a dev bug
When several features are supposed to go live together are also in review-dev
Feature Branch:
When building a feature such as ACS, create a branch acs_branch from main
Now all developers should work on this acs_branch
this branch will be merged into review-dev, stage and main
Unit Test:
Whatever the situation, always write unit tests
All service method unit test cases are must
Indexes:
Whenever doing a search on a single column or multiple columns, then create index over it
Keep in mind not to create several indexes in a table as it will slow down insertion
Logging:
Always do logging for whenever any exception or error is occurring
In case of new code, dont hesitate to put log.info
Once code is stabilised then remove log.info
Documentation:First document or create RFC before doing coding
Do proper logging at controller level
@Tag( name = "CRUD Rest APIs for Accounts in EazyBank", description = "CRUD Rest APIs for create,read, delete and update" ) @RestController @RequestMapping(path="/api",produces = MediaType.APPLICATION_JSON_VALUE)
proper logging at every API level
@Operation( summary = "Create Account Rest API", description = "REST API to create new customer" ) @ApiResponses ({ @ApiResponse ( responseCode = "201", description = "HTTP status created" ), @ApiResponse( responseCode = "500", description = "HTTP Status Internal Server Error", content = @Content( schema = @Schema(implementation = ErrorResponseDto.class) ) ) })
Varchar Size in database:
Use 1, 3, 7, 15, 31, 63, 127 and 255
Equals:
Put constant first or left hand side of equals
eg if(otp.equals(“123456”) is incorrect
use if(“123456”.equals(otp) is incorrect
Crons:
Don't write crons in any service
Write it in cron service which will have one instance
if you write cron in a service having multiple instances then multiple version of crons will run
Authentication:
Its must in service to service
Use cosmos unless specifies
Frontend and Backend Separation:
Keep frontend and backend code is different services
Management of config
Please inform Entreprise Architect before changing config properties such as application.dev properties
One Service - One Database
Each service should have its own database
Two services shouldnt use same database
One service shouldn’t use more than one database
Management of libraries:
Dont keep databases in libraries
If library is heavy then do work to create new micro-service
If changing a library requires headache and change in several services then time to get rid of library and create a new microservice .
Latest Version:
Use latest version of java
latest version of springboot and other libraries.
It shouldn’t be required to set it separately.