428 karma · joined January 8, 2019
> "And we certainly don’t want more Elon Musks in the world."
Apart from these 2 statements, I largely agree.
My current approach is that I try to guess (or ask) how a customer understands or checks a statement/invoice. The customer usually takes a calculator and enters the rounded numbers they see. I then try to do all programmatic calculations exactly the same way: Operation - round - operation - round etc, with rounding-steps at exactly the same places where these values will be visible to the customer, and with the same number of decimal places (can vary). Sometimes that is not possible of course, which is usually solved with a final row called 'rounding errors in the customer's favor').
For my (smaller) systems I find floats sufficient and easier to work with compared to the alternatives, which tend to make code very verbose and annoying to read.
public class Test {
public static enum Outcome {
B_Mo, B_Tu, B_We, B_Th, B_Fr, B_Sa, B_Su, G_Mo, G_Tu, G_We, G_Th, G_Fr, G_Sa, G_Su;
boolean isBoy() {
return this == B_Mo || this == B_Tu || this == B_We || this == B_Th || this == B_Fr || this == B_Sa || this == B_Su;
}
}
public static void main(String[] args) {
Random r = new Random();
int count_experiments = 1_000_000_000;
double count_possible_given_info = 0;
double count_interesting = 0;
System.out.println("theoretical (13/27): " + (13.0 / 27.0));
for(int i = 0; i < count_experiments; i++) {
Outcome child_1 = Outcome.values()[r.nextInt(Outcome.values().length)];
Outcome child_2 = Outcome.values()[r.nextInt(Outcome.values().length)];
boolean possible_given_info = child_1 == Outcome.B_Tu || child_2 == Outcome.B_Tu;
boolean interesting = possible_given_info && child_1.isBoy() && child_2.isBoy();
count_possible_given_info += possible_given_info ? 1 : 0;
count_interesting += interesting ? 1 : 0;
}
System.out.println("count_experiments: " + count_experiments);
System.out.println("count_possible_given_info: " + count_possible_given_info);
System.out.println("count_interesting: " + count_interesting);
System.out.println("count_interesting / count_possible_given_info: " + (count_interesting / count_possible_given_info));
}
}
Example output: theoretical (13/27): 0.48148148148148145
count_experiments: 1000000000
count_possible_given_info: 1.3775374E8
count_interesting: 6.632153E7
count_interesting / count_possible_given_info: 0.481449941032454- draw a complete probability tree
- sum the prob. of all branches that are possible given the information (having at least 1 boy born on a Tu)
- sum the prob. of all possible branches we're interested in (2 boys)
- divide interesting sum by possible sum
Then assume I made a mistake, invest the same amount of time to program a simple monte carlo simulation to verify the result.
Fix code and probability tree until they match.
Kind of like double book keeping. Very satisfying because you can switch multiple times between theoretical and empirical approach and thinking.
People vote to close and then move on. I don't mind editing my questions to satisfy the moderator's demands, but not if it has zero effect and just wastes my time.
I think people should be required to confirm their close/down-votes after a question or answer was edited, or else the votes should be automatically reverted. This mechanism should probably only apply within a limited time period after the question/answer was posted (or until a certain period of inactivity has passed).
It saddens me deeply, but currently I prefer not to ask questions, because the experience is so jarring.
Also, without IDE support such a plugin will never gain a lot of traction.
(on our keyboards, left shift+alt is an alternative for the right "Alt Gr" key)
I chose the opposite of customization: I decided to train really hard on my standard country-specific 104/105-key keyboard layout. After 20 years I can blindly type every symbol, reach every key, grab the mouse and find my way back, thanks to those 2 notches on the letters 'F' and 'J' to position your index fingers. I bring such a wireless keyboard with me wherever I go - even on vacation - as I cannot work with notebook layouts or Mac keyboards. I'm confident that this keyboard type will be available to buy for a long time.
Not having to take my eyes off the screen prevents a lot of mistakes.
My guess would be that they didn't find out thanks to their monitoring solution, but because some senior manager shouted pretty loudly at someone to get their iPhone to update, asap! :)
A few years ago I made a conscious decision that - at least during my remaining professional career - I will not switch to a new programming language anymore. Instead, I intend to keep specializing in Java. I embrace the fact that in 20 years I will be today's (Assembly|Fortran|C|...)-specialist. I do enjoy reading about other language features. I applaud the people at the cutting edge, experimenting with new stuff, and I am glad that Java is slowly incorporation some of those innovations. Every LTS release (2-3 years), I enjoy learning the curated set that Oracle's language architects decided to add.
This decision helped me tremendously with the fear of missing out on the latest and greatest.