Tagged Questions
14
votes
9answers
2k views
Are too many if-else statements for validation bad? [duplicate]
From the book Professional Enterprise .Net, which has 5 star rating on Amazon that I am doubting after having a read through. Here is a Borrower class (In C# but it's pretty basic; anyone can ...
4
votes
3answers
536 views
Code review if nobody in team has knowledge in some technology?
Sample situation: A team of Java developers starts an iOS project. Only one developer has Objective-C/iOS knowledge, and in the beginning he will work on this project alone.
How we can perform code ...
0
votes
1answer
226 views
Really bad example projects that use sonar [closed]
When consideringen whether to use sonar or not, it would be great to see both good code as well as bad code that use sonar for static code analysis.
I have browsed http://nemo.sonarsource.org/ ...
15
votes
5answers
785 views
Is this pattern bad? [duplicate]
I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing ...
4
votes
3answers
417 views
HTML code in Java class
A conceptual question, I tried to google but couldn't find any definitive answers, so here it goes:
Is it a good practice to write Java methods to return HTML strings that will be returned to the ...
5
votes
1answer
266 views
Is there a modern replacement for a mutation testing tool like Jester for Java?
“Why just think your tests are good when you can know for sure?
Sometimes Jester tells me my tests are airtight, but sometimes the
changes it finds come as a bolt out of the blue. Highly ...
1
vote
2answers
107 views
@Deprecated as of version x.y in JavaDoc
This question & its answers are useful but not sufficient for my problem.
My Question is if I want to add a javadoc as @Deprecated As of version x.y, replaced by {@link SomeClass} in my current ...
3
votes
1answer
782 views
Why Doesn't Java Allow Default Parameters/Arguments [closed]
Basically something like
public void jumpToRoom(String roomName = Rooms.DEFAULT_ROOM)
would be convenient.
Many languages nowadays seem to support it (Ruby, PHP, even C#).
What is Java's ...
47
votes
10answers
3k views
When does “proper” programming no longer matter?
I've been building an android game in my spare time. It's using the libgdx library so quite a bit of the heavy lifting is done for me.
While developing, I carelessly selected datatypes for some ...
13
votes
2answers
708 views
What is the best approach for inline code comments?
We are doing some refactoring to a 20 years old legacy codebase, and I'm having a discussion with my colleague about the comments format in the code (plsql, java).
There is no a default format for ...
4
votes
1answer
223 views
Distinguishing repetitive code with the same implementation
Given this sample code
import java.util.ArrayList;
import blackjack.model.items.Card;
public class BlackJackPlayer extends Player {
private double bet;
private Hand hand01 = new Hand();
...
8
votes
11answers
5k views
Why is using System.out.println() so bad? [closed]
Of course, it is very good use to use a logging framework for the error messages or warnings. But sometimes I use System.out.println() if I want to try something new in a short time.
Is it really so ...
0
votes
4answers
246 views
Is 'Protection' an acceptable Java class name
This comes from a closed thread at stack overflow, where there are already some useful answers, though a commenter suggested I post here. I hope this is ok!
I'm trying my best to write good ...
9
votes
5answers
900 views
Is it bad coding practice to create something in a get if it does not exist?
So I have a webservice that has something like a getAccount where it would return an identifier to the account if it got it, else throw an exception. The client will always want to create an account ...
25
votes
5answers
1k views
Is use of finally clause for doing work after return bad style/dangerous?
As part of writing an Iterator, I found myself writing the following piece of code (stripping error handling)
public T next() {
try {
return next;
} finally {
next = ...