Reputation
25,622
Next tag badge:
90/100 score
33/20 answers
Badges
2 45 107
Impact
~1.2m people reached

18h
comment Are there guidelines on how many parameters a function should accept?
Never add boolean switches to alter function behavior. Split the function instead. Break out the common behavior into new functions.
1d
awarded  Popular Question
Feb
2
comment Great Programmer Productivity - Accounting for 10,000 fold difference?
@hotpaw2: True, I wasn't thinking of anything so dramatic. I was thinking of problems with a bit of mathematical complexity, e.g. graph computations like topological sort. An average engineers may spend weeks writing a slow and buggy solution. A great engineer will map the business requirements to a well-known problem, then search for a published library or algorithm.
Feb
1
comment Is break a code smell?
@BobDalgleish: separating the loop into a separate function is almost always beneficial.
Feb
1
awarded  Nice Answer
Jan
16
comment Methods of debugging code (Nightmare situation)
how I manage these situations: if I'm not being paid well above market, I go find something else to do.
Jan
15
comment What are good habits for designing command line arguments?
for almost all languages there are library functions to handle command line arguments. Use one of them.
Jan
13
comment What is wrong with this substring-matching algorithm?
@user666254: I provided two examples in my comments.
Jan
13
comment What is wrong with this substring-matching algorithm?
@user666254: I would probably have called them 't' and 's' and left the rest as an exercise for the reader. Small scope -> short name.
Jan
13
comment What is wrong with this substring-matching algorithm?
@DavidArno: The interviewer should have asked the candidate about the failing test cases, rather than just saying it was "disappointing". However, this code would not meet the bar at most of the places I have worked. The use of "yield" is not the problem.
Jan
13
comment What is wrong with this substring-matching algorithm?
Also "charIndexToMatch" is unnecessarily long but worse, doesn't say which of the two strings it is indexing. "subtextIndex" would be shorter and better. All this is off-topic here. Maybe repost to Code Review.
Jan
13
comment What is wrong with this substring-matching algorithm?
Are you sure it works? Suppose the input text is "aaabc" and the text to find is "aabc". Also consider "aaaa" and "aa". Did you ask the interviewer about overlapping matches? Similar problems arise constantly in real-world programming. Serious companies are looking for the people who will find and resolve those problems before the code is delivered.
Jan
9
answered Implementing “buy one get one for free” coupon logic for shopping cart
Jan
8
comment How do I have a group of numbers which total does not exceed a limit, and each number must be >= 0?
why are you finding this difficult? what's the application? seems like a pretty artificial problem, i.e. homework
Jan
8
answered Are exceptions only for handling errors?
Jan
8
answered Create arithmetic expression from number using +-/* that equals target
Jan
8
answered Object Oriented Design
Jan
5
comment Spring StoredProcedure Inject declared parameters or not?
"just changing the XML" -- I have found it much easier to modify the Java code. At least the compiler provides some verification that my changes have a chance to work. "Just changing the XML" is much less likely to work the first time.
Jan
1
comment Automatic builders/chain setters for Java?
There are two strong reasons to NOT use IDE code generation: 1. the generated code is just noise to future readers, and 2. the generated code doesn't maintain itself.
Jan
1
comment Automatic builders/chain setters for Java?
Since you have brought Lombok into the picture, you should eliminate the get methods and use @Getter.