Reputation
1,039
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
5 16
Newest
 Custodian
Impact
~29k people reached

Jan
17
comment How to deal with Classes having the same name (different packages)
If it's occasional it probably does not matter - if it is a recurring pattern I would probably name the classes more precisely to prevent it from becoming a mess.
Nov
27
comment Using BSD licensed source code in a product under a new license and a hypothetical scenario
It is generally not recommended to cross post questions across sites. You could flag your question (flag link below question), select "in need of moderator intervention" and ask if your question can be migrated. The fact that is has a bounty may delay that migration... Or you could ask on meta what the right course of action is.
Nov
27
comment Using BSD licensed source code in a product under a new license and a hypothetical scenario
You could also have asked here: opensource.stackexchange.com
Nov
19
comment Do I need to use an interface when only one class will ever implement it?
@Jules It depends on your mocking framework - with jmockit for example, you can just write new Mockup<YourClass>() {} and the whole class, including its constructors, are mocked, whether it's an interface, abstract class or concrete class. You can also "override" the constructor behaviour if you wish to do so. I suppose there are equivalent ways in Mockito or Powermock.
Nov
19
comment Do I need to use an interface when only one class will ever implement it?
@Jules You can mock a concrete class including its constructor in Java.
Jun
27
comment How to use Guice for an effective API Design?
You typically create the injector once, for example in your main, to setup the modules you want and then just use @Inject where you need...
Jun
14
comment Best way to handle blank dates
You should probably not use Optional<XX> as a field - it's really meant to be used as a return type from a method. So in this case I would have a private LocalDate dateOfBirth field that may be null - but getAge or getDateOfBirth could return an OptionalInt or Optional<LocalDate> respectively.
Jun
14
comment Why should PHP developer use/learn VI editor?
stackoverflow.com/questions/208193/why-should-i-use-an-ide
Jun
9
comment Using an LGPL licensed library that may or may not include GPL licensed code from an MIT licensed library
only 4...... :-)
Feb
27
comment 2 methods that are 75% the same?
The if/else thingy is quite ugly. You should have two methods for the specific parts (the if/else blocks) and another method for the common part - that would be much cleaner IMO...
May
27
comment How to analyze a scenario where a bug didn't get caught and adjust development workflow to prevent similar errors
@RobertHarvey I would suggest the other way round: write a test that goes red then fix the code!
Apr
3
comment Are monads a viable (maybe preferable) alternative to inheritance hierarchies?
Not sure I understand how it works: a squirrel and a duck don't fly the same way - so the "fly action" needs to be implemented in those classes... And the flier needs a method to make the squirrel and the duck fly... Maybe in a common Flier interface... Oops wait a minute... Did I miss something?
Apr
1
comment Java's Boolean class - why not an enum?
It wouldn't have been very difficult to add a of or from method and appropriate javadoc.
Apr
1
comment Make methods that do not depend on instance fields, static?
There is an important distinction between static methods with and without side effects. The Google extract really addresses the former.
Mar
31
comment Why is CPU cache memory so fast?
What every programmer should know about memory
Mar
20
comment Java Method Returns Unbounded Type
To simplify, SO is for questions about specific issues with a specific piece of code. Programmers is for higher level question such as design and architecture, algorithms etc. So in this instance SO would probably be a better fit.
Mar
19
comment Java Method Returns Unbounded Type
@thlim Actually I think my answer is incorrect. You would probably get more and better answers on stackoverflow.
Mar
7
comment What exactly is the Garbage Collector in Java?
@back2dos See for example programmers.stackexchange.com/a/149569/47845 - I did not say GC is the only option, only that it has become very efficient (BTW object pooling can actually perform worse in some cases). As for the blocking of the GC - it may or may not be an issue depending on your use case (and even that issue has been reduced significantly by modern concurrent GC algos) - if you need pure real time then yes, GC will be an issue. So I do believe that a modern GC will perform way better than what 99% developers could do by managing memory manually. There is the 1% of course.
Mar
4
comment What exactly is the Garbage Collector in Java?
Your answer maybe understates the power and performance of algorithms. Java's gc (probably other languages too) is extremely good at managing short lived objects making object allocation an extremely cheap operation. Not only does it prevent bugs but it can also improve performance vs a naive manual approach.
Feb
11
comment Choosing value in SQL query vs (Java) code
If it is null final int id = rs.getInt("Id"); will throw an exception...