Reputation
1,702
Next privilege 2,000 Rep.
Edit questions and answers
Badges
7 13
Newest
 Yearling
Impact
~72k people reached

Dec
1
comment Elegant ways to handle if(if else) else
I don't like implicitely passing arguments as instance variables like that. You get full of "useless" instance variables and there are many ways to botch up your state and break the invariants.
Nov
29
comment What would you do if your client required you not to use object-oriented programming?
@Marcin: its true that modern FP languages are quite powerful. I just really wanted to point out the distingction between data-structurs/ADTs and OO
Nov
12
comment Can a function be too short?
I'm talking about things identity function from the Haskell standard library - I don't think you can get more "tautological" then that :)
Nov
11
comment Is it OK to use dynamic typing to reduce the amount of variables in scope?
I can imagine it would be horribly comlicated but I don't think it would cause any runtime problems. Scoping can be determined statically by the compiler.
Nov
11
comment Is it OK to use dynamic typing to reduce the amount of variables in scope?
I'm not worried about reusing variables for performance. I'm worried about the bug risk of leaving variables (and values) in scope after they cease to be useful to me.
Nov
11
comment Is it OK to use dynamic typing to reduce the amount of variables in scope?
I edited the question in order to try to clear up my point. I don't think this is a strict duplicate of the "reuse variables" question since my main issue is scoping the variable. I also don't think the answer there is useful to me, since in both examples I gave the transformation function (open, new RegExp) is already refactored. Also for my purposes refactoring things in many methods is an orthogonal issue, since just adding extra blocks {} would do mostly the same thing, as far as scoping goes...
Nov
11
comment Can a function be too short?
Tautological functions are fine for higher order code (although in this case you often use anonymous lambdas instead)
Nov
11
comment Why don't we store the syntax tree instead of the source code?
Tell this to the LISPers now...
Nov
9
comment Where did the notion of “one return only” come from?
From the last paragraph of "Goto Statement considered harmful": "in [2] Guiseppe Jacopini seems to have proved the (logical) superfluousness of the go to statement. The exercise to translate an arbitrary flow diagram more or less mechanically into a jump-less one, however, is not to be recommended. Then the resulting flow diagram cannot be expected to be more transparent than the original one."
Nov
9
comment Where did the notion of “one return only” come from?
I bet you must be one of those guys that also litters the code with boolean flags instead of using break and continue in loops.
Nov
5
comment Is it necessary to know and understand design patterns in order to be a professional programmer?
Some design patterns are pretty dependent on the language you use not obsoleting them :P
Oct
16
comment Do exceptions basically exist to prevent a system from crashing?
Actually handling "abnormal" control flow is precisely when goto and its friend break are the most useful. The advantage of exceptions is that they can cross function boundaries and that the caller can determine where its most apropriate to catch it.
Oct
15
comment Why do languages such as C and C++ not have garbage collection, while Java does?
@steve314: Having witten the answer this thread is attached to, I already receive a notification for all comments. Doing an @-post in this case would be redundant and is not allowed by SE (don't ask me why though). (The real cause though is because my number is missing)
Oct
15
comment Why do languages such as C and C++ not have garbage collection, while Java does?
@Steve314: I'd love to see that if you ever remember where you found it!
Oct
14
comment OO Design principle name?
@JB King: Co- and contra-variance deal with restrictions you have when overriding methods in a subclass. A method in a subclass cannot receive more specific type as input and cannot return a less specific type (without violating the contracts specified by the superclass and thus the substitution principle). The OP is mentioning a more general rule of thumb that isn't specific to inheritance relationships.
Oct
8
comment Is COBOL lucrative?
Iḿ really curious about what motivation you would have other than the money. Maintaining legacy COBOL systems is not the kind of job most people look forward to.