Reputation
1,539
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
7 11
Impact
~212k people reached

13h
comment Snake case, camel case and nr 3?
I'm sure COBOL programmers would suggest a fourth style.... 'OPEN INPUT' etc.
Apr
29
comment Testing properties with private setters
Can't you configure your mock as returning a further set of mocked objects ? Those mocked objects would be set up with districts. Or, just return objects adhering to the same interface (with District fields) that aren't your specific entity objects
Apr
29
comment What's the difference between a function and a method?
What about docs.oracle.com/javase/8/docs/api/java/util/function/… ?
Apr
27
comment Set data in multi-level objects (may be using Java Reflection)
I assume (!) it's just using reflection, like the original questioner's code, but someone has gone through the development pain in advance. I think the XPath compilation takes some time, but I seem to remember you can do a precompilation of that. To reiterate, I don't think it's a good solution for the above, but rather I've used it when I've want to be able to specify attributes in an object hierarchy that I want to extract configurably. And for unit tests occasionally.
Apr
27
comment Set data in multi-level objects (may be using Java Reflection)
@Laiv - see my answer and the suggestion to use JXPath (I wouldn't normally recommend this, note)
Apr
26
comment Checking preconditions the proper way
AOP is certainly another approach that would work here, yes
Apr
22
comment Redesigning a builder to make it reusable
I'm sure you can do this without Spring ? I'm not against Spring, but I wouldn't advocate adopting it just for this
Apr
21
comment Single exit point meets Java streams
"this version is a lot more readable" - I realise this is largely subjective, but I would have to disagree with you there!
Apr
21
comment Method returning an unmodifiable list
@Jules - Yes, you're absolutely right re. Collection, which for some reason I'd thought didn't allow removal. Now amended. However I think the original intent of the answer is still perfectly valid
Apr
20
comment Abstract Factories Nesting and DI - Is this acceptable?
@RobertHarvey - can you elaborate. pls ? I'm not sure I can see the issue you're referring to
Apr
19
comment How to handle when only certain derived classes need to be disposed?
Downvoted why ?
Apr
19
comment Alternatives on how to deal with data fetched from external API
I probably wouldn't do that on the client side, but rather have a specific service that performs that merge and sends client-focused (optimised) data to your clients
Apr
18
comment How to warn other programmers of class implementation
@Oxinabox - my thoughts exactly, and some trivial implementation via a dynamic proxy (if you're using Java) would be the way forwards
Apr
16
comment How to warn other programmers of class implementation
You'll note that the exception throwing is one possible option and I go on to elaborate on my preferred option - making this compile-time safe. I've edited my answer to emphasise this
Apr
16
comment Method returning an unmodifiable list
The runtime enforces this but the compiler doesn't. So someone can write code that will throw an exception when running. You really want the compiler to reject the code out of hand instead
Apr
15
comment Method returning an unmodifiable list
@kai - I would certainly advocate such an approach if you simply want a client to iterate across it (see my answer below)
Apr
13
comment How do I deal with unneeded inherited members?
"Restructuring the hierarchy, but I didn't really look at this in too much detail." - I think this is the key statement here. I think this is the way to go, most probably
Apr
11
comment Is this the wrong environment for CI?
I'm not confusing CI with automated testing, but the CI gives you the automated testing in a proper independent environment such that you don't have to worry about it