Most Popular
1500 questions
116
votes
10 answers
My coworker commits and pushes without testing
When my coworker thinks that there is no need for a test on his PC, he makes changes, commits and then pushes. Then he tests on the production server and realizes that he made a mistake. It happens once in a week. Now I see that he made 3 commits…
ilhan
- 1,201
116
votes
4 answers
Why is Web SQL database deprecated?
I am making a hybrid Android app.
At first I decided to use localStorage, after spending 2 days, I realized that it is very strange and so dropped it.
Then, I picked up indexedDB, after spending today's whole day and actually getting the output in…
user52009
116
votes
9 answers
How to safeguard a REST API for only trusted mobile applications
How do I make sure my REST API only responds to requests generated by trusted clients, in my case my own mobile applications? I want to prevent unwanted requests coming from other sources. I don't want users to fill in a serial key or whatever, it…
supercell
- 1,527
- 3
- 12
- 11
116
votes
8 answers
Why are many programmers moving their code to github?
For the past 6 months or more, I've been seeing many codes hosted at sourceforge.net as well as other hosting sites "Move to GitHub". A mere Google Search with the phrase "Moved to Github" returns several results containing the text moved to github.…
Chibueze Opata
- 1,355
116
votes
6 answers
Is it better to use assert or IllegalArgumentException for required method parameters?
In Java, which is more highly recommended, and why? Both types will throw exceptions, so in that regard handling them is the same. assert is slightly shorter, but I'm not sure how much that matters.
public void doStuff(Object obj) {
assert obj…
Daenyth
- 8,127
116
votes
16 answers
How to avoid "DO YOU HAZ TEH CODEZ" situations?
I have a strange situation at work, where a colleague of mine often asks me and other co-workers for working code.
I would like to help him, but this constant request of trivial snippets interrupts my thoughts and sometimes makes it hard to…
volothamp
- 300
- 2
- 3
- 9
115
votes
17 answers
Why should 'boneheaded' exceptions not be caught, especially in server code?
I am confused because in quite a few places I've already read that the so-called 'boneheaded' exceptions (ones that result from bugs in code) are not supposed to be caught. Instead, they must be allowed to crash the application:
Vexing exceptions,…
gaazkam
- 4,417
115
votes
3 answers
What is the name of a function that takes no argument and returns nothing?
In Java 8's java.util.function package, we have:
Function: Takes one argument, produces one result.
Consumer: Takes one argument, produces nothing.
Supplier: Takes no argument, produces one result.
...: Other cases handling primitives, 2 arguments,…
superbob
- 1,322
115
votes
12 answers
Best practices for sharing tiny snippets of code across projects
I always try to follow the DRY principle strictly at work; every time I've repeated code out of laziness it bites back later when I need to maintain that code in two places.
But often I write small methods (maybe 10 - 15 lines of code) that need to…
George Powell
- 1,406
115
votes
4 answers
What operating systems are used in airplanes, and what programming languages are they developed in?
I was wondering if anyone knows what is the operating system used in commercial airplanes (say Boeing or Airbus).
Also, what is the (preferred) real-time programing language? I heard that Ada is used in Boeing, so my question is - why Ada? what are…
adhg
- 1,149
114
votes
13 answers
Should a (junior) developer try to push for better processes and practices in their development/IT team?
I'm a junior developer that is given the ability to help shape my team's processes if I can justify the change, and if it helps the team get work done. This is new for me as my past companies more or less had rigidly defined processes that came from…
user321981
114
votes
5 answers
Should I return an HTTP 400 (Bad Request) status if a parameter is syntactically correct, but violates a business rule?
Say that I have a REST endpoint that takes an integer as a parameter:
/makeWaffles?numberOfWaffles=3
In this case, I want the number to be positive because I can't make a negative number of waffles (and requesting 0 waffles is a waste of time). So…
Thunderforge
- 2,708
- 3
- 24
- 30
114
votes
5 answers
Does a `long` ban make sense?
In today's cross-platform C++ (or C) world we have:
Data model | short | int | long | long long | pointers/size_t | Sample operating systems
...
LLP64/IL32P64 16 32 32 64 64 Microsoft Windows (x86-64…
Martin Ba
- 7,608
114
votes
9 answers
Why use try … finally without a catch clause?
The classical way to program is with try ... catch. When is it appropriate to use try without catch?
In Python the following appears legal and can make sense:
try:
#do work
finally:
#do something unconditional
However, the code didn't catch…
Niklas Rosencrantz
- 8,068
- 17
- 57
- 96
113
votes
7 answers
Why declare a variable in one line, and assign to it in the next?
I often see in C and C++ code the following convention:
some_type val;
val = something;
some_type *ptr = NULL;
ptr = &something_else;
instead of
some_type val = something;
some_type *ptr = &something_else;
I initially assumed that this was a…
Jonathan Sterling
- 1,616