Eiko
Reputation
246
Top tag
Next privilege 250 Rep.
View close votes
Badges
1 7
Newest
Impact
~4k people reached

• 0 posts edited
• 1 helpful flag
• 9 votes cast

# 8 Comments

 Jan 22 comment Enforcing order for two consecutive statements The easier understandable your code, the lesser the chances of messing around with it. For example, (index < 2) would be much easier to read and understand for me. And in this case, it's the same as (index < 0). Make your logic as easy to follow as possible. Jan 22 comment Enforcing order for two consecutive statements Good point on the unit test! Jun 15 comment Should I check parameter before using it in methods? @Giorgio Totally agree. The question seems to be about wrong API usage (i.e. programmer error, aka bug), so silently returning false is inappropriate. This asks for even more code to deal with programming errors, and you can't do a sensible thing anyway. The golden rule: Crash early, crash often! Makes life for programmers so much easier. Whoever will use your code later will hate you for hiding API usage mistakes. Jun 15 comment Should I check parameter before using it in methods? How is that "false" helpful for the developer calling that function? Is he supposed to check for it? Does it offer any hint of what's going wrong and when? Jun 15 comment Fast indexing of k-combinations Typical sizes are nCr(64, 1...10), and it can often be just a one-time conversion for a given index or combination, so setting up the complete table might not be the best option. Tables work if you need one them and permanently, but I often need several different ones, and this fills up memory quickly. If we take it to like nCr(100, 1...6) it's out of reach anyway. Jun 15 comment Fast indexing of k-combinations Thanks, that gives a solution for k = 2. Maybe I can work out something for k > 2 from that starting point. Jun 15 comment Fast indexing of k-combinations @MichaelT Your links do not address the question - iterating over the combinations is not the problem. This is about mapping indices and combinations. Given "11001000", what is the index (or enumeration count if you will)? What code belongs to index 1673? Dec 4 comment How important is graceful degradation of JavaScript? The developers' time is much better spent on the javascript part, bringing benefit for the other 98% to 99%, read: 294 millions users. Don't let them suffer because of the other 6 millions.