1,879 reputation
822
bio website
location
age
visits member for 1 year, 10 months
seen Apr 15 at 23:37

Mar
27
comment Should we test all our methods?
I'm still making up my mind on this question, but here's a talk of someone who has decided the answer is "no". Ian Cooper: TDD, where did it all go wrong To summarize this great talk, you should test outside-in and test new behaviors not new methods.
Mar
4
comment I'm struggling with abstracting my animation code in my game using a functional style. How can I do this?
It also seems to be against the design of the Entity Component System design pattern. That said... If you think I should still just put the function in my state, I'll trust you on this.
Mar
4
comment I'm struggling with abstracting my animation code in my game using a functional style. How can I do this?
I'm using javascript + "discipline" to code it in a functional style. I've also been trying to keep my data and behavior completely separate from each other, and I feel like the player state having-a function would be mixing the two together. My rule is somewhat arbitrary, but a nice benefit is I can easily serialize the state whenever I want to save it or have another programming language send it over the wire. That said, your answer is an easy way to accomplish the result I'm looking for. But, is there a way to do it while keeping behavior out of my state?
Mar
3
comment I'm struggling with abstracting my animation code in my game using a functional style. How can I do this?
What's a functor? Are you using the "Function Object" meaning of the word?
Jan
30
comment So Singletons are bad, then what?
@Lucas ah, so is he saying the impl of that Cache class uses those interfaces on the side but implements the interfaces below?
Jan
30
comment So Singletons are bad, then what?
@Lucas that didn't clarify. Maybe because of your typos.
Jan
30
comment So Singletons are bad, then what?
I'm not sure if I understand this last picture or not. Why are there interfaces on the side? How are these interfaces different from the ones below the cache?
Jan
28
comment Returning different types from one function in a dynamically typed language
By coincidence, I'm dealing with this with a Java Rest API I'm building. I made it possible for one resource to return either XML or JSON. The lowest common denominator type in that case is a String. Now people are asking for documentation on the return type. The java tools can generate it automatically if I return a class, but because I chose String I can't generate the documentation automatically. In hindsight/moral of the story, I wish I returned one type per method.
Jan
28
comment Returning different types from one function in a dynamically typed language
It seems that it makes sense to return multiple types in one function in all the same places it makes sense to return a generic type in Java. Unfortunately, I don't know how to articulate it better than this.
Jan
27
comment Returning different types from one function in a dynamically typed language
Sorry, I led you astray with my poor example. Forget I mentioned it in the first place. Your first paragraph is on point. I also like your second example.
Jan
27
comment Returning different types from one function in a dynamically typed language
@TrueWill I address that in the next sentence.
Jan
22
comment In scrum, how do you give an estimate for a backlog item that is primarily research?
I think this is good advice in general. But like I said, "I could never tell if I was almost done or far from it.".
Jan
22
comment In scrum, how do you give an estimate for a backlog item that is primarily research?
In my situation it wasn't really possible to break things down this way. I knew which API to call. The majority of the time was spent deciphering and fixing the errors it was giving me on that call. But I can see how for general research problems this is a good approach.
Oct
22
comment How to refactor an OO program into a functional one?
@GlenPeterson OK, well in JS it's very hard to minimize mutability.
Oct
16
comment How to refactor an OO program into a functional one?
@Evicatos see my edit
Oct
15
comment How to refactor an OO program into a functional one?
@Evicatos: I dunno, if JavaScript had better support for immutable state, I think my solution would be as functional as you'd get in a dynamic functional language like Clojure. What's an example of something that would require something beyond just refactoring?
Oct
14
comment Is it bad practice to check object types with an identifying member variable?
@amon personally, every time I try to use the visitor pattern the code becomes harder to maintain. I'm a java programmer though, maybe that makes a difference.
Oct
7
comment What are the advantages of converting empty strings to evaluate to true as compared to false?
Did you mean to say "false-ish"? To rephrase your answer, are you saying, "Because you can write less"?
Oct
5
comment Does functional programming ignore the benefits gained from the “On the Criteria To Be Used in Decomposing Systems into Modules” (data hiding)?
@jozefg you often do that in Java too with a private constructor and a static method to create a new instance. But rarely does one create a class with a private constructor and public fields. And if someone did, that would seem like the opposite of data hiding to me. Maybe you can explain what I'm missing here.
Oct
4
comment Does functional programming ignore the benefits gained from the “On the Criteria To Be Used in Decomposing Systems into Modules” (data hiding)?
@AndresF. ah yeah that's true. I forgot that Haskell has modules and you can hide data types and functions in them. Perhaps when I say FP I'm really saying Clojure. You can have private functions and "fields" in Clojure, but I feel like it's idiomatic to make your data visible to anything and pass it anywhere.