When implementing the process to generate the Client class using the Builder pattern I'm a group that specifies the parameter name as it is, such as "header" or "body" for the method name that sets the parameter. It would be nice to have a verb such as set or add as a prefix, which is more Java-like and easier to understand. There was a story. (It is difficult to understand whether it will be overwritten or added if it is only header = the result is difficult to understand)
In the frameworks and libraries I have used, there are many images with only parameter names, but Speaking of Java-likeness, it certainly feels better to have a prefix as a verb. (Easy to understand) Even in the explanation of the Builder pattern on the net, there are many parameter names only, so I think that only the parameter names are standard (personally), but which is more common? ..
+α In connection with the above, I also talked about the likes and dislikes of method chains. I'm a method chain lover, so I want to use it a lot in implementation. However, I received the opinion that "If it is written all in one line, it takes time and effort to erase only the place you want to erase, so it is not good." It is a matter of likes and dislikes, but there are many people who are not good at it. I received the recognition that it was. (I like it because I can describe it concisely.)
It was mentioned as a topic in the story, so I tried to write it somehow.
Which party are you? I love parameter names only + method chains.
Recommended Posts