Reputation
2,924
Top tag
Next privilege 3,000 Rep.
Cast close & reopen votes
Badges
14 30
Newest
 Good Answer
Impact
~143k people reached

Jun
16
comment Forcing people to read and understand code instead of using comments, function summaries and debuggers?
@Mikey Oh, fully agreed. My remark was merely a sort of "meanwhile, in the real world..." What you say is definitely valuable. Unfortunately, in the real world people seldom write comments or, for that matter, good code.
Jun
16
comment Forcing people to read and understand code instead of using comments, function summaries and debuggers?
But isn't the real world with deadlines the one in which many people are forced to write crappy code without comments or any sane identifier naming whatsoever? :P "I'll write comments and refactor this piece of c...ode later. Not enough time now, must deliver this for yesterday!"
Jun
14
comment When is it a good time to reason about performance in Haskell?
This answer is too broad and not very helpful for Haskell. Assume the OP already knows about macro vs micro optimization. How does this answer apply to Haskell, a non-strict language for which it is harder to reason about runtime and memory performance?
Jun
14
comment Programming as fast as you can touch-type… How to get to that stage?
I agree with your answer, but with the caveat that "being a good, fast programmer" is about solving problems fast, not typing fast. Typing is simply not the bottleneck for anything but the most trivial problems.
Jun
14
comment Programming as fast as you can touch-type… How to get to that stage?
Unless you are a particularly clumsy typist, typing speed is not an issue. Programming isn't about typing fast.
Jun
13
comment Is Haskell function composition an instance of pipe & filter architectural pattern
What is a CPO category? My google-fu is weak :(
Jun
13
comment Which design patterns would I use for this algorithm?
Why do you think you need a pattern here?
Jun
13
comment What did Rich Hickey mean when he said, “All that specificity [of interfaces/classes/types] kills your reuse!”
@GlenPeterson Yes, you are right. Or rather, instead of "dynamic" (which do assign "named" types to the value) I'd say "languages with structural typing", such as Clojure. Note that what you suggest, rather than a full-blown solution is actually a trade-off; what you gain in flexibility you lose in type safety (which is what static typing addresses!). BTW, I'm no expert and might have got the details wrong ;)
Jun
12
comment What features should a programming language have to say it has good reusability?
OOP is by no means a requirement for code reuse.
Jun
12
comment Why is Python written in C and not in C++?
@ott Indeed, that question does make sense: why isn't the standard implementation of Python written in Python? It follows that the designer of Python likes his own language, so the question is interesting.
Jun
12
comment Why is Python written in C and not in C++?
@PiotrDobrogost That's a strawman. It's obvious why you wouldn't want to write modern, non-performance critical code in assembly. Your question is different though: "why C instead of C++?". Let me reverse the question: "why C++ instead of C?". Or worse: "why C++ and not Pascal. I like Pascal more!"
Jun
12
comment Why is Python written in C and not in C++?
I fail to see the point of asking "why is (popular program) written in (language X) and not (language Y)?". Or rather, the same question can be reversed: why Y and not X?
Jun
12
comment Why is Python written in C and not in C++?
@hyde And also against C++ programmers at the time :P
Jun
12
comment Why is (position < size) such a prevalent pattern in conditionals?
Might be related to how intervals are written [min, max] and not [max, min]. Therefore, it's only natural to check than an element x belongs to the interval by writing min <= x <= max.
Jun
11
comment c#/java or c++ (Personal question)
You enjoy C#? It seems you've answered your own question. By the way, please read the FAQ: you'll see questions here should apply to all programmers, therefore a "personal question" is probably too localized :)
Jun
7
comment Why does PHP have interfaces?
@YamMarcovic Here's an example: Haskell is a statically typed language (with a stronger type system than PHP and the usual 'static' OOP languages) and it has no nulls. Therefore, you cannot pass null to a function. A whole family of bugs goes away as soon as the compiler statically assures that yes, you are getting a value, and not null. You can use the Maybe monad for "optional" values, but it doesn't work like null in unsafe languages, and it can never surprise you.
Jun
6
comment Passing member variable as a method parameter
@Tarion I disagree with Uncle Bob on this. Whenever possible, methods should be function-like and only depend on explicit dependencies. (When calling public methods in OOP, one of these dependencies is this (or self), but it's made explicit by the call itself, obj.method(x)). Other implicit dependencies are the object's state; this usually makes code harder to understand. Whenever possible -- and within reason -- make dependencies explicit & functional-style. In the case of private methods, if possible, explicitly pass every parameter they need. And yes, it helps to refactor them out.
Jun
4
comment I don't understand how TDD helps me get a good design if I need a design to start testing it
@Giorgio Fully agreed! I do see some value in TDD, just not if blindly followed. But isn't this a trap Ron Jeffries himself, one of Agile/TDD's famous proponents, fell into? And if he made this mistake (hey, we are all human!), shouldn't he acknowledge it so less experienced TDD practicioners don't fall into the same trap?
Jun
3
comment Is this pattern bad?
@DocBrown If those internal details can be generalized in order to be used in multiple components, then you extract them to a separate component, complete with its own unit tests. Again, you never directly test private methods.
Jun
3
comment Is this pattern bad?
@DocBrown It's not the same as saying integration tests make unit tests needless. Integration tests exercize the "connectivity" between separate components; in contrast, unit tests exercisze the local logic of a single component thoroughly (corner cases, etc.). Integration and unit tests don't exercize the same scenarios! However, a good unit test doesn't need to test private implementation details, just the public API. If thoroughly testing the public API doesn't give you coverage of internal details, then those details aren't being used, and are therefore dead code.