Is it a bad idea to versionarmos classes automatically generated with JiBX?

4

Where I work we have a (very old) project that uses JiBX to generate some classes from schemas . These classes are generated in the build so the source does not exist in the project.

Someone gave the bright idea of getting these source generated and put ( CTRL + V ) within the project, generate them and only when we have some changes in schema .

This does not seem like a good idea, since the generated classes are very bad and this would allow somebody to change them, generating a version that may be incompatible with schemas . >

What arguments can I use to convince the team that this is not a good idea (if it really is not)?

    
asked by anonymous 26.07.2017 / 21:08

2 answers

3

I particularly see some reasons why this is not a good idea:

  • The less code the better. Frameworks exist exactly so we do not have to create codes and more codes if someone (or something) can do it for us: P

  • From the moment you assume that you've created a code, well, the code becomes yours. In other words, you are 100% responsible for ensuring that it is functional and buggy.

  • CTRL + C and CTRL + V? Really? Usually codes generated by frameworks / libs are "ugly" codes. If you really want to put it inside the src folder, at least make an original / better implementation, right?

  • The less code you keep the smaller the size of your repository

  • The less code you maintain the less test you need to have / execute

  • If you use any static code analysis tool (eg Sonar , for example), you can ignore the codes generated by the lib, since they are not really your team.

26.07.2017 / 21:26
4

I understand that this tool, which I do not know, generates bad code, so I should look for another solution.

There must be a reason to be generated in build and not make it available in the project and do not let it . Moreover, the change is likely to occur frequently, so tinkering does not make sense , you'll lose everything in the next build , or when you need a change. These generated codes are made not to mess .

Subverting this seems quite a lack of common sense. If you do not trust the tool, do not use it. I am in favor of using scaffolding , but it needs to be the right and used tool in the way correct.

Reverse the situation . Anything that can generate an effort must be justified. Ask them to argue why. If doing it by doing is not a good argument. If it is to improve or customize the code, you already have the opposite arguments said above. If it's something else you need to look for a reason to counter-argument, but I think it's in those two that I said.

Good or bad practice is the argument of those who have no argument. There is no need for bad practice, there must be a good reason to do something and it can not cause undesirable damage. It has to analyze technically. Bad practice is to avoid analysis and take what someone else has said without knowing their context.

C # has even partial classes so that code generated before build is part of the project and at the same time protected from changes if everything is well structured.

    
26.07.2017 / 21:24