Tagged Questions
4
votes
2answers
566 views
Is it a bad habit to (over)use reflection?
Is it a good practice to use reflection if greatly reduces the quantity of boilerplate code?
Basically there is a trade-off between performance and maybe readability on one side and ...
2
votes
2answers
300 views
Programming methodology - best way to level up? [closed]
Ok, so I'm at a point where I think I have my basics down. I'd like to think I'm just starting to become an intermediate dev. So, how do I level up here?
It feels like I have reached my threshold, ...
1
vote
2answers
95 views
Wrapping specific checked exception in domain unchecked ones? [duplicate]
Uncle Bob says in Clean Code book that Unchecked Exceptions should be used. Now JDK has some checked exceptions: IOException, IllegalAccessException etc. which cannot be avoided.
In my application ...
5
votes
4answers
517 views
Differences in If… Else… statement
When I first started to learn programming I remember having an argument with my teacher about If Else statements. I was arguing that:
if {
...
} else if {
...
} ...
is basically the ...
3
votes
4answers
519 views
Replacement for instanceof Java?
So I'm fairly new to programming in the real world (outside of academic projects) and have come across lots of posts saying that using instanceof is a bad thing to use to determine what class a ...
15
votes
9answers
1k views
Should the methods of a class call its own getters and setters?
Where I work I see lots of classes that do things like this:
public class ClassThatCallsItsOwnGettersAndSetters {
private String field;
public String getField() {
return field;
...
13
votes
2answers
616 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 ...
6
votes
5answers
284 views
Everything has an Interface [duplicate]
Possible Duplicate:
Do I need to use an interface when only one class will ever implement it?
I am taking over a project where every single real class is implementing an Interface. The ...
2
votes
2answers
635 views
Best practice for packing Java enums?
What is the best practice for packaging Java enums?
is it separate file for each enum?
or
having same file for all the enums?
What are the pros and cons ?
22
votes
2answers
4k views
Choosing between Single or multiple projects in a git repository?
In a git environment, where we have modularized most projects, we're facing the one project per repository or multiple projects per repository design issue. Let's consider a modularized project:
...
8
votes
11answers
3k 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 ...
2
votes
3answers
171 views
A place for putting code samples in projects
Every now and then I get or write some minimal code samples to achieve tasks. What's the usual practice for storing these samples (which could prove useful later on) ? Have a separate source folder or ...
4
votes
2answers
657 views
Multiple Same Object Instantiation
What exactly happens in Java when you instantiate the same object multiple times?
For example:
Test test = new Test();
then later on I will call it again, Test test = new Test(); again or inside a ...
5
votes
3answers
270 views
When module calling gets ugly
Has this ever happened to you? You've got a suite of well designed, single-responsibility modules, covered by unit tests. In any higher-level function you code, you are (95% of the code) simply ...
79
votes
10answers
7k views
Should we avoid object creation in Java?
I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible.
This seems somewhat to defeat ...