1,903 reputation
410
bio website
location
age
visits member for 3 years, 6 months
seen Jan 8 at 15:38

Dec
20
comment What's the most important feature of quality software?
Sometimes the most beautiful thing a piece of software can do is leave the user completely unaware than any software, or anything much else, was involved in what happened at all.
Dec
20
answered Boss solution vs Developer solution
Dec
17
answered Writing Unit Tests in the Middle
Dec
16
comment “Comments are a code smell”
@Rob Z - For "Don't truncate the fractional cents until after trade has cleared" I would create a type to enforces this rule. It could have a method truncatedValueForAfterTheTradeHasCleared() and it could encapsulate the operations to prevent the values from being truncated. I would also write tests to assert this. This way I could know without having to read all the code whether or not the rule "Don't truncate the fractional cents until after trade has cleared" was actually being followed, or if someone had made a mistake. I could reuse this rule as much as I like, without duplicate comments.
Dec
16
comment “Comments are a code smell”
@Rob Z - I am not sure we should be looking for the fastest way to do something. I agree that comments are fast. But I also think they are inherently unsafe. For example, they easily get detached from the related code during refactoring (e.g. extract method) with no automated way of detecting that human error. Even if the next developer reads the comment, they will not definitely understand it. Even if they do and try not to break it, they still accidentally might. A good test, although not as fast to write, does not have these flaws. It might not always be possible, but it almost always is.
Dec
16
comment “Comments are a code smell”
@Rob Z - I put the "why" in my domain model method and class names. I put what the code is doing in the implementation. So I wouldn't write a method called addSeveralNumbers(). I would write getTotalInvoiceValue() in a class called "ProcessXInvoice"
Dec
16
comment “Comments are a code smell”
@Matthieu M - yeah, by itself "never comment" is no use. Maybe something like "prefer tests to comments" and "prefer readable code to comments"
Dec
16
comment “Comments are a code smell”
@Matthieu M - those are rare considerations. I do try to write tests that show that the code works or doesn't in as many cases as I can. I will go to the trouble of asserting the boundary conditions if they are likely enough. I do write comments in code, but they are extremely rare and only when I fail to find a better, verifiable, way of documenting the design decisions (as you say, for example when I absolutely cannot find a way of making an assertion about a performance characteristic for example). I see a lot more lazy comments as a substitute for a proper test than the other way around.
Dec
13
comment “Comments are a code smell”
How do you test that your comment is correct? Why not write your comment as a test? Any future maintainer can use the test as the verifiable documentation for the code. If the comment has something to do with the execution of the code, then that something /must/ be assertable. If the comment has nothing to do with the execution of the code, then what is it doing in the code where only programmers will look?
Nov
19
awarded  Commentator
Nov
2
answered What tools do you use to manage requests from users?
Nov
2
comment What tools do you use to manage requests from users?
We use it a bit, its OK, its great for enforcing workflows, but the interface is very clunky. It looks like a widget library was ill on the screen.
Oct
28
comment Why are side-effects considered evil in functional programming?
@ChrisF Most defintely it is a side effect. The message passed to the observer (in an OO langauge most likely a method call on an interface) will lead to the state of the UI component on the heap changing (and these heap objects are visible to other parts of the program). The UI component is neither a parameter of the method or the return value. In a formal sense, for a function to be side effect free it must be idempotent. Notification in the MVC pattern is not, for example the UI may display a list of messages it has received - console - calling it twice results in a different program state.
Oct
28
answered For what problems is object oriented programming not a good choice?
Oct
28
answered Why are side-effects considered evil in functional programming?
Oct
26
awarded  Good Answer
Oct
26
awarded  Mortarboard
Oct
26
awarded  Nice Answer
Oct
26
answered What are effective interview questions?
Oct
26
comment What are effective interview questions?
I find this to be quite an inefficent approach. You end up having to constantly dig into which bits of the project the candidate actually worked on and which bits they just had to tell you about so you could understand the design decisions they actually made. It also means that with some unlucky candidates you have to constantly ask, "well, if you weren't forced by your employer to do it that way, how would you have done it?".