Reputation
41,133
Next tag badge:
275/100 score
19/20 answers
Badges
9 77 140
Newest
 Yearling
Impact
~1.6m people reached

Jul
4
comment Why do most programming languages only support returning a single value from a function?
@Telastyn: Conceptually, a function in Mathematics is a morphism, a mapping of values from one set to another. In imperative programming, a function consists of a body, which is just a sequence of statements and flow control constructs, a parameter list, and a return type. When a programming function is pure, it is isomorphic with the Mathematical function concept, but the mindset is still different. In pure functional programming, treating functions as Mathematical functions does make sense though, most of the time, and it's quite common to do so.
Jul
4
comment Why do most programming languages only support returning a single value from a function?
@SteveEvers: And technically, Haskell's IO monad is cheating; it allows the language to remain pure by offloading the impure parts to the underlying runtime. Basically, returning IO Something is a Haskell programmer's way of saying, "My code is still pure, I can't be blamed for the runtime using it as an excuse to trigger side effects!", much like a mobster might argue that he's innocent because he didn't actually kill anyone, just "suggested" that others do it for him. Still makes for very elegant code though, so I'm not actually arguing against Haskell here.
Jul
4
comment Why do most programming languages only support returning a single value from a function?
@SteveEvers: it's unfortunate that the name "function" took over in imperative programming, instead of the more appropriate "procedure" or "routine". In functional programming, a function resembles Mathematical functions much more closely.
Jul
4
answered Is there a concept of a variable with phases of initialization: uninitialized, initializing, immutable?
Jul
4
comment Should user input of a contact form be validated?
Server-side validation is necessary to prevent data pollution, but from a security standpoint, very rudimentary validation is enough: making sure that very large input is discarded as early as possible to reduce the attack surface for DoS, and rate-limiting + CAPTCHA checks to prevent spamming, brute-forcing and DoS attacks is about as wild as it gets. What you absolutely do want though is to convert data to the correct format whenever it crosses a layer boundary (database <-> logic or logic <-> presentation). But that's not validation.
Jul
4
comment Should user input of a contact form be validated?
Validation does not prevent XSS. Correct output encoding does.
Jul
3
awarded  Great Answer
Jul
2
comment How to familiarize myself with Python
You definitely want to participate in the Python community, or that of whatever tech you're learning. SO is a great resource, but it's not immersive enough to give you a good feel of the community's conventions and habits, and you'll have a harder time writing idiomatic code.
Jul
2
comment Why do most programming languages only support returning a single value from a function?
Functions in Mathematics and functions in most programming languages are two very different beasts.
Jul
2
answered How to familiarize myself with Python
Jul
2
answered Do logged in users need to browse a site over https?
Jul
2
comment Origin of common list-processing function names
Also note that while those languages don't have common ancestors officially, there absolutely has been a lot of influence, back and forth. Guido van Rossum had done his homework when he started designing Python, and Scheme, Common Lisp, Perl and (IIRC) Haskell and ML were already around at the time.
Jul
1
answered Why do some opensouce libraries lack comments?
Jun
24
reviewed Approve What's wrong with relative imports in Python?
Jun
21
comment When does SOAP make more sense than REST?
@maple_shaft: I disagree; "understandable" / "obscure" is subjective, but "simple" / "complex" is not. It may not be quantifyable, but it is observable, and people usually agree over the relative degree of complexity of any two given exhibits.
Jun
20
comment Break on default case in switch
@svick: all of them, to varying degrees. C set the standard back in the days, and C++, Java, JavaScript and PHP use mostly the same rules. C# is a bit different in that it disallows fall-through, but otherwise, the same applies.
Jun
20
answered Attributing credit for programming languages used
Jun
20
comment How to solve the problem of nested comments
@Vorac: glad you like the reference :D
Jun
20
awarded  Guru
Jun
19
answered What is the reason for using lowercase for the first word in a local variable (eg, employeeCount, firstName)