New learning and findings for Java based spring project

Hello ,
Today I am writing some mistakes we have done for my Event module in GRP

01.All entity should extend a a base class

and lequibase configuration

02. File should be saved in on table not multiple scattered table. just store the reference of file in one separated Table and refer it by src_entity_id and src_entity

03.Use service layer only and complex logic should come form other helper with pattern like builder ,factory ,facade etc. Maintain Single responsibility in this code though dependency injection (if possible)

04. Must use seed data for database in lequibase .Otherwise I will create more head ace in future development. Seed data should be hard-coded (Must otherwise create confusion)

05. Maintain foreign key constraint with Not null and also follow JPA convention . Never use raw query in project use View in lequibase other wise it will be difficult in refactoring

06. Maintain a consistency in project wise development among team members so that any code or business logic can be reused , refactored and understood clearly . Remember TWO same code is EVIL

05.Use logger with complete logging with in out parameter .So that debugging is easier .

06.Clear domain knowledge and make documentation as more as possible to make effective production grade code.

07. Use reactive form in angular instead of template driven form

08.Helper will not contain any logic in angular 6.
09.Use a architecture .(Hexagonal) and make consistency along with project.Use same operation for all the CRUD and complex logic operation
10.Put logic in controller specially the business operation. Use Service for dependency.
11.A row should be updated on a service method and complex processing use pattern as helper and reuse it possibe
12.Always use DTO / ViewModel for all logic .
13.Use constructor injection for testing .
14.Write unit test(moqito and junit) and api integration test(mokmvc)
15.A line should be one responsibility dont use

return iservice.getMeThis();

instead
var testObject = iservice.getMeThis();
return testObejct;

Leave a Reply

Your email address will not be published. Required fields are marked *