Reputation
3,388
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
2 11 31
Newest
 Yearling
Impact
~181k people reached

Mar
3
comment What programming technique is this?
I think you're running into memoization
Feb
20
comment How to sell DRY architecture
@gnat Doesn't seem like a duplicate - here they agree that quality is good, but not how to get quality code.
Feb
5
comment Is there a name for the problem of representing state twice and then getting out of sync?
With regards to databases, the equivalent of DRY is third normal form. Not sure if it can be applied to data in the code (free variables, object attributes, etc)
Feb
1
comment Literal strings vs. object properties in JavaScript
And if the latter's verboseness really is an issue for the user (as it would for me), the examples are really really easy to create a short wrapper that takes an array of objects and calls .addColumn() for each
Jan
30
comment Are there any benefits of using this extra variable in the for loop annotation?
According to your jsperf, the one without n is faster on my computer. So yeah, don't do this - assuming it even did anything (there may be more going on similar to what CodesInChaos mentions), it's a micro-optimization that's so minor, any other fluctuation in CPU usage has more of an effect.
Jan
15
comment Is there a pattern for a more “natural” way of adding items to collections?
@KilianFoth If you're restricting yourself to just one function/method, sure. But if you want to base it off of English or similar languages, a wrapper for the singular item seems closest: put(item).into(items)
Jan
9
comment One-line functions that are called only once
@JamesAnderson Current time shouldn't be treated as a global. Imagine unit testing a leap-year bug where the "current time" has to be set to something specific.
Jan
5
comment What are 4th & 5th programming language generations? Are there more of them?
"There is no universally accepted definition of what exactly defines the “nth generation” for n > 2." - Okay, so, what are 1 and 2?
Jan
5
reviewed Approve What are 4th & 5th programming language generations? Are there more of them?
Dec
23
comment JavaScript strict mode compatibility
@jfriend00 this === window in a regular function call, not undefined (unless there's something changing it higher up the call stack)
Dec
17
comment Are all magic numbers created the same?
@Snowman Fear the Leap Second
Nov
30
comment Why is the concept of lazy evaluation useful?
@stakx Without a better description, they don't seem to be related except by chance. The advantage of laziness in this example is that a lazy generator is capable of generating all possible states of the game, but isn't going waste time/memory doing so because only the ones that happen will be consumed. The generator can be separated from the consumer without being a lazy generator, and it's possible (albeit more difficult) to be lazy without being separated from the consumer.
Nov
20
comment Is using MultiMaps code smell? If so what alternative data structures fit my needs?
@SebastianRedl Looks like a little bit of both; YAML seems to allow deserialization into arbitrary object instances, and requires extra work to prevent code execution in dynamic languages
Nov
20
comment How do I review code changes that are the result of syncing?
What do you use for version control? git, svn, hg, etc..?
Nov
6
comment Why do we use non-descriptive internal codenames?
@back2dos The examples the OP gives seem to be describing the equivalent of print_left_aligned_to_CRT_monitor()
Nov
6
comment Why do we use non-descriptive internal codenames?
This seems to be proposing something along the lines of Systems Hungarian for these codenames; I see this getting out of hand extremely quickly... W8U140432b_Downloader (using only the proposed metadata in the question)
Oct
16
comment Why do so many websites prefer “git rebase” over “git merge”?
@JohnDaniel And D uses it wrong why are you ever making commits you haven't tested? That seems like the source of the confusion in your example...
Oct
16
comment Why do so many websites prefer “git rebase” over “git merge”?
@JohnDaniel Assuming commits B, C, and D were made in order, then B and C do contain an issue - they're no longer compatible with the pushed code. D won't be the source of that problem unless you intentionally changed the order of your 3 commits. And, as I describe at the beginning of my answer, your commit message for B should contain enough information for you to fix it in a new commit (and if necessary, rebase -i and squash it into B so that the commit passes again)
Oct
8
comment Why is reading from memory not a side-effect but reading from a file is?
@orionll Reading from a file can cause a change to its access time, if enabled for that filesystem. That's a (small) side-effect, and as hinted above, it's not something that the compiler is capable of knowing about beforehand
Oct
2
comment What is the benefit of a function without parameters which only calls another function
window.alert is also often used as a placeholder during development until a nice modal/popup can be designed/implemented, so, same as the language issue, it can be switched out much more easily. Or if you already have one, a design update a few years down the line might require similar changes.