2,672 reputation
2618
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 3 years, 11 months
seen 1 hour ago

Oct
14
comment Why does the instruction “do” require a “while”?
The two part do...while only exists to check after the loop. For checking at the beginning and infinite loops c doesn't require a pair either. There is no difference as far as this question is concerned between python's while True: and c's while(true)
Oct
14
comment Why does the instruction “do” require a “while”?
your python example doesn't match the purpose of do{}while(). The idea behind do{}while() is checking the condition at the end of the loop, not at the beginning.
Oct
12
comment is it bad that I have no html, or javascript in my php files
Even with traditional non-ajax sites I prefer to separate code that actually does something from the markup. In php that could be smarty templates, or simply seperate php files.
Oct
9
comment Clean readable code vs fast hard to read code. When to cross the line?
@DustinDavis Actually in .net the difference between nice and ugly code is bigger since it doesn't have a good optimizer. This includes manual loop unrolling and when targeting .net < 4.5 even manual inlining.
Oct
8
comment content fingerprint algorithm
@lukas.pukenis If performance allows, go with a strong hash, such as SHA-2.
Oct
8
comment content fingerprint algorithm
How do you define duplicate? Byte for byte? In that case, what's the problem with a hash?
Oct
8
comment Optional semicolons
javascript has shown that its implementation of optional semicolons is flawed. It doesn't show that optional semicolons are bad per-se.
Sep
25
awarded  Custodian
Sep
25
reviewed Edit suggested edit on Why is “tight coupling between functions and data” bad?
Sep
25
revised Why is “tight coupling between functions and data” bad?
Fixed "can can't" typo
Sep
25
comment Why is “tight coupling between functions and data” bad?
My impression is that most criticism of OOP is actually criticism of OOP as implemented in Java. Not because that's a deliberate straw man, but because it's what they associate with OOP. There are pretty similar issues with people complaining about static typing. Most of the issues aren't inherent in the concept, but just flaws in a popular implementation of that concept.
Sep
25
revised Why is “tight coupling between functions and data” bad?
added 41 characters in body
Sep
25
comment Why is “tight coupling between functions and data” bad?
@JörgWMittag My impression is that many who criticize OOP criticize the form of OOP used in Java and similar languages with its rigid class structure and focus in instance methods. My impression of that quote is that it criticizes the focus on instance methods and doesn't really apply to other flavours of OOP, like what golang uses.
Sep
25
comment Why is “tight coupling between functions and data” bad?
@GlenPeterson Because I originally wanted to write only a single sentence, and it kept growing
Sep
25
answered Why is “tight coupling between functions and data” bad?
Sep
25
comment Why is “tight coupling between functions and data” bad?
Instance methods (unlike free functions or extension methods) can can't be added from other modules. This becomes more of a restriction when you consider interfaces which can only be implemented by the instance methods. You can't define an interface and a class in different modules and then use code from a third module to bind them together. A more flexible approach, like haskell's type classes should be able to do that.
Sep
19
comment Are there any valid use-cases for eager boolean evaluation?
IMO the only advantage is that you clearly see the difference between short-circuiting && on bools and non short-circuiting & on integers.
Sep
19
comment Are there any valid use-cases for eager boolean evaluation?
&& vs & is only about observable behavior (side-effects), which doesn't include timing. So using & doesn't help in the crypto case, because the compiler is free to optimize it to && if it knows that the right hand side has no side-effects. You need to use code that sufficiently confused the compiler that it doesn't manage to optimize your code, which in practice involves using & on integers not on bools.
Sep
19
comment Is it appropriate for interviewers to ask candidates for their Stack Exchange user name?
Just keep in mind that old questions/answers might not match the current knowledge and abilities of somebody.
Sep
15
revised Why is this syntax convention?
Format code as code, so `<` and `>` don't get interpreted as html