Which tricks do you use to write less code?

by jordiburgoson 5/10/2024, 2:12 PMwith 1 comments

I found some "tricks" to write less code, hence less code to maintain if there are any changes. Also less code with bugs just by changing the inputs.

For example, OpenAPI spec file + OpenAPI generator (https://github.com/OpenAPITools/openapi-generator). Any changes in the OpenAPI spec are reflected in the final code with a build step.

Another example: MapStruct (https://mapstruct.org/) to avoid passing data from Entity classes to DTO and back. Saves looots of boilerplate code.

I don't have much to say for frontend as I am mainly working on backend. So good to know your stuff.

Which are your tricks?

by h2odragonon 5/10/2024, 2:20 PM

two or three letter variable names. If your scope has more than 17k variables you're doing something badly wrong anyway.