Most Popular

1500 questions
59
votes
3 answers

Why does C# allow properties in interfaces?

In C#, the following code is valid interface I{ int property{get;set;} } Which doesn't make any sense to me. This seems to break one of the most important principles of interfaces: lack of state (in other words, no fields). Doesn't the…
59
votes
22 answers

What happens if you're unable to solve a problem?

I'm a year away from graduating from university, and I'm really looking forward to solving practical problems. Especially non-trivial ones which require a bit of research and a lot of thinking. But at the same time, that is also my greatest fear -…
gablin
  • 17,407
59
votes
5 answers

How can you estimate time for tasks which primarily consist of figuring out a problem?

While it is relatively possible for an experienced developer to estimate how long it will take to implement code when the pattern and problem the code is solving is well understood, how can you make a good estimate when, while the end goal is well…
59
votes
14 answers

Keep a programming language backwards compatible vs. fixing its flaws

First, some context (stuff that most of you know anyway): Every popular programming language has a clear evolution, most of the time marked by its version: you have Java 5, 6, 7 etc., PHP 5.1, 5.2, 5.3 etc. Releasing a new version makes new APIs…
Radu Murzea
  • 1,820
59
votes
5 answers

Using public final rather than private getters

I see most immutable POJOs written like this: public class MyObject { private final String foo; private final int bar; public MyObject(String foo, int bar) { this.foo = foo; this.bar = bar; } public String…
59
votes
9 answers

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; } public void setField(String field) { …
59
votes
4 answers

Does having a higher paid technical job mean you do not get to code any more?

I work at a large company where technical people fall roughly in one of these categories: A developer on a scrum team who develops for a single product and maybe works with other teams that are closely related to the product. An architect who is…
c_maker
  • 8,280
59
votes
7 answers

How important is it for a programmer to know how to implement a QuickSort/MergeSort algorithm from memory?

I was reviewing my notes and stumbled across the implementation of different sorting algorithms. As I attempted to make sense of the implementation of QuickSort and MergeSort, it occurred to me that although I do programming for a living and…
59
votes
17 answers

Single statement if block - braces or no?

Which is better/more generally accepted? This: if(condition) { statement; } Or: if(condition) statement; I tend to prefer the first one, because I think it makes it easier to tell what actually belongs in the if block, it saves others from…
59
votes
8 answers

Story points for bug fixing tasks: Is it suitable for Scrum?

I'm just wondering if we should assign story points to bug fixing tasks or not. JIRA, our issues-tracking software, does not have story point field for Bug type issues (it's only for Storys and Epics). Should we add the Bug issue type to the…
palacsint
  • 952
59
votes
16 answers

FizzBuzz - really?

When it comes to "interview test" questions, the subject of FizzBuzz often comes up. There is also a Coding Horror post about it. Now, if you bother reading sites such as this, you are probably less likely to be in the demographic of programmers who…
DanSingerman
  • 1,671
  • 3
  • 15
  • 14
59
votes
5 answers

get weighted random item

I have, for example, this table +-----------------+ | fruit | weight | +-----------------+ | apple | 4 | | orange | 2 | | lemon | 1 | +-----------------+ I need to return a random fruit. But apple should be picked 4 times as…
fl00r
  • 701
  • 1
  • 6
  • 8
59
votes
6 answers

Why aren't there other programming languages that compile to Python bytecode?

In Java, there are multiple languages that compile to Java bytecode and can run on the JVM -- Clojure, Groovy, and Scala being the main ones I can remember off the top of my head. However, Python also turns into bytecode (.pyc files) before being…
Michael0x2a
  • 1,119
  • 1
  • 7
  • 23
59
votes
16 answers

why do some job posts say "high pressure environment"?

Why would there be any pressure if everyone knows what they are doing and the projects are accurately estimated? If there's pressure, or even high pressure, then it implies what they are currently doing is not working, why would any good programmer…
Andy
  • 599
59
votes
12 answers

Is it considered bad practice to have PHP in your JavaScript

So many times on this site I see people trying to do things like this : I don't…