Most Popular

1500 questions
55
votes
9 answers

Is a single config object a bad idea?

In most of my applications, I have a singleton or static "config" object, in charge of reading various settings from disk. Almost all classes use it, for various purposes. Essentially it's just a hash table of name/value pairs. It's read-only, so I…
JW01
  • 1,011
55
votes
2 answers

When not to use Google Web Toolkit?

I'm considering use of GWT on a major in-house web app development project, namely it's major advantage in my eyes is the cross-compilation to Javascript which would (at least theoretically) help my team reduce the size of tech stack by one. …
Jas
  • 6,323
55
votes
7 answers

Are there known valid uses of SLOC to measure productivity?

I had an unusual, brief conversation with a very senior architect about dynamic and static languages. He said that company data shows that there is evidence for higher productivity when static languages are used. Note, it's a large company with long…
sevo
  • 621
55
votes
4 answers

Are the development benefits of using Docker negated when using Java compared to other languages closer to Unix binaries?

I had a friend who said: Docker is amazing. You can use it to replicate production and all its quirks on your local machine. Then you can deploy that instance straight through all the staging workflows super-quick. Now this would be true if the…
hawkeye
  • 4,819
55
votes
6 answers

Is using Lambda expressions whenever possible in java good practice?

I have recently mastered the Lambda expression that was introduced in java 8. I find that whenever I am using a functional interface, I tend to always use a Lambda expression instead of creating a class that implements the functional interface. Is…
SteelToe
  • 1,559
55
votes
10 answers

Why would the 'final' keyword ever be useful?

It seems Java has had the power to declare classes not-derivable for ages, and now C++ has it too. However, in the light of the Open/Close principle in SOLID, why would that be useful? To me, the final keyword sounds just like friend - it is legal,…
Vorac
  • 7,129
55
votes
5 answers

Are Python mixins an anti-pattern?

I'm fully aware that pylint and other static analysis tools are not all-knowing, and sometimes their advice must be disobeyed. (This applies for various classes of messages, not just conventions.) If I have classes like class related_methods(): …
cat
  • 744
55
votes
7 answers

Why is chaining setters unconventional?

Having chaining implemented on beans is very handy: no need for overloading constructors, mega constructors, factories, and gives you increased readability. I can't think of any downsides, unless you want your object to be immutable, in which case…
Ben
  • 1,002
55
votes
4 answers

Why do we need frameworks for dependency injection?

I've been reading up more on the Inversion of Control principle and Dependency Injection as an implementation of it and am pretty sure I understand it. It seems to be basically saying 'don't declare your class members' instantiations within the…
timsworth
  • 661
55
votes
2 answers

What is the difference between function() and function(void)?

I have heard that it is a good practice to write functions that do not receive anything as a parameter like this: int func(void); But I hear that the right way to express that is like this: int func(); What is the difference between these two…
Grizzly
  • 579
55
votes
12 answers

Why would a program require a specific minimum number of CPU cores?

Is it possible to write code (or complete software, rather than a piece of code) that won't work properly when run on a CPU that has less than N number of cores? Without checking it explicitly and failing on purpose: IF (noOfCores < 4) THEN don't…
uylmz
  • 1,129
55
votes
7 answers

What is wrong with Java's generics?

I have seen several times on this site posts that decry Java's implementation of generics. Now, I can honestly say that I have not had any issues with using them. However, I have not attempted to make a generic class myself. So, what are your issues…
Michael K
  • 15,599
55
votes
3 answers

What are the advantages of Scala's companion objects vs static methods?

Scala has no static-keyword, but instead has similar functionality through companion objects. Behind the scenes the companion objects are compiled to classes that have static methods, so all this is syntactic sugar. What are the advantages of this…
Zavior
  • 1,344
55
votes
10 answers

Doesn't "if (0 == value) ..." do more harm than good?

This is one of the things that I hate most when I see it in someone else's code. I know what it means and why some people do it this way ("what if I accidentally put '=' instead?"). For me it's very much like when a child goes down the stairs…
mojuba
  • 5,623
55
votes
8 answers

Why would one bother marking up properly and semantically?

Note that I (try) to mark up as semantically as possible because I like they way it looks and feels, but not because I'm aware of any other stunning advantages. The point of my question is to be able to educate others Well, I've seen a lot of…