DEV Community

Discussion on: Review your auto-generated code

Collapse
 
agazaboklicka profile image
Aga Zaboklicka

Nice job!
I remember when I've first used code generator when I was still programming in C++. It was the tool built in Visual Studio that generated a code of UI based on what you clicked. The generated code was scary: hard to understand and even harder to modify! I decided that next time I need UI I'd rather write it myself. Well, those times passed by and I really came to appreciate code generators built in IDE (I use Eclipse ;) - has pretty decent source generator, you can customize for example the visibility of methods).
I agree it's important to review what was autogenerated and what that code is doing. However, I wouldn't be so crazy to review the code every time I generate getters and setters (in eclipse you can choose what functions you generate for what variables and with what level of visibility/keyword). The source code generator is pretty deterministic and there are things that are generated on regular basis. I believe that if you review what you generated few times you'll know what to expect and what always has to be changed and what can stay as it is ;)