1,665 reputation
412
bio website inf.puc-rio.br/~hgualandi
location Brazil
age 24
visits member for 3 years, 1 month
seen yesterday

Dec
5
comment What hurts maintainability?
Isn't this a bit tautological? :)
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 What should be changed in the system used to teach IT in my school?
Why the hell is UML the first thing on that list?
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
15
comment What's wrong with JavaScript
@SirTapTap: A static type system can let you be more bold when refactoring code, since the compiler will help find all the broken pieces that need to be changed. That said, a more loosely typed system can allow you to run the program in an unfinished state, rolling changes more incrementally.
Oct
15
comment What's wrong with JavaScript
@SirTapTap: A static type system is not that bad actually. The more advanced type systems can handle generality pretty well and you can also use the Dart approach of having a flexible type system that just helps give some warnings. (And btw, I don't think C, the king of unsafe casts and void*, is that good of a poster boy for static typing :P)
Oct
15
comment What's wrong with JavaScript
I actually would consider classes as a step backwards. If you want to do OO the prototypal pattern is just as good (and perhaps even more powerful) and if you want modularization an actual module system that doesn't abuse the class system is much simpler and saner.
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.