Top tag
Next privilege 2,000 Rep.
Edit questions and answers
5 10
~10k people reached

  • 0 posts edited
  • 0 helpful flags
  • 26 votes cast
comment Why would a type be coupled with its builder?
@Mat'sMug Within the package, either String consumes StringBuilder, StringBuilder consumes String, or they're colocated in the same top-level class. Outside the package, it doesn't really matter; they're both integral parts of the same API surface. And, for a lot of relevant commentary, see this API design talk by Josh Bloch where he explains his advice and (like in Effective Java 2nd Edition) he critiques the bad API design choices in the Java libraries. Link goes to 36:41, but the whole talk is worth watching.
comment Why would a type be coupled with its builder?
@Mat'sMug My post above takes it as a given that the class needs that many constructor arguments. I'd likewise treat it as a design smell if we were talking about an arbitrary business logic component, but for a data object, it's not of the question for a type to have ten or twenty direct attributes. It's no violation of SRP for an object to represent a single strongly-typed record in a log, for instance.
comment Are (database) integration tests bad?
@dodgethesteamroller Whether something is contrarian IS a matter of opinion or perspective; in a few years it may be the dominant line of thinking, for all I know. Don't read into my punctuation; my point is specifically not to judge it and merely to say that that if you think it's contrarian, and expound on it in 2 (now 3) comments, it's time for it to be an answer.
comment Are (database) integration tests bad?
@dodgethesteamroller In-depth discussions of a "contrarian school" like that are probably best suited to their own answer. Personally, I find that the Google Testing Blog does a pretty good job describing the virtues of fast, tightly-scoped automated tests alongside system-in-context tests. In case you found it unclear, I list the test pyramid here as a useful model or starting point, not as an excuse to stop thinking as an engineer.
comment What is the motivation behind the @ImplementedBy annotation in Guice?
Related, possibly duplicate question (though your title is clearer): Is Guice's @ImplementedBy evil?
comment What is the advantage of wrapping exceptions
Should you have a copy of Josh Bloch's Effective Java Second Edition laying around, item 61 ("Throw exceptions appropriate to the abstraction") describes this well.