3 ms·
A related problem: I've been asking for a guide to naming classes/methods for Java, both for myself and for my teammates. I haven't found anything newer than th
by hyperpape 8y ago
A related problem: I've been asking for a guide to naming classes/methods for Java, both for myself and for my teammates. I haven't found anything newer than the old Java beans crap. There are lots of little conventions you find in newer libraries that I'd like to see short explanations of.
In principle, naming things is the same in any language, but languages develop their own conventions.
- proverbialbunny 8y agoUsually what you want is a style guide. eg https://google.github.io/styleguide/javaguide.html https://google.github.io/styleguide/javaguide.html Some times you have to build your own, or borrow from other kinds of sources like: https://cloud.google.com/apis/design/naming_convention https://cloud.google.com/apis/design/naming_convention
- hyperpape 8y agoYeah, guides that cover what the Google Java guide does (capitalization, where verbs go) are plentiful. The example that sent me down this rabbit hole was with in Java. I believe that: foo.withBar(bar) mostly is, and only should be used with immutable APIs (or maybe a builder method), but I've never been able to find a source that says it. I believe this is a sort of convention, but one I haven't seen stated.
- derefr 8y agoI think that's a https://en.wikipedia.org/wiki/Fluent_interface https://en.wikipedia.org/wiki/Fluent_interface, which usually only comes up in the context of functional programmers doing OOP. It's not so much a matter of style, as that certain paradigms live only within certain communities who happen to also have/use other styles and paradigms exclusively, so you never see the paradigm used without its "friends." It might be clearest to state in anthropological terms: .withWhatever() is an "idiom of a particular colloquial dialect of the language, spoken by a subpopulation."