All Questions
5 questions
14
votes
5
answers
5k
views
How to "Tell, don't ask" when 2 objects involves in the condition and the decision at the same time?
According to Explanation on how "Tell, Don't Ask" is considered good OO, I know the following is bad:
if(a.isX){
a.doY();
}
public class A{
public boolean isX;
public void ...
2
votes
5
answers
1k
views
What should a constructor contain?
What should a constructor contain?
In both cases, all three arguments are needed for the class to work.
Which approach is better and why?
1)
class Language {
LanguageRepository ...
8
votes
3
answers
338
views
OOP design problem. Two kinds of empty Optional
I'm writing a quite simple application that deals with hotel rooms reservation. I've got a problem at one stage.
I'm processing a queue of orders. For every order one of the receptionists should ...
5
votes
3
answers
3k
views
Creating a Java project without using any objects and just calling static methods on input?
I'm creating a program which takes a document, extracts it, and then moves this into a database. I've done most of this now and I've realised that I haven't made any instances of classes I've made (I ...
26
votes
5
answers
5k
views
Why is it bad to write something in language X as if you're writing a program in language Y in terms of using a shared coding paradigm [closed]
A while ago, I asked a question on SO about something written in C++, but instead of getting an answer to the problem at hand, the comments went all crazy on my coding style, even when I indicated ...