Reputation
3,500
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
12 19
Newest
 Cleanup
Impact
~162k people reached

Apr
29
comment When to use functions vs methods?
I woould actually use different terminology. What you call "function", I would call "pure function". Anything that may have side-effects but still returns a value, I would call "function" and anything with only side effects is, as you state, a "procedure".
Apr
20
comment Big-O notation for other cases
General-purpose comparison-based algorithm. Things may be different if you don't have to do comparisons to sort.
Apr
20
comment Binary Search O(log(n)) or O(n)
Strictly speaking, "binary search", is establishing the existence or non-existence of a specific value as a key (frequently assuming the identity key) in an array-like data structure with sorted data.
Apr
20
comment Why does the type go after the variable name in modern programming languages?
And in Go, x, y *int means "declare two variables, x and y, with the type pointer-to-int".
Apr
5
comment Had operator precedence rules changed through the history of a computer language?
Back sufficiently far in C history, the <op>= shortcut was written as =<op>, but that changed in, I think, the mid-to-late 70s.
Apr
4
comment Why is XML called a “language” exactly?
In a computer science context, "language" means a sequence of symbols, following a set of rules.
Mar
29
comment Why did languages such as shell scripting and perl use $ in front of variable names?
@user161778: Note that an alias is NOT inherited through the normal environment (thus the need to define them in .bashrc).
Mar
14
comment How do I replicate my object-ish style from Python into Golang?
You can append to a slice, but doing so is not a method, just a function call. In Go, your People.append(me) would be people = append(people, me).
Mar
8
comment What is the value proposition of “build, release, run”?
@kojiro Would it be possible to make "the code" the file(s) and symlink(s) if they don't exist? Once that's in place, you can then ensure that in integration tests.
Mar
3
comment Why do teams still insist on a code-styling policy?
If you look at the Google style guides, most of them deal with "how to name things", "what features should you use", "how should you structure your code into files", ... and a very small amount involve actual "put these spaces, use this indentation, braces go here..."
Feb
26
comment Will a computer attempt to divide by zero?
For floating point, the choice between "NaN" and "trap" is usually settable by flipping flags in the FPU.
Feb
12
comment What was the first language that allowed a class to contain a member of it's own type
Yep, that's why I said "more limited example" (if your only type is "thing", any reference is naturally recursive). Simula had something looking very much like the modern notion of classes and inheritance, so if you're interested in computer language in general, it's probably worth looking into from multiple points of view.
Feb
12
comment What was the first language that allowed a class to contain a member of it's own type
It ("pointer to object of same type") was definitely present in Simula 67 (released in 1968) and probably available in Simula I (released in 1962). A slightly more limited example would be lists in Lisp (released 1958).
Feb
5
comment Word game algorithm
More space-efficient, for sure (you're trading an M-character string for a single character and a small-ish integer)
Jan
14
comment Is it effective to review code in language I don't know?
@BЈовић Nope, it's not the worst you can find, but it is pretty close to "the smallest thing found that is still worthwhile".
Jan
14
comment Is it effective to review code in language I don't know?
@BЈовић And if the only comment is of the form "wouldn't variable flugh be better named bloops, as you have typed it as a bloop and it's an array?" ?
Dec
31
comment Does it make sense to use the term “Space Leak” with regard to Java?
I tend to use one of "unintentional liveness" (there's one or more references to an object, keeping it live, even though it is no longer needed) or "GC bug" (if the object is no longer reachable, but still cannot be collected).
Oct
28
comment Does extending a ruby class violate the LSP?
I suspect Cat and Mammal are better examples than Room and House. Sub-classes should, in general, follow an "is-a" relation (so, neither a "has-a" or "exists-in").
Oct
16
comment How does google calculate travel distance/time
@HugoDelsing Have a couple of tens of thousands of "route-finder nodes", able to speak a common RPC protocol. Send "navigate from A to B" to a couple of hundred (with different biasing), have them compute routes and send best-so-far route (and cost) back to the controlling node. Periodically update them with cost of cheapest route found so far. Allow, say, 0.5 - 1 s from "start of tracking" to "you're done now". Pick the cheapest route found. Don't underestimate what you can do when you can throw insane amounts of CPU, disk and RAM at problems.
Oct
16
comment How does google calculate travel distance/time
@HugoDelsing "Cheapest route between A and B" is a completely different problem from "Cheapest route between N points". The first has some pretty good applicable heuristics ("never move sufficiently straight back to A" would be one), the second is NP-complete.