Most Popular
1500 questions
179
votes
6 answers
What is the point of using DTO (Data Transfer Objects)?
What is the point of using DTO and is it an out dated concept? I use POJOs in the view layer to transfer and persist data. Can these POJOs be considered as an alternative to DTOs?
Vinoth Kumar C M
- 15,675
176
votes
36 answers
How can programming ability be used to help people in poverty?
As a student studying Computer Science in college, I often hear from friends working on various humanitarian projects, and I want to do something myself. But it seems that programmers don't have as many obvious avenues to help out as, say, doctors…
Matthew
- 303
- 3
- 4
- 11
176
votes
11 answers
Are there guidelines on how many parameters a function should accept?
I've noticed a few functions I work with have 6 or more parameters, whereas in most libraries I use it is rare to find a function that takes more than 3.
Often a lot of these extra parameters are binary options to alter the function behaviour. I…
Darth Egregious
- 1,873
176
votes
24 answers
Elegant ways to handle if(if else) else
This is a minor niggle, but every time I have to code something like this, the repetition bothers me, but I'm not sure that any of the solutions aren't worse.
if(FileExists(file))
{
contents = OpenFile(file); // <-- prevents inclusion in if
…
Benjol
- 3,737
175
votes
17 answers
How can I convince management to deal with technical debt?
This is a question that I often ask myself when working with developers. I've worked at four companies so far and I've become aware of a lack of attention to keeping code clean and dealing with technical debt that hinders future progress in a…
Desolate Planet
- 6,048
175
votes
3 answers
Benefits of Structured Logging vs basic logging
We're building a new app and I'd like to include structured logging. My ideal setup would be something like Serilog for our C# code, and Bunyan for our JS. These would feed into fluentd and then could go out to any number of things, I was thinking…
DTI-Matt
- 1,859
- 2
- 12
- 5
175
votes
11 answers
How should I test randomness?
Consider a method to randomly shuffle elements in an array. How would you write a simple yet robust unit test to make sure that this is working?
I've come up with two ideas, both of which have noticeable flaws:
Shuffle the array, then make sure its…
dlras2
- 2,330
174
votes
23 answers
Programming cleanly when writing scientific code
I don't really write large projects. I'm not maintaining a huge database or dealing with millions of lines of code.
My code is primarily "scripting" type stuff - things to test mathematical functions, or to simulate something - "scientific…
auden
- 1,657
174
votes
21 answers
How do quick & dirty programmers know they got it right?
If you ask programmers why they should write clean code, the number one answer you get is maintainability. While that's on my list, my main reason is more immediate and less altruistic: I can't tell if my new code is correct if it's too dirty. I…
Karl Bielefeldt
- 148,830
174
votes
19 answers
Why are interfaces useful?
I have been studying and coding in C# for some time now. But still, I can't figure the usefulness of Interfaces. They bring too little to the table. Other than providing the signatures of function, they do nothing. If I can remember the names and…
Pankaj Upadhyay
- 5,080
173
votes
21 answers
Stored Procedures a bad practice at one of worlds largest IT software consulting firms?
I'm working at a project in one of the world's top 3 IT consulting firms, and was told by a DBA that company best practice's state stored procedures are not a "best practice". This is so contrary to everything I've learned.
Stored procedures give…
user22453
- 477
173
votes
9 answers
When would someone use MongoDB (or similar) over a Relational DBMS?
I'm a bit confused about the whole NoSQL thing and such.
When would you choose to use something like MongoDB over something like Oracle or MySQL?
I don't really understand the "difference" as far as usage goes between them.
From my understanding…
user6791
172
votes
4 answers
Why is JavaScript not compiled to bytecode before sending over the network?
You'd often see that JavaScript is actually being transported over the web with all the useless stuff that doesn't need to be there -- Comments, particularly those containing licenses, indentations ('\t', '\n'), etc. Given enough time, it could end…
zombiesauce
- 1,431
172
votes
8 answers
Criticism and disadvantages of dependency injection
Dependency injection (DI) is a well known and fashionable pattern. Most of engineers know its advantages, like:
Making isolation in unit testing possible/easy
Explicitly defining dependencies of a class
Facilitating good design (single…
Arkadiusz Kałkus
- 1,870
172
votes
1 answer
Understanding the differences: traditional interpreter, JIT compiler, JIT interpreter and AOT compiler
I'm trying to understand the differences between a traditional interpreter, a JIT compiler, a JIT interpreter and an AOT compiler.
An interpreter is just a machine (virtual or physical) that executes instructions in some computer language. In that…
Aviv Cohn
- 21,538